forked from Hazardu/ChampionsOfForest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TrapTriggerMod.cs
133 lines (131 loc) · 4.38 KB
/
TrapTriggerMod.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
using UnityEngine;
namespace ChampionsOfForest
{
public class TrapTriggerMod : trapTrigger
{
public override void TriggerLargeTrap(Collider other)
{
if (this.MpClientCheck && other == null && this.largeNoose)
{
this.switchNooseRope();
base.Invoke("EnableCutTrigger", 1.5f);
this.animator.enabled = true;
this.animator.SetIntegerReflected("direction", 0);
this.animator.SetBoolReflected("trapSpringBool", true);
}
else if (this.MpHostCheck && this.largeNoose)
{
this.SprungTrap();
}
if (this.sprung)
{
return;
}
this.CheckAnimReference();
bool flag = !BoltNetwork.isRunning || this.MpHostCheck;
if (this.hitbox && !this.hitbox.activeSelf)
{
this.hitbox.SetActive(true);
}
if (this.largeSwingingRock)
{
this.cutRope.SetActive(false);
this.swingingRock.SendMessage("enableSwingingRock", false);
base.Invoke("enableTrapReset", 3f);
}
if (this.largeDeadfall)
{
this.anim.GetComponent<Animation>().Play("trapFall");
this.spikeTrapBlockerGo.SetActive(true);
base.Invoke("enableTrapReset", 3f);
}
if (this.largeSpike)
{
this.anim.GetComponent<Animation>().Play("trapSpring");
this.spikeTrapBlockerGo.SetActive(true);
if (flag && other)
{
other.gameObject.SendMessageUpwards("enableController", SendMessageOptions.DontRequireReceiver);
if (other.gameObject.CompareTag("enemyCollide"))
{
this.mutantSetup = other.transform.root.GetComponentInChildren<mutantScriptSetup>();
if (this.mutantSetup && !this.mutantSetup.ai.creepy && !this.mutantSetup.ai.creepy_male && !this.mutantSetup.ai.creepy_fat && !this.mutantSetup.ai.creepy_baby)
{
other.gameObject.SendMessageUpwards("setCurrentTrap", base.gameObject, SendMessageOptions.DontRequireReceiver);
}
}
}
base.Invoke("enableTrapReset", 3f);
}
if (this.largeNoose)
{
if (flag && other)
{
if (other.gameObject.GetComponentInParent<EnemyProgression>()?.abilities.Count > 0)
return;//noose traps are too strong against elites
//so they no longer work on them
mutantHitReceiver component = other.transform.GetComponent<mutantHitReceiver>();
if (other.gameObject.CompareTag("enemyCollide"))
{
if (component)
{
component.inNooseTrap = true;
component.DisableWeaponHits(2f);
}
this.mutantSetup = other.transform.root.GetComponentInChildren<mutantScriptSetup>();
}
this.trappedMutants.Clear();
this.trappedMutantMasks.Clear();
GameObject gameObject = other.transform.root.gameObject;
this.addTrappedMutant(gameObject);
mutantScriptSetup componentInChildren = other.transform.root.GetComponentInChildren<mutantScriptSetup>();
if (componentInChildren && componentInChildren.ai && componentInChildren.ai.pale)
{
this.FixPalePosition(componentInChildren, true);
}
if (base.transform.InverseTransformPoint(other.transform.position).x > 0f)
{
this.animator.SetIntegerReflected("direction", 0);
}
else
{
this.animator.SetIntegerReflected("direction", 1);
}
other.gameObject.SendMessageUpwards("setFootPivot", this.nooseFootPivot, SendMessageOptions.DontRequireReceiver);
this.animator.enabled = true;
this.animator.SetBoolReflected("trapSpringBool", true);
if (this.mutantSetup)
{
if (!this.mutantSetup.ai.creepy && !this.mutantSetup.ai.creepy_male && !this.mutantSetup.ai.creepy_fat && !this.mutantSetup.ai.creepy_baby)
{
other.gameObject.SendMessageUpwards("setInNooseTrap", this.noosePivot);
}
other.gameObject.SendMessageUpwards("setCurrentTrap", base.gameObject);
}
}
if (other)
{
other.gameObject.SendMessageUpwards("DieTrap", 2, SendMessageOptions.DontRequireReceiver);
}
this.switchNooseRope();
base.Invoke("EnableCutTrigger", 1.5f);
if (base.entity.IsOwner() && this.largeNoose)
{
base.entity.GetState<ITrapLargeState>().CanCutDown = true;
base.entity.GetState<ITrapLargeState>().CanReset = false;
}
if (other && (other.gameObject.CompareTag("Player") || other.gameObject.CompareTag("PlayerNet")))
{
base.Invoke("enableTrapReset", 2f);
}
}
if (this.hitbox)
{
base.Invoke("disableHitbox", 1.5f);
}
base.transform.GetComponent<Collider>().enabled = false;
this.SprungTag = true;
this.PlayTriggerSFX();
}
}
}