-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathWireModPlayer.cs
More file actions
44 lines (39 loc) · 1.02 KB
/
WireModPlayer.cs
File metadata and controls
44 lines (39 loc) · 1.02 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
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.IO;
using WireMod.Devices;
namespace WireMod
{
public class WireModPlayer : ModPlayer
{
public Device PlacingDevice;
public Pin ConnectingPin;
public Wire PlacingWire;
public bool ShowPreview;
public int ToolCategoryMode = 0;
public int ToolMode = 0;
public override void OnEnterWorld(Player p)
{
base.OnEnterWorld(p);
// Send sync request
if (Main.netMode == NetmodeID.MultiplayerClient)
{
WireMod.PacketHandler.SendRequest(256, Main.myPlayer);
}
}
public override TagCompound Save()
{
return new TagCompound
{
["menuPosX"] = WireMod.Instance.ElectronicsManualUI.Panel.Left.Pixels,
["menuPosY"] = WireMod.Instance.ElectronicsManualUI.Panel.Top.Pixels,
};
}
public override void Load(TagCompound tag)
{
WireMod.Instance.ElectronicsManualUI.Panel.Left.Set(tag.GetFloat("menuPosX"), 0f);
WireMod.Instance.ElectronicsManualUI.Panel.Top.Set(tag.GetFloat("menuPosY"), 0f);
}
}
}