-
Notifications
You must be signed in to change notification settings - Fork 1
/
BMPlayer.cs
65 lines (60 loc) · 1.43 KB
/
BMPlayer.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
using System;
using System.Linq;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
namespace BetterMultiplayer
{
public class BMPlayer : ModPlayer
{
public string teamChosen = GetInstance<BMConfig>().TeamToJoin;
public int team = 0;
public override void OnEnterWorld()
{
team = teamChosen switch
{
"None" => 0,
"Red" => 1,
"Green" => 2,
"Blue" => 3,
"Yellow" => 4,
"Pink" => 5,
_ => 0,
};
}
public override void CopyClientState(ModPlayer clientClone)
{
clientClone.Player.team = team;
}
public override void SendClientChanges(ModPlayer clientPlayer)
{
if (clientPlayer.Player.team != team)
{
Main.player[Main.myPlayer].team = team;
NetMessage.SendData(MessageID.PlayerTeam, -1, -1, null, Main.myPlayer);
}
}
public override void UpdateDead() //no boss fight respawn
{
if (BMConfig.Instance.NoBossFightRespawn)
{
if (Main.npc.Any(n => n.whoAmI < Main.maxNPCs && n.active && n.HasValidTarget && (n.boss || n.type == NPCID.EaterofWorldsHead || n.type == NPCID.EaterofWorldsBody || n.type == NPCID.EaterofWorldsTail)))
{
if (Main.getGoodWorld)
{
Player.respawnTimer = 3600;
}
else if (Main.expertMode)
{
Player.respawnTimer = 1800;
}
else
{
Player.respawnTimer = 1200;
}
}
}
}
}
}