share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua
changeset 11853 6a0d6b00dac8
parent 11499 e02f2e98bf71
child 12078 3b3894b95519
--- a/share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua	Fri Sep 16 00:01:43 2016 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua	Fri Sep 16 00:22:05 2016 +0200
@@ -1,6 +1,6 @@
 --------------------------------
 -- HIGHLANDER / HOGS OF WAR
--- version 0.4b
+-- version 0.4b+
 -- by mikade
 --------------------------------
 
@@ -216,7 +216,18 @@
 -- this is called when a hog dies
 function TransferWeps(gear)
 
-	if CurrentHedgehog ~= nil then
+	if CurrentHedgehog ~= nil and CurrentHedgehog ~= gear then
+
+        local x,y,color
+        local vgear
+        local vgtX, vgtY, vgtdX, vgtdY, vgtAngle, vgtFrame, vgtFrameTicks, vgtState, vgtTimer, vgtTint
+        local dspl = IsHogLocal(CurrentHedgehog)
+        local ammolist = ''
+
+        if dspl then
+            x,y = GetGearPosition(CurrentHedgehog)
+            color = GetClanColor(GetHogClan(CurrentHedgehog))
+        end
 
         for w,c in pairs(wepArray) do
 			val = getGearValue(gear,w)
@@ -230,10 +241,29 @@
 				else
 					AddAmmo(CurrentHedgehog, w, val)
 				end
+                if dspl then
+                    if ammolist == '' then
+                        ammolist = GetAmmoName(w)
+                    else
+                        ammolist = ammolist .. ' • ' .. GetAmmoName(w)
+                    end
+                    x = x + 2
+                    y = y + 32
+                    vgear = AddVisualGear(x, y, vgtAmmo, 0, true)
+                    if vgear ~= nil then
+                        vgtX,vgtY,vgtdX,vgtdY,vgtAngle,vgtFrame,vgtFrameTicks,vgtState,vgtTimer,vgtTint = GetVisualGearValues(vgear)
+                        vgtFrame = w
+                        SetVisualGearValues(vgear,vgtX,vgtY,vgtdX,vgtdY,vgtAngle,vgtFrame,vgtFrameTicks,vgtState,vgtTimer,vgtTint)
+                    end
+                end
 
 			end
 		end
 
+        PlaySound(sndShotgunReload);
+        if dspl and ammolist ~= '' then
+            AddCaption(ammolist, color, capgrpAmmoinfo)
+        end
 	end
 
 end