|
| 1 | +require("Actors/Infantry/BrowncoatBoss/BrowncoatBossFunctions"); |
1 | 2 | dofile("Base.rte/Constants.lua")
|
2 | 3 |
|
3 |
| -BrowncoatBossFunctions = {}; |
4 |
| - |
5 |
| -function BrowncoatBossFunctions.createVoiceSoundEffect(self, soundContainer, priority, canOverridePriority) |
6 |
| - if canOverridePriority == nil then |
7 |
| - canOverridePriority = false; |
8 |
| - end |
9 |
| - local usingPriority |
10 |
| - if canOverridePriority == false then |
11 |
| - usingPriority = priority - 1; |
12 |
| - else |
13 |
| - usingPriority = priority; |
14 |
| - end |
15 |
| - if self.Head and soundContainer ~= nil then |
16 |
| - if self.voiceSound then |
17 |
| - if self.voiceSound:IsBeingPlayed() then |
18 |
| - if self.lastPriority <= usingPriority then |
19 |
| - self.voiceSound:Stop(); |
20 |
| - self.voiceSound = soundContainer; |
21 |
| - soundContainer:Play(self.Pos) |
22 |
| - self.lastPriority = priority; |
23 |
| - return true; |
24 |
| - end |
25 |
| - else |
26 |
| - self.voiceSound = soundContainer; |
27 |
| - soundContainer:Play(self.Pos) |
28 |
| - self.lastPriority = priority; |
29 |
| - return true; |
30 |
| - end |
31 |
| - else |
32 |
| - self.voiceSound = soundContainer; |
33 |
| - soundContainer:Play(self.Pos) |
34 |
| - self.lastPriority = priority; |
35 |
| - return true; |
36 |
| - end |
37 |
| - end |
38 |
| -end |
39 |
| - |
40 |
| -function BrowncoatBossFunctions.updateHealth(self) |
41 |
| - |
42 |
| - local healthTimerReady = self.healthUpdateTimer:IsPastSimMS(750); |
43 |
| - local wasInjured = self.Health < (self.oldHealth - self.PainThreshold) or self.Health <= 0; |
44 |
| - |
45 |
| - if (healthTimerReady or wasInjured) and not self.deathScripted then |
46 |
| - |
47 |
| - self.oldHealth = self.Health; |
48 |
| - self.healthUpdateTimer:Reset(); |
49 |
| - if self.Health <= 0 then |
50 |
| - if not self.bossMode then |
51 |
| - BrowncoatBossFunctions.createVoiceSoundEffect(self, self.voiceSounds.Death, 11, true); |
52 |
| - else |
53 |
| - |
54 |
| - self.deathScripted = true; |
55 |
| - self.deathScriptedTimer:Reset(); |
56 |
| - CameraMan:AddScreenShake(6, self.Pos); |
57 |
| - BrowncoatBossFunctions.createVoiceSoundEffect(self, self.voiceSounds.DeathScripted, 11, true); |
58 |
| - |
59 |
| - local woundTable = {}; |
60 |
| - for wound in self:GetWounds() do |
61 |
| - table.insert(woundTable, wound); |
62 |
| - end |
63 |
| - |
64 |
| - print(#woundTable) |
65 |
| - |
66 |
| - if #woundTable > 0 then |
67 |
| - local fatalWoundedPart = woundTable[#woundTable]:GetParent(); |
68 |
| - print(woundTable[#woundTable]); |
69 |
| - print(fatalWoundedPart); |
70 |
| - |
71 |
| - if fatalWoundedPart.UniqueID ~= self.Head.UniqueID and fatalWoundedPart.UniqueID ~= self.UniqueID then |
72 |
| - fatalWoundedPart.MissionCritical = false; |
73 |
| - fatalWoundedPart.BreakWound = CreateAEmitter("Browncoat Boss Scripted Death Break Wound", "Browncoats.rte"); |
74 |
| - fatalWoundedPart.ParentBreakWound = CreateAEmitter("Browncoat Boss Scripted Death Break Wound", "Browncoats.rte"); |
75 |
| - ToAttachable(fatalWoundedPart):RemoveFromParent(true, true); |
76 |
| - elseif fatalWoundedPart.UniqueID == self.Head.UniqueID then |
77 |
| - self.Head.Frame = 1; |
78 |
| - else -- it's the torso |
79 |
| - --self.Frame = 1; |
80 |
| - end |
81 |
| - |
82 |
| - end |
83 |
| - |
84 |
| - end |
85 |
| - elseif wasInjured then |
86 |
| - BrowncoatBossFunctions.createVoiceSoundEffect(self, self.voiceSounds.Pain, 2, true); |
87 |
| - end |
88 |
| - |
89 |
| - end |
90 |
| - |
91 |
| -end |
92 |
| - |
93 |
| -function BrowncoatBossFunctions.abilityShockwaveLanding(self) |
94 |
| - |
95 |
| - self.Jetpack.NegativeThrottleMultiplier = self.jumpPackDefaultNegativeMult; |
96 |
| - self.Jetpack.PositiveThrottleMultiplier = self.jumpPackDefaultPositiveMult; |
97 |
| - |
98 |
| - CameraMan:AddScreenShake(self.abilityShockwaveScreenShakeAmount, self.Pos); |
99 |
| - |
100 |
| - -- Breakable Ground Smoke |
101 |
| - for i = 1, 15 do |
102 |
| - local effect = CreateMOSRotating("Breakable Smoke Ball Tiny", "Base.rte") |
103 |
| - effect.Pos = self.Pos; |
104 |
| - effect.Vel = self.Vel + Vector(math.random(-50, 50),math.random(90,150)) |
105 |
| - effect.Lifetime = effect.Lifetime * RangeRand(0.5,2.0) |
106 |
| - effect.AirResistance = effect.AirResistance * RangeRand(0.5,0.8) |
107 |
| - MovableMan:AddParticle(effect) |
108 |
| - end |
109 |
| - |
110 |
| - for i = 1, 10 do |
111 |
| - local effect = CreateMOSRotating("Breakable Smoke Ball", "Base.rte") |
112 |
| - effect.Pos = self.Pos; |
113 |
| - effect.Vel = self.Vel + Vector(math.random(-50, 50),math.random(90,150)) |
114 |
| - effect.Lifetime = effect.Lifetime * RangeRand(0.5,2.0) |
115 |
| - effect.AirResistance = effect.AirResistance * RangeRand(0.5,0.8) |
116 |
| - MovableMan:AddParticle(effect) |
117 |
| - end |
118 |
| - |
119 |
| - -- Funkier Ground Smoke |
120 |
| - |
121 |
| - local groundPos = SceneMan:MovePointToGround(self.Pos, 1, 1); |
122 |
| - |
123 |
| - for i = 1, 25 do |
124 |
| - local effect = CreateMOSParticle("Smoke Ball 1", "Base.rte") |
125 |
| - effect.Pos = groundPos; |
126 |
| - effect.Vel = self.Vel + Vector(math.random(-50, 50),math.random(-20,-30)) |
127 |
| - effect.Lifetime = effect.Lifetime * RangeRand(0.5,2.0) |
128 |
| - effect.AirResistance = effect.AirResistance * RangeRand(0.5,0.8) |
129 |
| - MovableMan:AddParticle(effect) |
130 |
| - end |
131 |
| - |
132 |
| - for i = 1, 25 do |
133 |
| - local effect = CreateMOSParticle("Tiny Smoke Ball 1", "Base.rte") |
134 |
| - effect.Pos = groundPos; |
135 |
| - effect.Vel = self.Vel + Vector(math.random(-50, 50),math.random(-20,-30)) |
136 |
| - effect.Lifetime = effect.Lifetime * RangeRand(0.5,2.0) |
137 |
| - effect.AirResistance = effect.AirResistance * RangeRand(0.5,0.8) |
138 |
| - MovableMan:AddParticle(effect) |
139 |
| - end |
140 |
| - |
141 |
| - |
142 |
| - for mo in MovableMan:GetMOsInRadius(self.Pos, self.abilityShockwaveRange, -1, true) do |
143 |
| - if mo.Team ~= self.Team and mo.PinStrength == 0 and IsMOSRotating(mo) then |
144 |
| - local dist = SceneMan:ShortestDistance(self.Pos, mo.Pos, SceneMan.SceneWrapsX); |
145 |
| - local strSumCheck = SceneMan:CastStrengthSumRay(self.Pos, self.Pos + dist, 3, rte.airID); |
146 |
| - if strSumCheck < self.abilityShockwaveStrength then |
147 |
| - local massFactor = math.sqrt(1 + math.abs(mo.Mass)); |
148 |
| - local distFactor = 1 + dist.Magnitude * 0.1; |
149 |
| - local forceVector = dist:SetMagnitude((self.abilityShockwaveStrength - strSumCheck)/distFactor); |
150 |
| - if IsAttachable(mo) then |
151 |
| - --Diminish transferred impulses from attachables since we are likely already targeting its' parent |
152 |
| - forceVector = forceVector * math.abs(1 - ToAttachable(mo).JointStiffness); |
153 |
| - end |
154 |
| - mo.Vel = mo.Vel + forceVector/massFactor; |
155 |
| - mo.AngularVel = mo.AngularVel - forceVector.X/(massFactor + math.abs(mo.AngularVel)); |
156 |
| - mo:AddImpulseForce(forceVector * massFactor, Vector()); |
157 |
| - --Add some additional points of damage to actors |
158 |
| - if IsActor(mo) then |
159 |
| - local actor = ToActor(mo); |
160 |
| - local impulse = (forceVector.Magnitude * self.abilityShockwaveStrength/massFactor) - actor.ImpulseDamageThreshold; |
161 |
| - local damage = impulse/(actor.GibImpulseLimit * 0.1 + actor.Material.StructuralIntegrity * 10); |
162 |
| - actor.Health = damage > 0 and actor.Health - damage or actor.Health; |
163 |
| - actor.Status = (actor.Status == Actor.STABLE and damage > (actor.Health * 0.7)) and Actor.UNSTABLE or actor.Status; |
164 |
| - end |
165 |
| - end |
166 |
| - end |
167 |
| - end |
168 |
| - |
169 |
| -end |
170 |
| - |
171 |
| -function BrowncoatBossFunctions.JumpPack(self) |
172 |
| - |
173 |
| - self.jetpackEmitting = true; |
174 |
| - |
175 |
| - self.jumpPackCooldownTimer:Reset(); |
176 |
| - |
177 |
| - self.isInAir = true; |
178 |
| - --self.jumpPackSound:Play(self.Pos); |
179 |
| - |
180 |
| - local offset = Vector(0, 2) |
181 |
| - |
182 |
| - local emitterA = CreateAEmitter("Browncoat Boss JumpPack Smoke Trail Medium") |
183 |
| - emitterA.Lifetime = 1300 |
184 |
| - self.Jetpack:AddAttachable(emitterA); |
185 |
| - |
186 |
| - ToAttachable(emitterA).ParentOffset = offset |
187 |
| - |
188 |
| - local emitterB = CreateAEmitter("Browncoat Boss JumpPack Smoke Trail Heavy") |
189 |
| - emitterB.Lifetime = 400 |
190 |
| - self.Jetpack:AddAttachable(emitterB); |
191 |
| - |
192 |
| - ToAttachable(emitterB).ParentOffset = offset |
193 |
| - |
194 |
| -end |
195 |
| - |
196 | 4 | function Create(self)
|
197 | 5 |
|
198 | 6 | self.voiceSounds = {
|
|
0 commit comments