diff options
author | Zoryn Aaron <zoryn4163@gmail.com> | 2016-03-01 19:36:12 -0500 |
---|---|---|
committer | Zoryn Aaron <zoryn4163@gmail.com> | 2016-03-01 19:36:12 -0500 |
commit | 63392a21e4d95a2803bcb0a6beffc52b9b146dea (patch) | |
tree | 7baf70da9d294a57fb49932c4492c0face73171c /StardewModdingAPI | |
parent | 069589db98df9e388c919a32f8503ad7cd854b7c (diff) | |
download | SMAPI-63392a21e4d95a2803bcb0a6beffc52b9b146dea.tar.gz SMAPI-63392a21e4d95a2803bcb0a6beffc52b9b146dea.tar.bz2 SMAPI-63392a21e4d95a2803bcb0a6beffc52b9b146dea.zip |
fixes my derping
Diffstat (limited to 'StardewModdingAPI')
-rw-r--r-- | StardewModdingAPI/Inheritance/SGame.cs | 20 | ||||
-rw-r--r-- | StardewModdingAPI/Inheritance/SGameLocation.cs | 24 | ||||
-rw-r--r-- | StardewModdingAPI/Program.cs | 48 |
3 files changed, 61 insertions, 31 deletions
diff --git a/StardewModdingAPI/Inheritance/SGame.cs b/StardewModdingAPI/Inheritance/SGame.cs index 0202e55f..fdc6f3f7 100644 --- a/StardewModdingAPI/Inheritance/SGame.cs +++ b/StardewModdingAPI/Inheritance/SGame.cs @@ -117,17 +117,19 @@ namespace StardewModdingAPI.Inheritance { base.Draw(gameTime); Events.InvokeDrawTick(); - /* - spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp, null, null); - if (CurrentLocation != null) - CurrentLocation.draw(Game1.spriteBatch); + if (Program.debug) + { + spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp, null, null); - if (player != null && player.position != null) - spriteBatch.DrawString(Game1.dialogueFont, Game1.player.position.ToString(), new Vector2(0, 180), Color.Orange); - - spriteBatch.End(); - */ + if (CurrentLocation != null) + CurrentLocation.draw(Game1.spriteBatch); + + if (player != null && player.position != null) + spriteBatch.DrawString(Game1.dialogueFont, Game1.player.position.ToString(), new Vector2(0, 180), Color.Orange); + + spriteBatch.End(); + } } public static Int32 RegisterModItem(SObject modItem) diff --git a/StardewModdingAPI/Inheritance/SGameLocation.cs b/StardewModdingAPI/Inheritance/SGameLocation.cs index 69b44003..14d9afa6 100644 --- a/StardewModdingAPI/Inheritance/SGameLocation.cs +++ b/StardewModdingAPI/Inheritance/SGameLocation.cs @@ -23,15 +23,30 @@ namespace StardewModdingAPI.Inheritance SGameLocation s = new SGameLocation(); s.BaseGameLocation = baseClass; s.ModObjects = new SerializableDictionary<Vector2, SObject>(); + + foreach (var v in baseClass.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)) + { + try + { + var fi = s.GetType().GetField(v.Name, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); + if (fi != null && !fi.IsStatic) + { + fi.SetValue(s, v.GetValue(baseClass)); + //Console.WriteLine("SET {0} ON {1} TO {2}", fi.Name, s.name, v.GetValue(baseClass)); + } + } + catch (Exception ex) + { + Program.LogError(ex); + } + } + //s.IsFarm = baseClass.IsFarm; //s.IsOutdoors = baseClass.IsOutdoors; //s.LightLevel = baseClass.LightLevel; //s.Map = baseClass.Map; //s.objects = baseClass.objects; //s.temporarySprites = baseClass.temporarySprites; - s.map = baseClass.map; - s.objects = baseClass.objects; - s.name = baseClass.name; /* s.actionObjectForQuestionDialogue = baseClass.actionObjectForQuestionDialogue; @@ -73,6 +88,9 @@ namespace StardewModdingAPI.Inheritance s.waterTileFlip = baseClass.waterTileFlip; s.waterTiles = baseClass.waterTiles; */ + + + return s; } diff --git a/StardewModdingAPI/Program.cs b/StardewModdingAPI/Program.cs index ce5424c8..c2bb1836 100644 --- a/StardewModdingAPI/Program.cs +++ b/StardewModdingAPI/Program.cs @@ -49,12 +49,19 @@ namespace StardewModdingAPI public static Thread gameThread; public static Thread consoleInputThread; + public const string Version = "0.31 Alpha"; + public const bool debug = false; + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private static void Main(string[] args) { Console.Title = "Stardew Modding API Console"; + Console.Title += " - Version " + Version; + if (debug) + Console.Title += " - DEBUG IS NOT FALSE, AUTHOUR FORGET TO INCREMENT VERSION VARS"; + Application.ThreadException += Application_ThreadException; Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; @@ -250,25 +257,28 @@ namespace StardewModdingAPI DebugPixel = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1); DebugPixel.SetData(new Color[] { Color.White }); - LogColour(ConsoleColor.Magenta, "REGISTERING BASE CUSTOM ITEM"); - SObject so = new SObject(); - so.Name = "Mario Block"; - so.CategoryName = "SMAPI Test Mod"; - so.Description = "It's a block from Mario!\nLoaded in realtime by SMAPI."; - so.Texture = Texture2D.FromStream(Game1.graphics.GraphicsDevice, new FileStream(ModContentPaths[0] + "\\Test.png", FileMode.Open)); - so.IsPassable = true; - so.IsPlaceable = true; - LogColour(ConsoleColor.Cyan, "REGISTERED WITH ID OF: " + SGame.RegisterModItem(so)); - - LogColour(ConsoleColor.Magenta, "REGISTERING SECOND CUSTOM ITEM"); - SObject so2 = new SObject(); - so2.Name = "Mario Painting"; - so2.CategoryName = "SMAPI Test Mod"; - so2.Description = "It's a painting of a creature from Mario!\nLoaded in realtime by SMAPI."; - so2.Texture = Texture2D.FromStream(Game1.graphics.GraphicsDevice, new FileStream(ModContentPaths[0] + "\\PaintingTest.png", FileMode.Open)); - so2.IsPassable = true; - so2.IsPlaceable = true; - LogColour(ConsoleColor.Cyan, "REGISTERED WITH ID OF: " + SGame.RegisterModItem(so2)); + if (debug) + { + LogColour(ConsoleColor.Magenta, "REGISTERING BASE CUSTOM ITEM"); + SObject so = new SObject(); + so.Name = "Mario Block"; + so.CategoryName = "SMAPI Test Mod"; + so.Description = "It's a block from Mario!\nLoaded in realtime by SMAPI."; + so.Texture = Texture2D.FromStream(Game1.graphics.GraphicsDevice, new FileStream(ModContentPaths[0] + "\\Test.png", FileMode.Open)); + so.IsPassable = true; + so.IsPlaceable = true; + LogColour(ConsoleColor.Cyan, "REGISTERED WITH ID OF: " + SGame.RegisterModItem(so)); + + LogColour(ConsoleColor.Magenta, "REGISTERING SECOND CUSTOM ITEM"); + SObject so2 = new SObject(); + so2.Name = "Mario Painting"; + so2.CategoryName = "SMAPI Test Mod"; + so2.Description = "It's a painting of a creature from Mario!\nLoaded in realtime by SMAPI."; + so2.Texture = Texture2D.FromStream(Game1.graphics.GraphicsDevice, new FileStream(ModContentPaths[0] + "\\PaintingTest.png", FileMode.Open)); + so2.IsPassable = true; + so2.IsPlaceable = true; + LogColour(ConsoleColor.Cyan, "REGISTERED WITH ID OF: " + SGame.RegisterModItem(so2)); + } } static void Events_KeyPressed(Keys key) |