--- a/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua Fri Feb 09 14:33:00 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua Fri Feb 09 14:56:04 2018 +0100
@@ -201,6 +201,11 @@
checkForSpecialWeaponsIn = -1
+-- Fake ammo types, for the overwritten weapons in Construction Mode
+amCMStructurePlacer = amAirAttack
+amCMCratePlacer = amNapalm
+amCMObjectPlacer = amDrillStrike
+
-- Config variables (script parameter)
conf_initialEnergy = 550
conf_energyPerRound = 50
@@ -666,7 +671,7 @@
AddAmmo(gear, utilArray[wpnIndex][1], 0)
end
- AddAmmo(gear, amAirAttack, 100)
+ AddAmmo(gear, amCMStructurePlacer, 100)
AddAmmo(gear, amSwitch, 100)
AddAmmo(gear, amSkip, 100)
@@ -870,11 +875,11 @@
if sProx[i][2] == true then
AddAmmo(CurrentHedgehog, amGirder, 100)
AddAmmo(CurrentHedgehog, amRubber, 100)
- AddAmmo(CurrentHedgehog, amDrillStrike, 100)
+ AddAmmo(CurrentHedgehog, amCMObjectPlacer, 100)
else
AddAmmo(CurrentHedgehog, amGirder, 0)
AddAmmo(CurrentHedgehog, amRubber, 0)
- AddAmmo(CurrentHedgehog, amDrillStrike, 0) -- new
+ AddAmmo(CurrentHedgehog, amCMObjectPlacer, 0) -- new
end
elseif sProx[i][1] == loc("Teleportation Mode") then
if sProx[i][2] == true then
@@ -885,9 +890,9 @@
elseif sProx[i][1] == loc("Weapon Crate Placement Mode") then
-- this is new stuff
if sProx[i][2] == true then
- AddAmmo(CurrentHedgehog, amNapalm, 100)
+ AddAmmo(CurrentHedgehog, amCMCratePlacer, 100)
else
- AddAmmo(CurrentHedgehog, amNapalm, 0)
+ AddAmmo(CurrentHedgehog, amCMCratePlacer, 0)
end
end
@@ -903,7 +908,7 @@
function checkForSpecialWeapons()
- if (GetCurAmmoType() == amDrillStrike) then
+ if (GetCurAmmoType() == amCMObjectPlacer) then
AddCaption(loc("Object Placer"),GetClanColor(GetHogClan(CurrentHedgehog)),capgrpAmmoinfo)
end
@@ -963,6 +968,8 @@
--{amRCPlane, "amRCPlane", 0, loc("RC Plane"), 25*placeholder},
{amSMine, "amSMine", 0, 5*placeholder},
+ -- Careful! Some airborne attacks are overwritten by the special Construction Mode tools
+
--{amAirAttack, "amAirAttack", 0, loc("Air Attack"), 10*placeholder},
--{amMineStrike, "amMineStrike", 0, loc("Mine Strike"), 15*placeholder},
--{amNapalm, "amNapalm", 0, loc("Napalm"), 15*placeholder},
@@ -1281,7 +1288,7 @@
end
-- update display selection criteria
- if ((curWep == amGirder) or (curWep == amAirAttack) or (curWep == amNapalm) or (curWep == amDrillStrike) or (curWep == amRubber))
+ if ((curWep == amGirder) or (curWep == amCMStructurePlacer) or (curWep == amCMCratePlacer) or (curWep == amCMObjectPlacer) or (curWep == amRubber))
and (CurrentHedgehog ~= nil or band(GetState(CurrentHedgehog), gstHHDriven) ~= 0) then
---------------hooolllllyyyy fucking shit this
@@ -1291,19 +1298,19 @@
-- never designed to do
-- needs to be rewritten badly sadface
-- this bit here catches the new 3 types of weapons
- if ((sProx[cIndex][1] == loc("Structure Placement Mode") and (curWep ~= amAirAttack))) then
+ if ((sProx[cIndex][1] == loc("Structure Placement Mode") and (curWep ~= amCMStructurePlacer))) then
updatePlacementDisplay(1)
elseif (sProx[cIndex][1] == loc("Health Crate Placement Mode")) or
(sProx[cIndex][1] == loc("Weapon Crate Placement Mode")) or
(sProx[cIndex][1] == loc("Utility Crate Placement Mode")) then
- if curWep ~= amNapalm then
+ if curWep ~= amCMCratePlacer then
updatePlacementDisplay(1)
end
elseif (sProx[cIndex][1] == loc("Mine Placement Mode")) or
(sProx[cIndex][1] == loc("Sticky Mine Placement Mode")) or
(sProx[cIndex][1] == loc("Barrel Placement Mode")) then
- if curWep ~= amDrillStrike then
+ if curWep ~= amCMObjectPlacer then
updatePlacementDisplay(1)
end
@@ -1409,7 +1416,7 @@
pIndex = #pMode
end
- if (curWep == amGirder) or (curWep == amAirAttack) or (curWep == amNapalm) or (curWep == amDrillStrike) then
+ if (curWep == amGirder) or (curWep == amCMStructurePlacer) or (curWep == amCMCratePlacer) or (curWep == amCMObjectPlacer) then
showModeMessage()
updateCost()
end
@@ -1424,7 +1431,7 @@
pIndex = 1
end
- if (curWep == amGirder) or (curWep == amAirAttack) or (curWep == amNapalm) or (curWep == amDrillStrike) then
+ if (curWep == amGirder) or (curWep == amCMStructurePlacer) or (curWep == amCMCratePlacer) or (curWep == amCMObjectPlacer) then
showModeMessage()
updateCost()
end
@@ -1461,21 +1468,21 @@
end
if sProx[cIndex][2] == true then
- if (GetCurAmmoType() == amNapalm) then
+ if (GetCurAmmoType() == amCMCratePlacer) then
if (sProx[cIndex][1] == loc("Health Crate Placement Mode")) or
(sProx[cIndex][1] == loc("Weapon Crate Placement Mode")) or
(sProx[cIndex][1] == loc("Utility Crate Placement Mode"))
then
foundMatch = true
end
- elseif (GetCurAmmoType() == amDrillStrike) then
+ elseif (GetCurAmmoType() == amCMObjectPlacer) then
if (sProx[cIndex][1] == loc("Mine Placement Mode")) or
(sProx[cIndex][1] == loc("Sticky Mine Placement Mode")) or
(sProx[cIndex][1] == loc("Barrel Placement Mode"))
then
foundMatch = true
end
- elseif (GetCurAmmoType() == amAirAttack) then
+ elseif (GetCurAmmoType() == amCMStructurePlacer) then
if sProx[cIndex][1] == loc("Structure Placement Mode") then
foundMatch = true
end
@@ -1499,7 +1506,7 @@
---------------------------------------------------------
function onUp()
- if ( (curWep == amNapalm) or (curWep == amDrillStrike) ) then
+ if ( (curWep == amCMCratePlacer) or (curWep == amCMObjectPlacer) ) then
if CurrentHedgehog ~= nil or band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 then
updatePlacementDisplay(-1)
end
@@ -1509,7 +1516,7 @@
function onDown()
- if ( (curWep == amNapalm) or (curWep == amDrillStrike) ) then
+ if ( (curWep == amCMCratePlacer) or (curWep == amCMObjectPlacer) ) then
if CurrentHedgehog ~= nil or band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 then
updatePlacementDisplay(1)
end
@@ -1572,7 +1579,7 @@
end
-- for now, everyone should have this stuff
- AddAmmo(gear, amAirAttack, 100)
+ AddAmmo(gear, amCMStructurePlacer, 100)
AddAmmo(gear, amSwitch, 100)
AddAmmo(gear, amSkip, 100)
@@ -1591,7 +1598,7 @@
, 4, 5000
)
- SetAmmoTexts(amAirAttack, loc("Structure Placer"), loc("Construction Mode tool"), loc("Build one of multiple different structures|to aid you in victory, at the cost of energy.") .. "| |" ..
+ SetAmmoTexts(amCMStructurePlacer, loc("Structure Placer"), loc("Construction Mode tool"), loc("Build one of multiple different structures|to aid you in victory, at the cost of energy.") .. "| |" ..
loc("Healing Station: Heals nearby hogs.") .. "|" ..
loc("Bio-Filter: Aggressively removes enemies.") .. "|" ..
loc("Weapon Filter: Dematerializes all ammo| carried by enemies entering it.") .. "|" ..
@@ -1609,13 +1616,13 @@
txt_crateLimit = string.format(loc("You may only place %d crates per round."), conf_cratesPerRound) .. "|"
end
- SetAmmoTexts(amNapalm, loc("Crate Placer"), loc("Construction Mode tool"),
+ SetAmmoTexts(amCMCratePlacer, loc("Crate Placer"), loc("Construction Mode tool"),
loc("This allows you to create a crate anywhere|within your clan's area of influence,|at the cost of energy.") .. "|" ..
txt_crateLimit ..
loc("Up/down: Choose crate type") .. "|" ..
loc("Left/right: Choose crate contents") .. "|" ..
loc("|Cursor: Place crate"))
- SetAmmoTexts(amDrillStrike, loc("Object Placer"), loc("Construction Mode tool"), loc("This allows you to create and place mines,|sticky mines and barrels anywhere within your|clan's area of influence at the cost of energy.|Up/down: Choose object type|Left/right: Choose timer (for mines)|Cursor: Place object"))
+ SetAmmoTexts(amCMObjectPlacer, loc("Object Placer"), loc("Construction Mode tool"), loc("This allows you to create and place mines,|sticky mines and barrels anywhere within your|clan's area of influence at the cost of energy.|Up/down: Choose object type|Left/right: Choose timer (for mines)|Cursor: Place object"))
SetAmmoDescriptionAppendix(amTeleport, loc("It only works in teleportation nodes of your own clan."))
--- a/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua Fri Feb 09 14:33:00 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua Fri Feb 09 14:56:04 2018 +0100
@@ -256,6 +256,9 @@
-- experimental crap
--local destroyMap = false
+-- Fake ammo type for the gear placement tool
+local amCMGearPlacementTool = amAirAttack
+
-- Special frames in Ammos.png/Ammos_bw.png
local ammoFrameAirAttack = 63
@@ -2456,7 +2459,7 @@
curAmmoType = GetCurAmmoType()
end
- if (curAmmoType ~= amGirder) and (curAmmoType ~= amRubber) and (curAmmoType ~= amAirAttack) then
+ if (curAmmoType ~= amGirder) and (curAmmoType ~= amRubber) and (curAmmoType ~= amCMGearPlacementTool) then
if not hedgeEditorMissionPanelShown then
showHedgeEditorMissionPanel()
@@ -2555,7 +2558,7 @@
loc("Change Placement Mode: [Up], [Down]") .. "|" ..
loc("Toggle Help: [Precise]+[1]") .. "|" ..
loc("Toggle Gear Information: [Precise]+[3]") .. "|" ..
- "", -amAirAttack, 60000
+ "", -amCMGearPlacementTool, 60000
)
hedgeEditorMissionPanelShown = false
@@ -2675,7 +2678,7 @@
loc("Change Placement Mode: [Up], [Down]") .. "|" ..
loc("Toggle Help: [Precise]+[1]") .. "|" ..
loc("Toggle Gear Information: [Precise]+[3]") .. "|" ..
- "", -amAirAttack, 60000
+ "", -amCMGearPlacementTool, 60000
)
hedgeEditorMissionPanelShown = false
@@ -2717,7 +2720,7 @@
loc("Change Placement Mode: [Up], [Down]") .. "|" ..
loc("Toggle Help: [Precise]+[1]") .. "|" ..
loc("Toggle Gear Information: [Precise]+[3]") .. "|" ..
- "", -amAirAttack, 60000
+ "", -amCMGearPlacementTool, 60000
)
hedgeEditorMissionPanelShown = false
@@ -2813,7 +2816,7 @@
xDisplacement = 42
yDisplacement = 42
- if (curWep == amAirAttack) then
+ if (curWep == amCMGearPlacementTool) then
--wowaweewa, holyeeeee shite this is badly hacked (please rewrite when less lazy/morefeatures)
dCol = 0xFFFFFFFF
@@ -2846,7 +2849,7 @@
elseif (cat[cIndex] == loc("Sprite Placement Mode")) then
dSprite = reducedSpriteIDArray[pIndex]
dFrame = sFrame
- if ((dSprite == sprAMAmmos) or (dSprite == sprAMAmmosBW)) and (dFrame == (amAirAttack - 1)) then
+ if ((dSprite == sprAMAmmos) or (dSprite == sprAMAmmosBW)) and (dFrame == (amCMGearPlacementTool - 1)) then
-- Special case: Air attack icon of ammos sprite needs to be fixed (since this icon is overwritten)
dFrame = ammoFrameAirAttack
end
@@ -2929,7 +2932,7 @@
end
-- update display selection criteria
- if (curWep == amGirder) or (curWep == amRubber) or (curWep == amAirAttack) then
+ if (curWep == amGirder) or (curWep == amRubber) or (curWep == amCMGearPlacementTool) then
AddCaption(cat[cIndex],0xffba00ff,capgrpMessage)
showSecondaryMessage()
if superDelete == true then
@@ -2978,7 +2981,7 @@
x,y = GetGearTarget(cGear)
- if GetGearType(cGear) == gtAirAttack and GetCurAmmoType() == amAirAttack then
+ if GetGearType(cGear) == gtAirAttack and GetCurAmmoType() == amCMGearPlacementTool then
DeleteGear(cGear)
PlaceObject(x, y)
elseif GetGearType(cGear) == gtGirder then
@@ -3124,7 +3127,7 @@
if (commandMode() == true) and (s == 4) then
SaveLevelData() -- positions of crates, etc
elseif (commandMode() == true) and (s == 2) then
- if GetAmmoCount(CurrentHedgehog, amAirAttack) == 100 then
+ if GetAmmoCount(CurrentHedgehog, amCMGearPlacementTool) == 100 then
SetEditingWeps(0)
AddCaption(loc("The editor weapons and tools have been removed!"))
else
@@ -3229,7 +3232,7 @@
---------------------------------------------------------------
function onLeft()
- if (curWep == amAirAttack) then
+ if (curWep == amCMGearPlacementTool) then
leftHeld = true
rightHeld = false
@@ -3249,7 +3252,7 @@
sFrame = math.min(sFrame, reducedSpriteIDArrayFrames[pIndex] - 1)
end
- if (curWep == amGirder) or (curWep == amRubber) or (curWep == amAirAttack) then
+ if (curWep == amGirder) or (curWep == amRubber) or (curWep == amCMGearPlacementTool) then
showSecondaryMessage()
end
end
@@ -3259,7 +3262,7 @@
function onRight()
- if (curWep == amAirAttack) then
+ if (curWep == amCMGearPlacementTool) then
leftHeld = false
rightHeld = true
@@ -3279,7 +3282,7 @@
sFrame = math.min(sFrame, reducedSpriteIDArrayFrames[pIndex] - 1)
end
- if (curWep == amGirder) or (curWep == amRubber) or (curWep == amAirAttack) then
+ if (curWep == amGirder) or (curWep == amRubber) or (curWep == amCMGearPlacementTool) then
showSecondaryMessage()
end
end
@@ -3294,7 +3297,7 @@
---------------------------------------------------------
function onUp()
- if (curWep == amAirAttack) then
+ if (curWep == amCMGearPlacementTool) then
cIndex = cIndex - 1
if (cIndex == 1) or (cIndex == 2) then --1 --we no longer hit girder by normal means
cIndex = #cat
@@ -3309,7 +3312,7 @@
function onDown()
- if (curWep == amAirAttack) then
+ if (curWep == amCMGearPlacementTool) then
cIndex = cIndex + 1
if cIndex > #cat then
cIndex = 3 -- 2 ----we no longer hit girder by normal means
@@ -3403,7 +3406,7 @@
, 4, 5000
)
- SetAmmoTexts(amAirAttack,
+ SetAmmoTexts(amCMGearPlacementTool,
loc("Gear Placement Tool"),
loc("HedgeEditor tool"),
loc("Place, modify and delete gears (e.g. objects)|and waypoints, edit hedgehog settings, values,|victory conditions, and more.") .. "|" ..
@@ -3436,7 +3439,7 @@
sSprite = AddVisualGear(0, 0, vgtStraightShot, 0, true,1)
SetVisualGearValues(sSprite, 1, 1, 0, 0, nil, frameID, 20000, visualSprite, 20000, 0 )
- SetAmmoDelay(amAirAttack,0)
+ SetAmmoDelay(amCMGearPlacementTool,0)
SetAmmoDelay(amGirder,0)
SetAmmoDelay(amRubber,0)
@@ -3444,7 +3447,7 @@
function SetEditingWeps(ammoCount)
- AddAmmo(CurrentHedgehog, amAirAttack, ammoCount)
+ AddAmmo(CurrentHedgehog, amCMGearPlacementTool, ammoCount)
AddAmmo(CurrentHedgehog, amGirder, ammoCount)
AddAmmo(CurrentHedgehog, amRubber, ammoCount)
AddAmmo(CurrentHedgehog, amTeleport, ammoCount)
@@ -3725,7 +3728,7 @@
end
end
- if (GetGearType(gear) == gtAirAttack and GetCurAmmoType() == amAirAttack) or (GetGearType(gear) == gtGirder) then
+ if (GetGearType(gear) == gtAirAttack and GetCurAmmoType() == amCMGearPlacementTool) or (GetGearType(gear) == gtGirder) then
cGear = gear
end