Added in the lighthouse. <3

This commit is contained in:
JoshuaNavarro 2019-09-16 21:53:21 -07:00
parent 5435157853
commit 72da92e842
7 changed files with 60 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 743 B

View File

@ -252,6 +252,10 @@ namespace Revitalize.Framework.Illuminate
return copy; return copy;
} }
public static LightSource CreateLightSource(float Radius, Color ActualColor,int Texture=4)
{
return new LightSource(Texture, new Vector2(0, 0), Radius, ActualColor.Invert());
}
} }
} }

View File

@ -318,6 +318,20 @@ namespace Revitalize.Framework.Objects
} }
} }
private bool _alwaysDrawAbovePlayer;
public bool AlwaysDrawAbovePlayer
{
get
{
return this._alwaysDrawAbovePlayer;
}
set
{
this._alwaysDrawAbovePlayer = value;
this.requiresUpdate = true;
}
}
[JsonIgnore] [JsonIgnore]
public bool requiresUpdate; public bool requiresUpdate;
public BasicItemInformation() public BasicItemInformation()
@ -341,9 +355,10 @@ namespace Revitalize.Framework.Objects
this.id = ""; this.id = "";
this.shakeTimer = 0; this.shakeTimer = 0;
this.EnergyManager = new Energy.EnergyManager(); this.EnergyManager = new Energy.EnergyManager();
this._alwaysDrawAbovePlayer = false;
} }
public BasicItemInformation(string name, string id, string description, string categoryName, Color categoryColor,int edibility, int fragility, bool isLamp, int price, bool canBeSetOutdoors, bool canBeSetIndoors, Texture2D texture, AnimationManager animationManager, Color drawColor, bool ignoreBoundingBox, InventoryManager Inventory, LightManager Lights,Energy.EnergyManager EnergyManager=null) public BasicItemInformation(string name, string id, string description, string categoryName, Color categoryColor,int edibility, int fragility, bool isLamp, int price, bool canBeSetOutdoors, bool canBeSetIndoors, Texture2D texture, AnimationManager animationManager, Color drawColor, bool ignoreBoundingBox, InventoryManager Inventory, LightManager Lights,Energy.EnergyManager EnergyManager=null,bool AlwaysDrawAbovePlayer=false)
{ {
this.name = name; this.name = name;
this.id = id; this.id = id;
@ -374,6 +389,7 @@ namespace Revitalize.Framework.Objects
this.shakeTimer = 0; this.shakeTimer = 0;
this.EnergyManager = EnergyManager ?? new Energy.EnergyManager(); this.EnergyManager = EnergyManager ?? new Energy.EnergyManager();
this.AlwaysDrawAbovePlayer = AlwaysDrawAbovePlayer;
} }
/// <summary> /// <summary>
@ -391,7 +407,7 @@ namespace Revitalize.Framework.Objects
/// <returns></returns> /// <returns></returns>
public BasicItemInformation Copy() public BasicItemInformation Copy()
{ {
return new BasicItemInformation(this.name, this.id,this.description, this.categoryName, this.categoryColor, this.edibility, this.fragility, this.isLamp, this.price, this.canBeSetOutdoors, this.canBeSetIndoors, this.animationManager.getTexture(), this.animationManager, this.drawColor, this.ignoreBoundingBox, this._inventory.Copy(), this._lightManager.Copy(),this._energyManager.Copy()); return new BasicItemInformation(this.name, this.id,this.description, this.categoryName, this.categoryColor, this.edibility, this.fragility, this.isLamp, this.price, this.canBeSetOutdoors, this.canBeSetIndoors, this.animationManager.getTexture(), this.animationManager, this.drawColor, this.ignoreBoundingBox, this._inventory.Copy(), this._lightManager.Copy(),this._energyManager.Copy(),this.AlwaysDrawAbovePlayer);
} }
public bool requiresSyncUpdate() public bool requiresSyncUpdate()

View File

