summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI
diff options
context:
space:
mode:
Diffstat (limited to 'src/StardewModdingAPI')
-rw-r--r--src/StardewModdingAPI/Entities/SCharacter.cs6
-rw-r--r--src/StardewModdingAPI/Entities/SFarm.cs6
-rw-r--r--src/StardewModdingAPI/Entities/SFarmAnimal.cs6
-rw-r--r--src/StardewModdingAPI/Entities/SNpc.cs6
-rw-r--r--src/StardewModdingAPI/Extensions.cs23
-rw-r--r--src/StardewModdingAPI/Inheritance/Minigames/SMinigameBase.cs34
-rw-r--r--src/StardewModdingAPI/Inheritance/SGame.cs52
-rw-r--r--src/StardewModdingAPI/Inheritance/SObject.cs277
-rw-r--r--src/StardewModdingAPI/Logger.cs1
-rw-r--r--src/StardewModdingAPI/ModItem.cs15
-rw-r--r--src/StardewModdingAPI/Program.cs1
-rw-r--r--src/StardewModdingAPI/StardewModdingAPI.csproj7
12 files changed, 0 insertions, 434 deletions
diff --git a/src/StardewModdingAPI/Entities/SCharacter.cs b/src/StardewModdingAPI/Entities/SCharacter.cs
deleted file mode 100644
index 2d941d55..00000000
--- a/src/StardewModdingAPI/Entities/SCharacter.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace StardewModdingAPI.Entities
-{
- internal class SCharacter
- {
- }
-} \ No newline at end of file
diff --git a/src/StardewModdingAPI/Entities/SFarm.cs b/src/StardewModdingAPI/Entities/SFarm.cs
deleted file mode 100644
index c6c64681..00000000
--- a/src/StardewModdingAPI/Entities/SFarm.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace StardewModdingAPI.Entities
-{
- internal class SFarm
- {
- }
-} \ No newline at end of file
diff --git a/src/StardewModdingAPI/Entities/SFarmAnimal.cs b/src/StardewModdingAPI/Entities/SFarmAnimal.cs
deleted file mode 100644
index fb8ee267..00000000
--- a/src/StardewModdingAPI/Entities/SFarmAnimal.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace StardewModdingAPI.Entities
-{
- internal class SFarmAnimal
- {
- }
-} \ No newline at end of file
diff --git a/src/StardewModdingAPI/Entities/SNpc.cs b/src/StardewModdingAPI/Entities/SNpc.cs
deleted file mode 100644
index 727dcff7..00000000
--- a/src/StardewModdingAPI/Entities/SNpc.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace StardewModdingAPI.Entities
-{
- internal class SNpc
- {
- }
-} \ No newline at end of file
diff --git a/src/StardewModdingAPI/Extensions.cs b/src/StardewModdingAPI/Extensions.cs
index 391e2c8c..5726e882 100644
--- a/src/StardewModdingAPI/Extensions.cs
+++ b/src/StardewModdingAPI/Extensions.cs
@@ -39,11 +39,6 @@ namespace StardewModdingAPI
return string.Join(split, ienum);
}
- /*public static string ToSingular<T>(this IEnumerable<T> ienum, string split = ", ")
- {
- return string.Join(split, ienum);
- }*/
-
public static bool IsInt32(this object o)
{
int i;
@@ -101,24 +96,6 @@ namespace StardewModdingAPI
t.GetBaseFieldInfo(name).SetValue(o, newValue as T);
}
- /*
- public static T GetBaseFieldValue<T>(this object o, string name) where T : class
- {
- return o.GetType().GetBaseFieldInfo(name).GetValue(o) as T;
- }*/
-
- /*
- public static object GetBaseFieldValue(this object o, string name)
- {
- return o.GetType().GetBaseFieldInfo(name).GetValue(o);
- }
-
- public static void SetBaseFieldValue (this object o, string name, object newValue)
- {
- o.GetType().GetBaseFieldInfo(name).SetValue(o, newValue);
- }
- */
-
public static string RemoveNumerics(this string st)
{
var s = st;
diff --git a/src/StardewModdingAPI/Inheritance/Minigames/SMinigameBase.cs b/src/StardewModdingAPI/Inheritance/Minigames/SMinigameBase.cs
deleted file mode 100644
index f30021de..00000000
--- a/src/StardewModdingAPI/Inheritance/Minigames/SMinigameBase.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework.Input;
-using StardewValley.Minigames;
-
-namespace StardewModdingAPI.Inheritance.Minigames
-{
- internal abstract class SMinigameBase : IMinigame
- {
- public abstract bool tick(GameTime time);
-
- public abstract void receiveLeftClick(int x, int y, bool playSound = true);
-
- public abstract void leftClickHeld(int x, int y);
-
- public abstract void receiveRightClick(int x, int y, bool playSound = true);
-
- public abstract void releaseLeftClick(int x, int y);
-
- public abstract void releaseRightClick(int x, int y);
-
- public abstract void receiveKeyPress(Keys k);
-
- public abstract void receiveKeyRelease(Keys k);
-
- public abstract void draw(SpriteBatch b);
-
- public abstract void changeScreenSize();
-
- public abstract void unload();
-
- public abstract void receiveEventPoke(int data);
- }
-} \ No newline at end of file
diff --git a/src/StardewModdingAPI/Inheritance/SGame.cs b/src/StardewModdingAPI/Inheritance/SGame.cs
index b4f85db4..c595fae3 100644
--- a/src/StardewModdingAPI/Inheritance/SGame.cs
+++ b/src/StardewModdingAPI/Inheritance/SGame.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
-using System.Runtime.CompilerServices;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
@@ -23,11 +22,6 @@ namespace StardewModdingAPI.Inheritance
/// </summary>
public class SGame : Game1
{
- /// <summary>
- /// Useless right now.
- /// </summary>
- public const int LowestModItemID = 1000;
-
private bool FireLoadedGameEvent;
/// <summary>
@@ -42,13 +36,6 @@ namespace StardewModdingAPI.Inheritance
}
/// <summary>
- /// Useless at this time.
- /// </summary>
- [Obsolete]
- // ReSharper disable once UnusedAutoPropertyAccessor.Local
- public static Dictionary<int, SObject> ModItems { get; private set; }
-
- /// <summary>
/// The current KeyboardState
/// </summary>
public KeyboardState KStateNow { get; private set; }
@@ -1411,45 +1398,6 @@ namespace StardewModdingAPI.Inheritance
}
}
- [Obsolete("Do not use at this time.")]
- // ReSharper disable once UnusedMember.Local
- private static int RegisterModItem(SObject modItem)
- {
- if (modItem.HasBeenRegistered)
- {
- Log.AsyncR($"The item {modItem.Name} has already been registered with ID {modItem.RegisteredId}");
- return modItem.RegisteredId;
- }
- var newId = LowestModItemID;
- if (ModItems.Count > 0)
- newId = Math.Max(LowestModItemID, ModItems.OrderBy(x => x.Key).First().Key + 1);
- ModItems.Add(newId, modItem);
- modItem.HasBeenRegistered = true;
- modItem.RegisteredId = newId;
- return newId;
- }
-
- [Obsolete("Do not use at this time.")]
- // ReSharper disable once UnusedMember.Local
- private static SObject PullModItemFromDict(int id, bool isIndex)
- {
- if (isIndex)
- {
- if (ModItems.ElementAtOrDefault(id).Value != null)
- {
- return ModItems.ElementAt(id).Value.Clone();
- }
- Log.AsyncR("ModItem Dictionary does not contain index: " + id);
- return null;
- }
- if (ModItems.ContainsKey(id))
- {
- return ModItems[id].Clone();
- }
- Log.AsyncR("ModItem Dictionary does not contain ID: " + id);
- return null;
- }
-
private void UpdateEventCalls()
{
KStateNow = Keyboard.GetState();
diff --git a/src/StardewModdingAPI/Inheritance/SObject.cs b/src/StardewModdingAPI/Inheritance/SObject.cs
deleted file mode 100644
index 639b85b1..00000000
--- a/src/StardewModdingAPI/Inheritance/SObject.cs
+++ /dev/null
@@ -1,277 +0,0 @@
-using System;
-using System.Xml.Serialization;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-using StardewValley;
-using Object = StardewValley.Object;
-
-#pragma warning disable 1591
-
-namespace StardewModdingAPI.Inheritance
-{
- [Obsolete("Do not use at this time.")]
- public class SObject : Object
- {
- public SObject()
- {
- name = "Modded Item Name";
- Description = "Modded Item Description";
- CategoryName = "Modded Item Category";
- Category = 4163;
- CategoryColour = Color.White;
- IsPassable = false;
- IsPlaceable = false;
- boundingBox = new Rectangle(0, 0, 64, 64);
- MaxStackSize = 999;
-
- type = "interactive";
- }
-
- public override string Name
- {
- get { return name; }
- set { name = value; }
- }
-
- public string Description { get; set; }
- public Texture2D Texture { get; set; }
- public string CategoryName { get; set; }
- public Color CategoryColour { get; set; }
- public bool IsPassable { get; set; }
- public bool IsPlaceable { get; set; }
- public bool HasBeenRegistered { get; set; }
- public int RegisteredId { get; set; }
-
- public int MaxStackSize { get; set; }
-
- public bool WallMounted { get; set; }
- public Vector2 DrawPosition { get; set; }
-
- public bool FlaggedForPickup { get; set; }
-
- [XmlIgnore]
- public Vector2 CurrentMouse { get; protected set; }
-
- [XmlIgnore]
- public Vector2 PlacedAt { get; protected set; }
-
- public override int Stack
- {
- get { return stack; }
- set { stack = value; }
- }
-
- public override string getDescription()
- {
- return Description;
- }
-
- public override void draw(SpriteBatch spriteBatch, int x, int y, float alpha = 1)
- {
- if (Texture != null)
- {
- spriteBatch.Draw(Texture, Game1.GlobalToLocal(Game1.viewport, new Vector2(x * Game1.tileSize + Game1.tileSize / 2 + (shakeTimer > 0 ? Game1.random.Next(-1, 2) : 0), y * Game1.tileSize + Game1.tileSize / 2 + (shakeTimer > 0 ? Game1.random.Next(-1, 2) : 0))), Game1.currentLocation.getSourceRectForObject(ParentSheetIndex), Color.White * alpha, 0f, new Vector2(8f, 8f), scale.Y > 1f ? getScale().Y : Game1.pixelZoom, flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (isPassable() ? getBoundingBox(new Vector2(x, y)).Top : getBoundingBox(new Vector2(x, y)).Bottom) / 10000f);
- }
- }
-
- public new void drawAsProp(SpriteBatch b)
- {
- }
-
- public override void draw(SpriteBatch spriteBatch, int xNonTile, int yNonTile, float layerDepth, float alpha = 1)
- {
- Log.Debug("THIS DRAW FUNCTION IS NOT IMPLEMENTED I WANT TO KNOW WHERE IT IS CALLED");
- //try
- //{
- // if (Texture != null)
- // {
- // int targSize = Game1.tileSize;
- // int midX = (xNonTile) + 32;
- // int midY = (yNonTile) + 32;
-
- // int targX = midX - targSize / 2;
- // int targY = midY - targSize / 2;
-
- // Rectangle targ = new Rectangle(targX, targY, targSize, targSize);
- // spriteBatch.Draw(Texture, targ, null, new Color(255, 255, 255, 255f * alpha), 0, Vector2.Zero, SpriteEffects.None, layerDepth);
- // //spriteBatch.Draw(Program.DebugPixel, targ, null, Color.Red, 0, Vector2.Zero, SpriteEffects.None, layerDepth);
- // /*
- // spriteBatch.DrawString(Game1.dialogueFont, "TARG: " + targ, new Vector2(128, 0), Color.Red);
- // spriteBatch.DrawString(Game1.dialogueFont, ".", new Vector2(targX * 0.5f, targY), Color.Orange);
- // spriteBatch.DrawString(Game1.dialogueFont, ".", new Vector2(targX, targY), Color.Red);
- // spriteBatch.DrawString(Game1.dialogueFont, ".", new Vector2(targX * 1.5f, targY), Color.Yellow);
- // spriteBatch.DrawString(Game1.dialogueFont, ".", new Vector2(targX * 2f, targY), Color.Green);
- // */
- // }
- //}
- //catch (Exception ex)
- //{
- // Log.AsyncR(ex.ToString());
- // Console.ReadKey();
- //}
- }
-
- public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, bool drawStackNumber)
- {
- if (isRecipe)
- {
- transparency = 0.5f;
- scaleSize *= 0.75f;
- }
-
- if (Texture != null)
- {
- var targSize = (int) (64 * scaleSize * 0.9f);
- var midX = (int) (location.X + 32);
- var midY = (int) (location.Y + 32);
-
- var targX = midX - targSize / 2;
- var targY = midY - targSize / 2;
-
- spriteBatch.Draw(Texture, new Rectangle(targX, targY, targSize, targSize), null, new Color(255, 255, 255, transparency), 0, Vector2.Zero, SpriteEffects.None, layerDepth);
- }
- if (drawStackNumber)
- {
- var _scale = 0.5f + scaleSize;
- Game1.drawWithBorder(stack.ToString(), Color.Black, Color.White, location + new Vector2(Game1.tileSize - Game1.tinyFont.MeasureString(string.Concat(stack.ToString())).X * _scale, Game1.tileSize - (float) ((double) Game1.tinyFont.MeasureString(string.Concat(stack.ToString())).Y * 3.0f / 4.0f) * _scale), 0.0f, _scale, 1f, true);
- }
- }
-
- public override void drawWhenHeld(SpriteBatch spriteBatch, Vector2 objectPosition, Farmer f)
- {
- if (Texture != null)
- {
- var targSize = 64;
- var midX = (int) (objectPosition.X + 32);
- var midY = (int) (objectPosition.Y + 32);
-
- var targX = midX - targSize / 2;
- var targY = midY - targSize / 2;
-
- spriteBatch.Draw(Texture, new Rectangle(targX, targY, targSize, targSize), null, Color.White, 0, Vector2.Zero, SpriteEffects.None, (f.getStandingY() + 2) / 10000f);
- }
- }
-
- public override Color getCategoryColor()
- {
- return CategoryColour;
- }
-
- public override string getCategoryName()
- {
- if (string.IsNullOrEmpty(CategoryName))
- return "Modded Item";
- return CategoryName;
- }
-
- public override bool isPassable()
- {
- return IsPassable;
- }
-
- public override bool isPlaceable()
- {
- return IsPlaceable;
- }
-
- public override int maximumStackSize()
- {
- return MaxStackSize;
- }
-
- public SObject Clone()
- {
- var toRet = new SObject
- {
- Name = Name,
- CategoryName = CategoryName,
- Description = Description,
- Texture = Texture,
- IsPassable = IsPassable,
- IsPlaceable = IsPlaceable,
- quality = quality,
- scale = scale,
- isSpawnedObject = isSpawnedObject,
- isRecipe = isRecipe,
- questItem = questItem,
- stack = 1,
- HasBeenRegistered = HasBeenRegistered,
- RegisteredId = RegisteredId
- };
-
-
- return toRet;
- }
-
- public override Item getOne()
- {
- return Clone();
- }
-
- public override void actionWhenBeingHeld(Farmer who)
- {
- var x = Game1.oldMouseState.X + Game1.viewport.X;
- var y = Game1.oldMouseState.Y + Game1.viewport.Y;
-
- x = x / Game1.tileSize;
- y = y / Game1.tileSize;
-
- CurrentMouse = new Vector2(x, y);
- //Program.LogDebug(canBePlacedHere(Game1.currentLocation, CurrentMouse));
- base.actionWhenBeingHeld(who);
- }
-
- public override bool canBePlacedHere(GameLocation l, Vector2 tile)
- {
- //Program.LogDebug(CurrentMouse.ToString().Replace("{", "").Replace("}", ""));
- if (!l.objects.ContainsKey(tile))
- return true;
-
- return false;
- }
-
- public override bool placementAction(GameLocation location, int x, int y, Farmer who = null)
- {
- if (Game1.didPlayerJustRightClick())
- return false;
-
- x = x / Game1.tileSize;
- y = y / Game1.tileSize;
-
- //Program.LogDebug(x + " - " + y);
- //Console.ReadKey();
-
- var key = new Vector2(x, y);
-
- if (!canBePlacedHere(location, key))
- return false;
-
- var s = Clone();
-
- s.PlacedAt = key;
- s.boundingBox = new Rectangle(x / Game1.tileSize * Game1.tileSize, y / Game1.tileSize * Game1.tileSize, boundingBox.Width, boundingBox.Height);
-
- location.objects.Add(key, s);
- Log.Async($"{GetHashCode()} - {s.GetHashCode()}");
-
- return true;
- }
-
- public override void actionOnPlayerEntry()
- {
- //base.actionOnPlayerEntry();
- }
-
- public override void drawPlacementBounds(SpriteBatch spriteBatch, GameLocation location)
- {
- if (canBePlacedHere(location, CurrentMouse))
- {
- var targSize = Game1.tileSize;
-
- var x = Game1.oldMouseState.X + Game1.viewport.X;
- var y = Game1.oldMouseState.Y + Game1.viewport.Y;
- spriteBatch.Draw(Game1.mouseCursors, new Vector2(x / Game1.tileSize * Game1.tileSize - Game1.viewport.X, y / Game1.tileSize * Game1.tileSize - Game1.viewport.Y), new Rectangle(Utility.playerCanPlaceItemHere(location, this, x, y, Game1.player) ? 194 : 210, 388, 16, 16), Color.White, 0.0f, Vector2.Zero, Game1.pixelZoom, SpriteEffects.None, 0.01f);
- }
- }
- }
-} \ No newline at end of file
diff --git a/src/StardewModdingAPI/Logger.cs b/src/StardewModdingAPI/Logger.cs
index 32da124f..5fda6568 100644
--- a/src/StardewModdingAPI/Logger.cs
+++ b/src/StardewModdingAPI/Logger.cs
@@ -207,7 +207,6 @@ namespace StardewModdingAPI
{
private static LogWriter _instance;
private static ConcurrentQueue<LogInfo> _logQueue;
- private static DateTime _lastFlushTime = DateTime.Now;
private static StreamWriter _stream;
/// <summary>
diff --git a/src/StardewModdingAPI/ModItem.cs b/src/StardewModdingAPI/ModItem.cs
deleted file mode 100644
index cf2e10b2..00000000
--- a/src/StardewModdingAPI/ModItem.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using Microsoft.Xna.Framework.Graphics;
-using StardewValley;
-
-namespace StardewModdingAPI
-{
- internal class ModItem : Object
- {
- public Item AsItem => this;
-
- public override string Name { get; set; }
- public string Description { get; set; }
- public int ID { get; set; }
- public Texture2D Texture { get; set; }
- }
-} \ No newline at end of file
diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs
index de097cc0..0099b045 100644
--- a/src/StardewModdingAPI/Program.cs
+++ b/src/StardewModdingAPI/Program.cs
@@ -34,7 +34,6 @@ namespace StardewModdingAPI
public static Thread gameThread;
public static Thread consoleInputThread;
- //private static List<string> _modContentPaths;
public static Texture2D DebugPixel { get; private set; }
diff --git a/src/StardewModdingAPI/StardewModdingAPI.csproj b/src/StardewModdingAPI/StardewModdingAPI.csproj
index aa4323ce..cd2c2a6d 100644
--- a/src/StardewModdingAPI/StardewModdingAPI.csproj
+++ b/src/StardewModdingAPI/StardewModdingAPI.csproj
@@ -162,10 +162,6 @@
<Compile Include="Command.cs" />
<Compile Include="Config.cs" />
<Compile Include="Constants.cs" />
- <Compile Include="Entities\SCharacter.cs" />
- <Compile Include="Entities\SFarm.cs" />
- <Compile Include="Entities\SFarmAnimal.cs" />
- <Compile Include="Entities\SNpc.cs" />
<Compile Include="Entities\SPlayer.cs" />
<Compile Include="Events\Controls.cs" />
<Compile Include="Events\EventArgs.cs" />
@@ -181,14 +177,11 @@
<Compile Include="Inheritance\Menus\SBobberBar.cs" />
<Compile Include="Inheritance\Menus\SGameMenu.cs" />
<Compile Include="Inheritance\Menus\SInventoryPage.cs" />
- <Compile Include="Inheritance\Minigames\SMinigameBase.cs" />
<Compile Include="Inheritance\SBareObject.cs" />
- <Compile Include="Inheritance\SObject.cs" />
<Compile Include="JsonResolver.cs" />
<Compile Include="Logger.cs" />
<Compile Include="Manifest.cs" />
<Compile Include="Mod.cs" />
- <Compile Include="ModItem.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Inheritance\SGame.cs" />