135 |
135 |
136 ----------------------- |
136 ----------------------- |
137 -- CRATE DEFINITIONS -- |
137 -- CRATE DEFINITIONS -- |
138 ----------------------- |
138 ----------------------- |
139 -- format: |
139 -- format: |
140 -- { ammoType, ammoTypeString, unused, cost } |
140 -- { ammoType, cost } |
141 |
141 |
142 local costFactor = 20 |
142 local costFactor = 20 |
143 |
143 |
144 -- WEAPON CRATES |
144 -- WEAPON CRATES |
145 -- Weapons which shouldn't be aded: |
145 -- Weapons which shouldn't be aded: |
146 -- Air attack, napalm, drillstrike: Overwritten weapons for the Construction Mode tools |
146 -- Air attack, napalm, drillstrike: Overwritten weapons for the Construction Mode tools |
147 local atkArray = { |
147 local atkArray = { |
148 {amBazooka, "amBazooka", 0, 2*costFactor}, |
148 {amBazooka, 2*costFactor}, |
149 --{amBee, "amBee", 0, 4*costFactor}, |
149 --{amBee, 4*costFactor}, |
150 {amMortar, "amMortar", 0, 1*costFactor}, |
150 {amMortar, 1*costFactor}, |
151 {amDrill, "amDrill", 0, 3*costFactor}, |
151 {amDrill, 3*costFactor}, |
152 {amSnowball, "amSnowball", 0, 3*costFactor}, |
152 {amSnowball, 3*costFactor}, |
153 |
153 |
154 {amGrenade, "amGrenade", 0, 2*costFactor}, |
154 {amGrenade, 2*costFactor}, |
155 {amClusterBomb, "amClusterBomb", 0, 3*costFactor}, |
155 {amClusterBomb, 3*costFactor}, |
156 {amWatermelon, "amWatermelon", 0, 25*costFactor}, |
156 {amWatermelon, 25*costFactor}, |
157 {amHellishBomb, "amHellishBomb", 0, 25*costFactor}, |
157 {amHellishBomb, 25*costFactor}, |
158 {amMolotov, "amMolotov", 0, 3*costFactor}, |
158 {amMolotov, 3*costFactor}, |
159 {amGasBomb, "amGasBomb", 0, 3*costFactor}, |
159 {amGasBomb, 3*costFactor}, |
160 |
160 |
161 {amShotgun, "amShotgun", 0, 2*costFactor}, |
161 {amShotgun, 2*costFactor}, |
162 {amDEagle, "amDEagle", 0, 2*costFactor}, |
162 {amDEagle, 2*costFactor}, |
163 {amSniperRifle, "amSniperRifle", 0, 3*costFactor}, |
163 {amSniperRifle, 3*costFactor}, |
164 --{amSineGun, "amSineGun", 0, 6*costFactor}, |
164 --{amSineGun, 6*costFactor}, |
165 {amFlamethrower, "amFlamethrower", 0, 4*costFactor}, |
165 {amFlamethrower, 4*costFactor}, |
166 {amIceGun, "amIceGun", 0, 15*costFactor}, |
166 {amIceGun, 15*costFactor}, |
167 |
167 |
168 {amFirePunch, "amFirePunch", 0, 3*costFactor}, |
168 {amFirePunch, 3*costFactor}, |
169 {amWhip, "amWhip", 0, 1*costFactor}, |
169 {amWhip, 1*costFactor}, |
170 {amBaseballBat, "amBaseballBat", 0, 7*costFactor}, |
170 {amBaseballBat, 7*costFactor}, |
171 --{amKamikaze, "amKamikaze", 0, 1*costFactor}, |
171 --{amKamikaze, 1*costFactor}, |
172 {amSeduction, "amSeduction", 0, 1*costFactor}, |
172 {amSeduction, 1*costFactor}, |
173 {amHammer, "amHammer", 0, 1*costFactor}, |
173 {amHammer, 1*costFactor}, |
174 |
174 |
175 {amMine, "amMine", 0, 1*costFactor}, |
175 {amMine, 1*costFactor}, |
176 {amDynamite, "amDynamite", 0, 9*costFactor}, |
176 {amDynamite, 9*costFactor}, |
177 {amCake, "amCake", 0, 25*costFactor}, |
177 {amCake, 25*costFactor}, |
178 {amBallgun, "amBallgun", 0, 40*costFactor}, |
178 {amBallgun, 40*costFactor}, |
179 --{amRCPlane, "amRCPlane", 0, 25*costFactor}, |
179 --{amRCPlane, 25*costFactor}, |
180 {amSMine, "amSMine", 0, 5*costFactor}, |
180 {amSMine, 5*costFactor}, |
181 |
181 |
182 --{amMineStrike, "amMineStrike", 0, 15*costFactor}, |
182 --{amMineStrike,15*costFactor}, |
183 --{amPiano, "amPiano", 0, 40*costFactor}, |
183 --{amPiano, 40*costFactor}, |
184 |
184 |
185 {amPickHammer, "amPickHammer", 0, 2*costFactor}, |
185 {amPickHammer, 2*costFactor}, |
186 {amBlowTorch, "amBlowTorch", 0, 4*costFactor}, |
186 {amBlowTorch, 4*costFactor}, |
187 {amKnife, "amKnife", 0, 2*costFactor}, |
187 {amKnife, 2*costFactor}, |
188 |
188 |
189 {amBirdy, "amBirdy", 0, 7*costFactor}, |
189 {amBirdy, 7*costFactor}, |
190 |
190 |
191 {amDuck, "amDuck", 0, 2*costFactor} |
191 {amDuck, 2*costFactor} |
192 } |
192 } |
193 |
193 |
194 -- UTILITY CRATES -- |
194 -- UTILITY CRATES -- |
195 |
195 |
196 -- Utilities which shouldn't be added: |
196 -- Utilities which shouldn't be added: |
200 -- * Resurrector: We have the resurrector structure for this |
200 -- * Resurrector: We have the resurrector structure for this |
201 |
201 |
202 -- Utilities which might be weird for this mode: |
202 -- Utilities which might be weird for this mode: |
203 -- * Tardis: Randomly teleports hog, maybe even into enemy clan's area |
203 -- * Tardis: Randomly teleports hog, maybe even into enemy clan's area |
204 local utilArray = { |
204 local utilArray = { |
205 {amLandGun, "amLandGun", 0, 5*costFactor}, |
205 {amLandGun, 5*costFactor}, |
206 |
206 |
207 {amRope, "amRope", 0, 7*costFactor}, |
207 {amRope, 7*costFactor}, |
208 {amParachute, "amParachute", 0, 2*costFactor}, |
208 {amParachute, 2*costFactor}, |
209 {amJetpack, "amJetpack", 0, 8*costFactor}, |
209 {amJetpack, 8*costFactor}, |
210 {amPortalGun, "amPortalGun", 0, 15*costFactor}, |
210 {amPortalGun, 15*costFactor}, |
211 |
211 |
212 {amInvulnerable, "amInvulnerable", 0, 5*costFactor}, |
212 {amInvulnerable, 5*costFactor}, |
213 {amLaserSight, "amLaserSight", 0, 2*costFactor}, |
213 {amLaserSight, 2*costFactor}, |
214 {amVampiric, "amVampiric", 0, 6*costFactor}, |
214 {amVampiric, 6*costFactor}, |
215 |
215 |
216 {amLowGravity, "amLowGravity", 0, 4*costFactor}, |
216 {amLowGravity, 4*costFactor}, |
217 {amExtraDamage, "amExtraDamage", 0, 6*costFactor}, |
217 {amExtraDamage, 6*costFactor}, |
218 {amExtraTime, "amExtraTime", 0, 8*costFactor} |
218 {amExtraTime, 8*costFactor} |
219 } |
219 } |
220 |
220 |
221 ---------------------------- |
221 ---------------------------- |
222 -- Placement stuff |
222 -- Placement stuff |
223 ---------------------------- |
223 ---------------------------- |
224 |
224 |
225 -- primary placement categories |
225 -- primary placement categories |
226 local cIndex = 1 -- category index |
226 local cIndex = 1 -- category index |
227 local cat = { |
227 local cat = { |
228 "Girder Placement Mode", |
228 loc_noop("Girder Placement Mode"), |
229 "Rubber Placement Mode", |
229 loc_noop("Rubber Placement Mode"), |
230 "Mine Placement Mode", |
230 loc_noop("Mine Placement Mode"), |
231 "Sticky Mine Placement Mode", |
231 loc_noop("Sticky Mine Placement Mode"), |
232 "Barrel Placement Mode", |
232 loc_noop("Barrel Placement Mode"), |
233 "Weapon Crate Placement Mode", |
233 loc_noop("Weapon Crate Placement Mode"), |
234 "Utility Crate Placement Mode", |
234 loc_noop("Utility Crate Placement Mode"), |
235 "Health Crate Placement Mode", |
235 loc_noop("Health Crate Placement Mode"), |
236 "Structure Placement Mode" |
236 loc_noop("Structure Placement Mode"), |
237 } |
237 } |
|
238 |
238 local catReverse = {} |
239 local catReverse = {} |
239 for c=1, #cat do |
240 for c=1, #cat do |
240 catReverse[cat[c]] = c |
241 catReverse[cat[c]] = c |
241 end |
242 end |
242 |
243 |
|
244 -- Track girders in proximity of CurrentHedgehog |
243 local sProx = { |
245 local sProx = { |
244 {loc("Girder Placement Mode"),false}, |
246 ["Girder Placement Mode"] = false, |
245 {loc("Rubber Placement Mode"),false}, |
247 ["Rubber Placement Mode"] = false, |
246 {loc("Mine Placement Mode"),false}, |
248 ["Mine Placement Mode"] = false, |
247 {loc("Sticky Mine Placement Mode"),false}, |
249 ["Sticky Mine Placement Mode"] = false, |
248 {loc("Barrel Placement Mode"),false}, |
250 ["Barrel Placement Mode"] = false, |
249 {loc("Weapon Crate Placement Mode"),false}, |
251 ["Weapon Crate Placement Mode"] = false, |
250 {loc("Utility Crate Placement Mode"),false}, |
252 ["Utility Crate Placement Mode"] = false, |
251 {loc("Health Crate Placement Mode"),false}, |
253 ["Health Crate Placement Mode"] = false, |
252 {loc("Structure Placement Mode"),false}, |
254 ["Structure Placement Mode"] = false, |
253 {loc("Teleportation Mode"),false}, |
255 ["Teleportation Mode"] = false, |
254 } |
256 } |
255 |
|
256 |
257 |
257 local pMode = {} -- pMode contains custom subsets of the main categories |
258 local pMode = {} -- pMode contains custom subsets of the main categories |
258 local pIndex = 1 |
259 local pIndex = 1 |
259 |
260 |
260 local currentGirderRotation = 1 -- current girder rotation, we actually need this as HW remembers what rotation you last used |
261 local currentGirderRotation = 1 -- current girder rotation, we actually need this as HW remembers what rotation you last used |
452 |
453 |
453 local frameID = 0 |
454 local frameID = 0 |
454 local visualSprite = sprTarget |
455 local visualSprite = sprTarget |
455 local madness = AddVisualGear(GetX(tempG), GetY(tempG), vgtStraightShot, 1, true,1) |
456 local madness = AddVisualGear(GetX(tempG), GetY(tempG), vgtStraightShot, 1, true,1) |
456 |
457 |
457 if pType == loc("Reflector Shield") then |
458 if pType == "Reflector Shield" then |
458 table.insert(strucHealth,255) |
459 table.insert(strucHealth,255) |
459 |
460 |
460 else |
461 else |
461 table.insert(strucHealth,1) |
462 table.insert(strucHealth,1) |
462 end |
463 end |
463 |
464 |
464 table.insert(strucCirc,tempCirc) |
465 table.insert(strucCirc,tempCirc) |
465 |
466 |
466 table.insert(strucCircType, 1) |
467 table.insert(strucCircType, 1) |
467 if pType == loc("Bio-Filter") then |
468 if pType == "Bio-Filter" then |
468 table.insert(strucCircCol,colorRed) |
469 table.insert(strucCircCol,colorRed) |
469 table.insert(strucCircRadius,1000) |
470 table.insert(strucCircRadius,1000) |
470 frameID = 7 |
471 frameID = 7 |
471 elseif pType == loc("Healing Station") then |
472 elseif pType == "Healing Station" then |
472 table.insert(strucCircCol,0xFF00FF00) |
473 table.insert(strucCircCol,0xFF00FF00) |
473 table.insert(strucCircRadius,500) |
474 table.insert(strucCircRadius,500) |
474 frameID = 3 |
475 frameID = 3 |
475 elseif pType == loc("Respawner") then |
476 elseif pType == "Respawner" then |
476 table.insert(strucCircCol,0xFF00FF00) |
477 table.insert(strucCircCol,0xFF00FF00) |
477 table.insert(strucCircRadius,75) |
478 table.insert(strucCircRadius,75) |
478 runOnHogs(EnableHogResurrectionForThisClan) |
479 runOnHogs(EnableHogResurrectionForThisClan) |
479 frameID = 1 |
480 frameID = 1 |
480 elseif pType == loc("Teleportation Node") then |
481 elseif pType == "Teleportation Node" then |
481 table.insert(strucCircCol,0x0000FFFF) |
482 table.insert(strucCircCol,0x0000FFFF) |
482 table.insert(strucCircRadius,350) |
483 table.insert(strucCircRadius,350) |
483 frameID = 6 |
484 frameID = 6 |
484 elseif pType == loc("Generator") then |
485 elseif pType == "Generator" then |
485 table.insert(strucCircCol,0xFFFF00FF) |
486 table.insert(strucCircCol,0xFFFF00FF) |
486 table.insert(strucCircRadius,75) |
487 table.insert(strucCircRadius,75) |
487 setGearValue(tempG, "power", 0) |
488 setGearValue(tempG, "power", 0) |
488 frameID = 2 |
489 frameID = 2 |
489 elseif pType == loc("Support Station") then |
490 elseif pType == "Support Station" then |
490 table.insert(strucCircCol,0xFFFF00FF) |
491 table.insert(strucCircCol,0xFFFF00FF) |
491 table.insert(strucCircRadius,500) |
492 table.insert(strucCircRadius,500) |
492 frameID = 4 |
493 frameID = 4 |
493 elseif pType == loc("Construction Station") then |
494 elseif pType == "Construction Station" then |
494 table.insert(strucCircCol,0xFFFFFFFF) |
495 table.insert(strucCircCol,0xFFFFFFFF) |
495 table.insert(strucCircRadius,500) |
496 table.insert(strucCircRadius,500) |
496 frameID = 8 |
497 frameID = 8 |
497 elseif pType == loc("Reflector Shield") then |
498 elseif pType == "Reflector Shield" then |
498 table.insert(strucCircCol,0xffae00ff) |
499 table.insert(strucCircCol,0xffae00ff) |
499 table.insert(strucCircRadius,750) |
500 table.insert(strucCircRadius,750) |
500 frameID = 9 |
501 frameID = 9 |
501 elseif pType == loc("Weapon Filter") then |
502 elseif pType == "Weapon Filter" then |
502 table.insert(strucCircCol,0xa800ffff) |
503 table.insert(strucCircCol,0xa800ffff) |
503 table.insert(strucCircRadius,750) |
504 table.insert(strucCircRadius,750) |
504 frameID = 5 |
505 frameID = 5 |
505 end |
506 end |
506 |
507 |
767 end |
768 end |
768 end |
769 end |
769 end |
770 end |
770 |
771 |
771 --mark as within range of a teleporter node |
772 --mark as within range of a teleporter node |
772 elseif strucType[sID] == loc("Teleportation Node") then |
773 elseif strucType[sID] == "Teleportation Node" then |
773 |
774 |
774 if GetGearType(gear) == gtHedgehog then |
775 if GetGearType(gear) == gtHedgehog then |
775 if GetHogClan(gear) == strucClan[sID] then |
776 if GetHogClan(gear) == strucClan[sID] then |
776 |
777 |
777 for i = 1, #sProx do |
778 sProx["Teleportation Mode"] = true |
778 if sProx[i][1] == loc("Teleportation Mode") then |
|
779 sProx[i][2] = true |
|
780 end |
|
781 end |
|
782 |
779 |
783 end |
780 end |
784 end |
781 end |
785 |
782 |
786 -- mark as within range of construction station |
783 -- mark as within range of construction station |
787 -- and thus allow menu access to placement modes |
784 -- and thus allow menu access to placement modes |
788 -- for girders, mines, sticky mines and barrels |
785 -- for girders, mines, sticky mines and barrels |
789 elseif strucType[sID] == loc("Construction Station") then |
786 elseif strucType[sID] == "Construction Station" then |
790 |
787 |
791 if GetGearType(gear) == gtHedgehog then |
788 if GetGearType(gear) == gtHedgehog then |
792 if GetHogClan(gear) == strucClan[sID] then |
789 if GetHogClan(gear) == strucClan[sID] then |
793 AddVisualGear(GetX(strucGear[sID]), GetY(strucGear[sID]), vgtSmoke, 0, true) |
790 AddVisualGear(GetX(strucGear[sID]), GetY(strucGear[sID]), vgtSmoke, 0, true) |
794 |
791 |
795 for i = 1, #sProx do |
792 sProx["Girder Placement Mode"] = true |
796 if ((sProx[i][1] == loc("Girder Placement Mode")) |
793 sProx["Rubber Placement Mode"] = true |
797 or (sProx[i][1] == loc("Rubber Placement Mode")) |
794 sProx["Mine Placement Mode"] = true |
798 or (sProx[i][1] == loc("Mine Placement Mode")) |
795 sProx["Sticky Mine Placement Mode"] = true |
799 or (sProx[i][1] == loc("Sticky Mine Placement Mode")) |
796 sProx["Barrel Placement Mode"] = true |
800 or (sProx[i][1] == loc("Barrel Placement Mode"))) |
|
801 then |
|
802 sProx[i][2] = true |
|
803 end |
|
804 end |
|
805 |
|
806 |
797 |
807 end |
798 end |
808 end |
799 end |
809 |
800 |
810 -- mark as within stupport station range |
801 -- mark as within stupport station range |
811 -- and thus allow menu access to placement modes |
802 -- and thus allow menu access to placement modes |
812 -- for weapon, utility, and med crates |
803 -- for weapon, utility, and med crates |
813 elseif strucType[sID] == loc("Support Station") then |
804 elseif strucType[sID] == "Support Station" then |
814 |
805 |
815 if GetGearType(gear) == gtHedgehog then |
806 if GetGearType(gear) == gtHedgehog then |
816 if GetHogClan(gear) == strucClan[sID] then |
807 if GetHogClan(gear) == strucClan[sID] then |
817 AddVisualGear(GetX(strucGear[sID]), GetY(strucGear[sID]), vgtSmoke, 0, true) |
808 AddVisualGear(GetX(strucGear[sID]), GetY(strucGear[sID]), vgtSmoke, 0, true) |
818 |
809 |
819 for i = 1, #sProx do |
810 sProx["Health Crate Placement Mode"] = true |
820 if ((sProx[i][1] == loc("Health Crate Placement Mode")) |
811 sProx["Weapon Crate Placement Mode"] = true |
821 or (sProx[i][1] == loc("Weapon Crate Placement Mode")) |
812 sProx["Utility Crate Placement Mode"] = true |
822 or (sProx[i][1] == loc("Utility Crate Placement Mode"))) |
|
823 then |
|
824 sProx[i][2] = true |
|
825 end |
|
826 end |
|
827 |
|
828 |
813 |
829 end |
814 end |
830 end |
815 end |
831 end |
816 end |
832 |
817 |
897 |
879 |
898 end |
880 end |
899 |
881 |
900 end |
882 end |
901 |
883 |
902 |
884 -- Add and remove ammo based on structure proximity |
903 |
|
904 -- this is kinda messy and gross (even more than usual), fix it up at some point |
|
905 -- it just assumes that if you have access to girders, it works for rubbers |
|
906 -- as that is what the struc implemenation means due to construction station |
|
907 if GameTime % 100 == 0 and CurrentHedgehog ~= nil then |
885 if GameTime % 100 == 0 and CurrentHedgehog ~= nil then |
908 local anyUIProx = false |
886 if sProx["Girder Placement Mode"] then |
909 for i = 1, #sProx do |
887 AddAmmo(CurrentHedgehog, amGirder, 100) |
910 |
888 else |
911 if sProx[i][1] == loc("Girder Placement Mode") then |
889 AddAmmo(CurrentHedgehog, amGirder, 0) |
912 if sProx[i][2] == true then |
890 end |
913 AddAmmo(CurrentHedgehog, amGirder, 100) |
891 if sProx["Rubber Placement Mode"] then |
914 AddAmmo(CurrentHedgehog, amRubber, 100) |
892 AddAmmo(CurrentHedgehog, amRubber, 100) |
915 AddAmmo(CurrentHedgehog, amCMObjectPlacer, 100) |
893 else |
916 else |
894 AddAmmo(CurrentHedgehog, amRubber, 0) |
917 AddAmmo(CurrentHedgehog, amGirder, 0) |
895 end |
918 AddAmmo(CurrentHedgehog, amRubber, 0) |
896 if sProx["Mine Placement Mode"] or sProx["Sticky Mine Placement Mode"] or sProx["Barrel Placement Mode"] then |
919 AddAmmo(CurrentHedgehog, amCMObjectPlacer, 0) -- new |
897 AddAmmo(CurrentHedgehog, amCMObjectPlacer, 100) |
920 end |
898 else |
921 elseif sProx[i][1] == loc("Teleportation Mode") then |
899 AddAmmo(CurrentHedgehog, amCMObjectPlacer, 0) |
922 if sProx[i][2] == true then |
900 end |
923 AddAmmo(CurrentHedgehog, amTeleport, 100) |
901 if sProx["Teleportation Mode"] then |
924 else |
902 AddAmmo(CurrentHedgehog, amTeleport, 100) |
925 AddAmmo(CurrentHedgehog, amTeleport, 0) |
903 else |
926 end |
904 AddAmmo(CurrentHedgehog, amTeleport, 0) |
927 elseif sProx[i][1] == loc("Weapon Crate Placement Mode") then |
905 end |
928 -- this is new stuff |
906 if sProx["Weapon Crate Placement Mode"] or sProx["Utility Crate Placement Mode"] or sProx["Health Crate Placement Mode"] then |
929 if sProx[i][2] == true then |
907 AddAmmo(CurrentHedgehog, amCMCratePlacer, 100) |
930 AddAmmo(CurrentHedgehog, amCMCratePlacer, 100) |
908 else |
931 else |
909 AddAmmo(CurrentHedgehog, amCMCratePlacer, 0) |
932 AddAmmo(CurrentHedgehog, amCMCratePlacer, 0) |
|
933 end |
|
934 end |
|
935 |
|
936 if (sProx[i][2] == true) then |
|
937 anyUIProx = true |
|
938 end |
|
939 |
|
940 end |
910 end |
941 end |
911 end |
942 |
912 |
943 end |
913 end |
944 |
914 |
998 elseif cat[cIndex] == "Health Crate Placement Mode" then |
968 elseif cat[cIndex] == "Health Crate Placement Mode" then |
999 gear = SpawnHealthCrate(x,y) |
969 gear = SpawnHealthCrate(x,y) |
1000 if gear ~= nil then |
970 if gear ~= nil then |
1001 placed = true |
971 placed = true |
1002 SetHealth(gear, pMode[pIndex]) |
972 SetHealth(gear, pMode[pIndex]) |
1003 setGearValue(gear,"caseType","med") |
|
1004 clanCratesSpawned[GetHogClan(CurrentHedgehog)] = clanCratesSpawned[GetHogClan(CurrentHedgehog)] +1 |
973 clanCratesSpawned[GetHogClan(CurrentHedgehog)] = clanCratesSpawned[GetHogClan(CurrentHedgehog)] +1 |
1005 end |
974 end |
1006 elseif cat[cIndex] == "Weapon Crate Placement Mode" then |
975 elseif cat[cIndex] == "Weapon Crate Placement Mode" then |
1007 gear = SpawnAmmoCrate(x, y, atkArray[pIndex][1]) |
976 gear = SpawnAmmoCrate(x, y, atkArray[pIndex][1]) |
1008 if gear ~= nil then |
977 if gear ~= nil then |
1009 placed = true |
978 placed = true |
1010 setGearValue(gear,"caseType","ammo") |
|
1011 setGearValue(gear,"contents",atkArray[pIndex][2]) |
|
1012 clanCratesSpawned[GetHogClan(CurrentHedgehog)] = clanCratesSpawned[GetHogClan(CurrentHedgehog)] +1 |
979 clanCratesSpawned[GetHogClan(CurrentHedgehog)] = clanCratesSpawned[GetHogClan(CurrentHedgehog)] +1 |
1013 end |
980 end |
1014 elseif cat[cIndex] == "Utility Crate Placement Mode" then |
981 elseif cat[cIndex] == "Utility Crate Placement Mode" then |
1015 gear = SpawnUtilityCrate(x, y, utilArray[pIndex][1]) |
982 gear = SpawnUtilityCrate(x, y, utilArray[pIndex][1]) |
1016 if gear ~= nil then |
983 if gear ~= nil then |
1017 placed = true |
984 placed = true |
1018 setGearValue(gear,"caseType","util") |
|
1019 setGearValue(gear,"contents",utilArray[pIndex][2]) |
|
1020 if utilArray[pIndex][1] == amExtraTime then |
985 if utilArray[pIndex][1] == amExtraTime then |
1021 clanUsedExtraTime[GetHogClan(CurrentHedgehog)] = true |
986 clanUsedExtraTime[GetHogClan(CurrentHedgehog)] = true |
1022 end |
987 end |
1023 clanCratesSpawned[GetHogClan(CurrentHedgehog)] = clanCratesSpawned[GetHogClan(CurrentHedgehog)] +1 |
988 clanCratesSpawned[GetHogClan(CurrentHedgehog)] = clanCratesSpawned[GetHogClan(CurrentHedgehog)] +1 |
1024 end |
989 end |
1090 pMode = {HealthCaseAmount} |
1055 pMode = {HealthCaseAmount} |
1091 placedExpense = 5 |
1056 placedExpense = 5 |
1092 teamLCrateMode[team] = cat[cIndex] |
1057 teamLCrateMode[team] = cat[cIndex] |
1093 elseif cat[cIndex] == "Weapon Crate Placement Mode" then |
1058 elseif cat[cIndex] == "Weapon Crate Placement Mode" then |
1094 for i = 1, #atkArray do |
1059 for i = 1, #atkArray do |
1095 pMode[i] = GetAmmoName(atkArray[i][1]) |
1060 pMode[i] = atkArray[i][1] |
1096 end |
1061 end |
1097 placedExpense = atkArray[pIndex][4] |
1062 placedExpense = atkArray[pIndex][2] |
1098 teamLCrateMode[team] = cat[cIndex] |
1063 teamLCrateMode[team] = cat[cIndex] |
1099 pIndex = teamLWeapIndex[team] |
1064 pIndex = teamLWeapIndex[team] |
1100 elseif cat[cIndex] == "Utility Crate Placement Mode" then |
1065 elseif cat[cIndex] == "Utility Crate Placement Mode" then |
1101 for i = 1, #utilArray do |
1066 for i = 1, #utilArray do |
1102 pMode[i] = GetAmmoName(utilArray[i][1]) |
1067 pMode[i] = utilArray[i][1] |
1103 end |
1068 end |
1104 placedExpense = utilArray[pIndex][4] |
1069 placedExpense = utilArray[pIndex][2] |
1105 teamLCrateMode[team] = cat[cIndex] |
1070 teamLCrateMode[team] = cat[cIndex] |
1106 pIndex = teamLUtilIndex[team] |
1071 pIndex = teamLUtilIndex[team] |
1107 elseif cat[cIndex] == "Mine Placement Mode" then |
1072 elseif cat[cIndex] == "Mine Placement Mode" then |
1108 pMode = {0,1000,2000,3000,4000,5000} |
1073 pMode = {0,1000,2000,3000,4000,5000} |
1109 placedExpense = 15 |
1074 placedExpense = 15 |
1110 teamLObjectMode[team] = cat[cIndex] |
1075 teamLObjectMode[team] = cat[cIndex] |
1111 pIndex = teamLMineIndex[team] |
1076 pIndex = teamLMineIndex[team] |
1112 elseif cat[cIndex] == "Sticky Mine Placement Mode" then |
1077 elseif cat[cIndex] == "Sticky Mine Placement Mode" then |
1113 pMode = {loc("Sticky Mine")} |
1078 pMode = {amSMine} |
1114 placedExpense = 20 |
1079 placedExpense = 20 |
1115 teamLObjectMode[team] = cat[cIndex] |
1080 teamLObjectMode[team] = cat[cIndex] |
1116 elseif cat[cIndex] == "Structure Placement Mode" then |
1081 elseif cat[cIndex] == "Structure Placement Mode" then |
1117 pMode = { |
1082 pMode = { |
1118 loc("Support Station"), |
1083 loc_noop("Support Station"), |
1119 loc("Construction Station"), |
1084 loc_noop("Construction Station"), |
1120 loc("Healing Station"), |
1085 loc_noop("Healing Station"), |
1121 loc("Teleportation Node"), |
1086 loc_noop("Teleportation Node"), |
1122 loc("Weapon Filter"), |
1087 loc_noop("Weapon Filter"), |
1123 |
1088 |
1124 loc("Bio-Filter"), |
1089 loc_noop("Bio-Filter"), |
1125 loc("Reflector Shield"), |
1090 loc_noop("Reflector Shield"), |
1126 loc("Respawner"), |
1091 loc_noop("Respawner"), |
1127 loc("Generator"), |
1092 loc_noop("Generator"), |
1128 } |
1093 } |
1129 pIndex = teamLStructIndex[team] |
1094 pIndex = teamLStructIndex[team] |
1130 end |
1095 end |
1131 |
1096 |
1132 return true |
1097 return true |
1255 |
1220 |
1256 function updateCost() |
1221 function updateCost() |
1257 |
1222 |
1258 if CurrentHedgehog == nil or band(GetState(CurrentHedgehog), gstHHDriven) == 0 then return end |
1223 if CurrentHedgehog == nil or band(GetState(CurrentHedgehog), gstHHDriven) == 0 then return end |
1259 |
1224 |
1260 if pMode[pIndex] == loc("Healing Station") then |
1225 if pMode[pIndex] == "Healing Station" then |
1261 placedExpense = 50 |
1226 placedExpense = 50 |
1262 elseif pMode[pIndex] == loc("Weapon Filter") then |
1227 elseif pMode[pIndex] == "Weapon Filter" then |
1263 placedExpense = 50 |
1228 placedExpense = 50 |
1264 elseif pMode[pIndex] == loc("Bio-Filter") then |
1229 elseif pMode[pIndex] == "Bio-Filter" then |
1265 placedExpense = 100 |
1230 placedExpense = 100 |
1266 elseif pMode[pIndex] == loc("Respawner") then |
1231 elseif pMode[pIndex] == "Respawner" then |
1267 placedExpense = 300 |
1232 placedExpense = 300 |
1268 elseif pMode[pIndex] == loc("Teleportation Node") then |
1233 elseif pMode[pIndex] == "Teleportation Node" then |
1269 placedExpense = 30 |
1234 placedExpense = 30 |
1270 elseif pMode[pIndex] == loc("Support Station") then |
1235 elseif pMode[pIndex] == "Support Station" then |
1271 placedExpense = 50 |
1236 placedExpense = 50 |
1272 elseif pMode[pIndex] == loc("Construction Station") then |
1237 elseif pMode[pIndex] == "Construction Station" then |
1273 placedExpense = 50 |
1238 placedExpense = 50 |
1274 elseif pMode[pIndex] == loc("Generator") then |
1239 elseif pMode[pIndex] == "Generator" then |
1275 placedExpense = 300 |
1240 placedExpense = 300 |
1276 elseif pMode[pIndex] == loc("Reflector Shield") then |
1241 elseif pMode[pIndex] == "Reflector Shield" then |
1277 placedExpense = 200 |
1242 placedExpense = 200 |
1278 elseif cat[cIndex] == "Weapon Crate Placement Mode" then |
1243 elseif cat[cIndex] == "Weapon Crate Placement Mode" then |
1279 placedExpense = atkArray[pIndex][4] |
1244 placedExpense = atkArray[pIndex][2] |
1280 elseif cat[cIndex] == "Utility Crate Placement Mode" then |
1245 elseif cat[cIndex] == "Utility Crate Placement Mode" then |
1281 placedExpense = utilArray[pIndex][4] |
1246 placedExpense = utilArray[pIndex][2] |
1282 end |
1247 end |
1283 |
1248 |
1284 AddCaption(loc("Cost") .. ": " .. placedExpense,0xffba00ff,capgrpAmmostate) |
1249 AddCaption(string.format(loc("Cost: %d"), placedExpense), 0xffba00ff, capgrpAmmostate) |
1285 |
1250 |
1286 end |
1251 end |
1287 |
1252 |
1288 -- Should be called when the index of the mode was changed by the player. |
1253 -- Should be called when the index of the mode was changed by the player. |
1289 -- E.g. new weapon crate contents or structure type |
1254 -- E.g. new weapon crate contents or structure type |