@ -219,7 +219,13 @@ namespace Revitalize.Framework.Objects.Furniture
{ {
addedDepth += 1.0f; addedDepth += 1.0f;
} }
this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((y + addedDepth) * Game1.tileSize) / 10000f) + .00001f);
int yDepth = y;
if (this.info.AlwaysDrawAbovePlayer)
{
addedDepth += 5f;
}
this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((yDepth + addedDepth) * Game1.tileSize) / 10000f) + .00001f);
try try
{ {
this.animationManager.tickAnimation(); this.animationManager.tickAnimation();

View File

@ -4,6 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Revitalize.Framework.Illuminate;
using Revitalize.Framework.Objects.CraftingTables; using Revitalize.Framework.Objects.CraftingTables;
using Revitalize.Framework.Objects.Extras; using Revitalize.Framework.Objects.Extras;
using Revitalize.Framework.Objects.Furniture; using Revitalize.Framework.Objects.Furniture;
@ -112,6 +113,31 @@ namespace Revitalize.Framework.Objects
this.loadInCraftingTables(); this.loadInCraftingTables();
this.loadInMachines(); this.loadInMachines();
this.loadInTools(); this.loadInTools();
this.loadInAestheticsObjects();
}
private void loadInAestheticsObjects()
{
LampMultiTiledObject lighthouse = new LampMultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Furniture.Misc.Lighthouse", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Lighthouse"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("LightHouse", "Omegasis.Revitalize.Objects.Furniture.Misc.Lighthouse", "A minuture lighthouse that provides a decent amount of light.", "Furniture", Color.Brown, -300, 0, false, 2500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Lighthouse"), new AnimationManager(), Color.White, false, null, null));
LampTileComponent lighthouse_0_0 = new LampTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Furniture.Misc.Lighthouse", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Lighthouse"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("LightHouse", "Omegasis.Revitalize.Objects.Furniture.Misc.Lighthouse", "A minuture lighthouse that provides a decent amount of light.", "Furniture", Color.Brown, -300, 0, false, 2500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Lighthouse"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Lighthouse"), new Animation(0, 0, 16, 16)), Color.White, true, null, new Illuminate.LightManager(),null,true));
LampTileComponent lighthouse_1_0 = new LampTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Furniture.Misc.Lighthouse", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Lighthouse"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("LightHouse", "Omegasis.Revitalize.Objects.Furniture.Misc.Lighthouse", "A minuture lighthouse that provides a decent amount of light.", "Furniture", Color.Brown, -300, 0, false, 2500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Lighthouse"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Lighthouse"), new Animation(16, 0, 16, 16)), Color.White, true, null, new Illuminate.LightManager(), null, true));
LampTileComponent lighthouse_0_1 = new LampTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Furniture.Misc.Lighthouse", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Lighthouse"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("LightHouse", "Omegasis.Revitalize.Objects.Furniture.Misc.Lighthouse", "A minuture lighthouse that provides a decent amount of light.", "Furniture", Color.Brown, -300, 0, false, 2500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Lighthouse"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Lighthouse"), new Animation(0, 16, 16, 16)), Color.White, true, null, new Illuminate.LightManager(), null, true));
LampTileComponent lighthouse_1_1 = new LampTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Furniture.Misc.Lighthouse", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Lighthouse"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("LightHouse", "Omegasis.Revitalize.Objects.Furniture.Misc.Lighthouse", "A minuture lighthouse that provides a decent amount of light.", "Furniture", Color.Brown, -300, 0, false, 2500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Lighthouse"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Lighthouse"), new Animation(16, 16, 16, 16)), Color.White, true, null, new Illuminate.LightManager(), null, true));
LampTileComponent lighthouse_0_2 = new LampTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Furniture.Misc.Lighthouse", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Lighthouse"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("LightHouse", "Omegasis.Revitalize.Objects.Furniture.Misc.Lighthouse", "A minuture lighthouse that provides a decent amount of light.", "Furniture", Color.Brown, -300, 0, false, 2500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Lighthouse"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Lighthouse"), new Animation(0, 32, 16, 16)), Color.White, true, null, new Illuminate.LightManager(), null, false));
LampTileComponent lighthouse_1_2 = new LampTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Furniture.Misc.Lighthouse", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Lighthouse"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("LightHouse", "Omegasis.Revitalize.Objects.Furniture.Misc.Lighthouse", "A minuture lighthouse that provides a decent amount of light.", "Furniture", Color.Brown, -300, 0, false, 2500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Lighthouse"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Lighthouse"), new Animation(16, 32, 16, 16)), Color.White, true, null, new Illuminate.LightManager(), null, false));
LampTileComponent lighthouse_0_3 = new LampTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Furniture.Misc.Lighthouse", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Lighthouse"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("LightHouse", "Omegasis.Revitalize.Objects.Furniture.Misc.Lighthouse", "A minuture lighthouse that provides a decent amount of light.", "Furniture", Color.Brown, -300, 0, false, 2500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Lighthouse"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Lighthouse"), new Animation(0, 48, 16, 16)), Color.White, false, null, new Illuminate.LightManager()));
LampTileComponent lighthouse_1_3 = new LampTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Objects.Furniture.Misc.Lighthouse", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Lighthouse"), typeof(MultiTiledObject), Color.White, true), new BasicItemInformation("LightHouse", "Omegasis.Revitalize.Objects.Furniture.Misc.Lighthouse", "A minuture lighthouse that provides a decent amount of light.", "Furniture", Color.Brown, -300, 0, false, 2500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Lighthouse"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Lighthouse"), new Animation(16, 48, 16, 16)), Color.White, false, null, new Illuminate.LightManager()));
lighthouse_0_0.lightManager.addLight(new Vector2(16, 16), LightManager.CreateLightSource(10f, Color.White), lighthouse_0_0);
lighthouse.addComponent(new Vector2(0,-3),lighthouse_0_0);
lighthouse.addComponent(new Vector2(1, -3), lighthouse_1_0);
lighthouse.addComponent(new Vector2(0, -2), lighthouse_0_1);
lighthouse.addComponent(new Vector2(1, -2), lighthouse_1_1);
lighthouse.addComponent(new Vector2(0, -1), lighthouse_0_2);
lighthouse.addComponent(new Vector2(1, -1), lighthouse_1_2);
lighthouse.addComponent(new Vector2(0, 0), lighthouse_0_3);
lighthouse.addComponent(new Vector2(1, 0), lighthouse_1_3);
this.AddItem("Lighthouse", lighthouse);
} }
private void loadInCraftingTables() private void loadInCraftingTables()

View File

@ -561,7 +561,8 @@ namespace Revitalize
ModCore.ObjectManager.GetItem("Anvil",1), ModCore.ObjectManager.GetItem("Anvil",1),
ModCore.ObjectManager.GetItem("SolarPanelTier1",1), ModCore.ObjectManager.GetItem("SolarPanelTier1",1),
ModCore.ObjectManager.GetItem("SolarArrayTier1",1), ModCore.ObjectManager.GetItem("SolarArrayTier1",1),
new StardewValley.Object(Vector2.Zero,(int)Enums.SDVBigCraftable.Furnace,false) new StardewValley.Object(Vector2.Zero,(int)Enums.SDVBigCraftable.Furnace,false),
ModCore.ObjectManager.GetItem("Lighthouse",1)
}); });
} }

View File

@ -402,6 +402,9 @@
<Content Include="Content\Graphics\Objects\Furniture\Lamps\Oak Lamp.png"> <Content Include="Content\Graphics\Objects\Furniture\Lamps\Oak Lamp.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Content\Graphics\Objects\Furniture\Misc\Lighthouse.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Objects\Furniture\Misc\TrashCan.png"> <Content Include="Content\Graphics\Objects\Furniture\Misc\TrashCan.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>