forked from E-riCA0/StawdewValley
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLevelBuilder.cs
More file actions
65 lines (58 loc) · 2.5 KB
/
LevelBuilder.cs
File metadata and controls
65 lines (58 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Decompiled with JetBrains decompiler
// Type: StardewValley.LevelBuilder
// Assembly: Stardew Valley, Version=1.2.6400.27469, Culture=neutral, PublicKeyToken=null
// MVID: 77B7094A-F6F0-4ACC-91F4-E335E2733EDB
// Assembly location: D:\SteamLibrary\steamapps\common\Stardew Valley\Stardew Valley.exe
using Microsoft.Xna.Framework;
using StardewValley.Monsters;
using xTile.Dimensions;
namespace StardewValley
{
public class LevelBuilder
{
public static bool tryToAddObject(int index, bool bigCraftable, Vector2 position)
{
if (Game1.mine.isTileOccupiedForPlacement(position, (Object) null))
return false;
if (bigCraftable)
Game1.mine.objects.Add(position, new Object(position, index, false));
else
Game1.mine.Objects.Add(position, new Object(position, index, (string) null, false, false, false, false));
return true;
}
public static bool tryToAddMonster(Monster m, Vector2 position)
{
if (Game1.mine.isTileOccupiedForPlacement(position, (Object) null) || !Game1.mine.isTileLocationOpen(new Location((int) position.X, (int) position.Y)) || (!Game1.mine.isTileOnMap(position) || !Game1.mine.isTileOnClearAndSolidGround(position)))
return false;
m.position = new Vector2(position.X * (float) Game1.tileSize, position.Y * (float) Game1.tileSize - (float) (m.sprite.spriteHeight - Game1.tileSize));
Game1.mine.characters.Add((NPC) m);
return true;
}
public static bool tryToAddFence(int which, Vector2 position, bool gate)
{
if (!Game1.mine.isTileOccupiedForPlacement(position, (Object) null))
Game1.mine.objects.Add(position, (Object) new Fence(position, which, gate));
return false;
}
public static bool addTorch(Vector2 position)
{
if (Game1.mine.isTileOccupiedForPlacement(position, (Object) null))
return false;
Game1.mine.Objects.Add(position, (Object) new Torch(position, 1));
return true;
}
public static bool tryToAddObject(Object obj, Vector2 position)
{
if (Game1.mine.isTileOccupiedForPlacement(position, (Object) null))
return false;
Game1.mine.Objects.Add(position, obj);
return true;
}
public static bool tryToAddObject(int index, bool bigCraftable, Vector2 position, int heldItem)
{
if (LevelBuilder.tryToAddObject(index, bigCraftable, position))
Game1.mine.objects[position].heldObject = new Object(position, heldItem, (string) null, false, false, false, false);
return false;
}
}
}