Line 22: |
Line 22: |
| | | |
| To do so, in most situations, just call .removeItemFromInventory(Item) | | To do so, in most situations, just call .removeItemFromInventory(Item) |
| + | |
| + | ===Spawn an item on the ground=== |
| + | |
| + | <source lang='c#'> |
| + | public virtual bool dropObject(Object obj, Vector2 dropLocation, xTile.Dimensions.Rectangle viewport, bool initialPlacement, Farmer who = null); |
| + | |
| + | // Concrete code for spawning: |
| + | Game1.getLocationFromName("Farm").dropObject(new StardewValley.Object(itemId, 1, false, -1, 0), new Vector2(x, y) * 64f, Game1.viewport, true, (Farmer)null); |
| + | </source> |
| + | |
| + | |
| + | All constructors for Object: |
| + | |
| + | <source lang='c#'> |
| + | public Object(Vector2 tileLocation, int parentSheetIndex, int initialStack); |
| + | public Object(Vector2 tileLocation, int parentSheetIndex, bool isRecipe = false); |
| + | public Object(int parentSheetIndex, int initialStack, bool isRecipe = false, int price = -1, int quality = 0); |
| + | public Object(Vector2 tileLocation, int parentSheetIndex, string Givenname, bool canBeSetDown, bool canBeGrabbed, bool isHoedirt, bool isSpawnedObject); |
| + | </source> |
| + | |
| + | Where '''parentSheetIndex''' is the ID of the item (can be found in ObjectInformation.xnb). |
| | | |
| ==Locations== | | ==Locations== |