214 end |
214 end |
215 |
215 |
216 -- this is called when a hog dies |
216 -- this is called when a hog dies |
217 function TransferWeps(gear) |
217 function TransferWeps(gear) |
218 |
218 |
219 if CurrentHedgehog ~= nil then |
219 if CurrentHedgehog ~= nil and CurrentHedgehog ~= gear then |
|
220 |
|
221 local x,y,color |
|
222 local vgear |
|
223 local vgtX, vgtY, vgtdX, vgtdY, vgtAngle, vgtFrame, vgtFrameTicks, vgtState, vgtTimer, vgtTint |
|
224 local dspl = IsHogLocal(CurrentHedgehog) |
|
225 local ammolist = '' |
|
226 |
|
227 if dspl then |
|
228 x,y = GetGearPosition(CurrentHedgehog) |
|
229 color = GetClanColor(GetHogClan(CurrentHedgehog)) |
|
230 end |
220 |
231 |
221 for w,c in pairs(wepArray) do |
232 for w,c in pairs(wepArray) do |
222 val = getGearValue(gear,w) |
233 val = getGearValue(gear,w) |
223 if val ~= 0 and (mode == "orig" or (wepArray[w] ~= 9 and getGearValue(CurrentHedgehog, w) == 0)) then |
234 if val ~= 0 and (mode == "orig" or (wepArray[w] ~= 9 and getGearValue(CurrentHedgehog, w) == 0)) then |
224 setGearValue(CurrentHedgehog, w, val) |
235 setGearValue(CurrentHedgehog, w, val) |
228 AddAmmo(CurrentHedgehog, w, val+1) |
239 AddAmmo(CurrentHedgehog, w, val+1) |
229 -- assign ammo as per normal |
240 -- assign ammo as per normal |
230 else |
241 else |
231 AddAmmo(CurrentHedgehog, w, val) |
242 AddAmmo(CurrentHedgehog, w, val) |
232 end |
243 end |
|
244 if dspl then |
|
245 if ammolist == '' then |
|
246 ammolist = GetAmmoName(w) |
|
247 else |
|
248 ammolist = ammolist .. ' • ' .. GetAmmoName(w) |
|
249 end |
|
250 x = x + 2 |
|
251 y = y + 32 |
|
252 vgear = AddVisualGear(x, y, vgtAmmo, 0, true) |
|
253 if vgear ~= nil then |
|
254 vgtX,vgtY,vgtdX,vgtdY,vgtAngle,vgtFrame,vgtFrameTicks,vgtState,vgtTimer,vgtTint = GetVisualGearValues(vgear) |
|
255 vgtFrame = w |
|
256 SetVisualGearValues(vgear,vgtX,vgtY,vgtdX,vgtdY,vgtAngle,vgtFrame,vgtFrameTicks,vgtState,vgtTimer,vgtTint) |
|
257 end |
|
258 end |
233 |
259 |
234 end |
260 end |
235 end |
261 end |
236 |
262 |
|
263 PlaySound(sndShotgunReload); |
|
264 if dspl and ammolist ~= '' then |
|
265 AddCaption(ammolist, color, capgrpAmmoinfo) |
|
266 end |
237 end |
267 end |
238 |
268 |
239 end |
269 end |
240 |
270 |
241 function onGameInit() |
271 function onGameInit() |