-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMPlayer.cs
67 lines (57 loc) · 1.47 KB
/
MPlayer.cs
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
66
67
using Terraria.ModLoader;
using Terraria;
using Terraria.DataStructures;
namespace ServerSideCharacter
{
public class MPlayer : ModPlayer
{
public int playerCounter = 0;
public bool Locked = false;
public bool GodMode = false;
public override void ResetEffects()
{
Locked = false;
}
public override void SetControls()
{
if (Locked)
{
player.controlJump = false;
player.controlDown = false;
player.controlLeft = false;
player.controlRight = false;
player.controlUp = false;
player.controlUseItem = false;
player.controlUseTile = false;
player.controlThrow = false;
player.controlHook = false;
player.controlMount = false;
//player.controlInv = false; // With this the users will not be abble to exit the server without login first (Exept by pressing ALT + F4). This is not a good thing
player.gravDir = 0f;
player.position = player.oldPosition;
}
}
public override bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
{
return !GodMode;
}
public override void PreUpdate()
{
if (GodMode)
{
player.statLife = player.statLifeMax2;
}
}
public override void OnEnterWorld(Player player)
{
if (Main.netMode == 1)
{
player.AddBuff(mod.BuffType("Locked"), 180);
}
}
public override void PostUpdate()
{
playerCounter++;
}
}
}