share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua
changeset 12647 f190ed9df875
parent 12646 28183c98a3a9
child 12648 c755afd8fb6b
--- a/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Wed Oct 04 20:50:14 2017 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Wed Oct 04 21:25:27 2017 +0200
@@ -291,6 +291,8 @@
 local shoppaPY = {}
 local shoppaPR = {}
 
+local savedScriptParam = ""
+
 -- Misc. state variables
 local hedgeEditorMissionPanelShown = false
 local tagGears = {}
@@ -380,6 +382,9 @@
 
 				--skiphog is 6
 
+local effectArray = { heInvulnerable, hePoisoned, heResurrectable, heResurrected, heFrozen }
+local effectStr = { "heInvulnerable", "hePoisoned", "heResurrectable", "heResurrected", "heFrozen" }
+
 ----------------------------
 -- hog and map editing junk
 ----------------------------
@@ -1480,6 +1485,16 @@
 
 	table.insert	(tempDataList,"	SetGearPosition(hhs[" .. #hhs .. "], " .. GetX(gear) .. ", " .. GetY(gear) .. ")")
 
+	for e=1, #effectArray do
+		if GetEffect(gear, effectArray[e]) ~= 0 then
+			table.insert	(tempDataList,"	SetEffect(hhs[" .. #hhs .. "], " .. effectStr[e] .. ", " .. GetEffect(gear, effectArray[e]) .. ")")
+		end
+	end
+	local dX, _ = GetGearVelocity(gear)
+	if dX < 0 then
+		table.insert	(tempDataList,"	HogTurnLeft(hhs[" .. #hhs .. "], true)")
+	end
+
 	if getGearValue(gear,"tag") ~= nil then
 		table.insert	(tempDataList,"	setGearValue(hhs[" .. #hhs .. "], \"tag\", \"" .. getGearValue(gear,"tag") .. "\")")
 	end
@@ -1579,7 +1594,10 @@
 
 	WriteLnToConsole("	Ready = " .. Ready)
 	WriteLnToConsole("	AirMinesNum = " .. AirMinesNum)
-	WriteLnToConsole("	ScriptParam = " .. ScriptParam)
+	if savedScriptParam ~= "" then
+		-- TODO:
+		--WriteLnToConsole("	ScriptParam = \"" .. savedScriptParam .. "\"")
+	end
 	WriteLnToConsole("	GetAwayTime = " .. GetAwayTime)
 	WriteLnToConsole("	WorldEdge = " .. WorldEdge)
 
@@ -3327,6 +3345,9 @@
 		mapID = 1
 	end
 
+	-- Neccessary cuz ScriptParam is not global
+	savedScriptParam = ScriptParam
+
 end
 
 function onGameInit()