# HG changeset patch # User Wuzzy # Date 1554738273 -7200 # Node ID 0ee6b01c7f3028921ca7d76a5002c96659076644 # Parent dd4daa216398e4061e7f38a9b7fa20b409f27933 WxW: If walls are disabled, spawn crate between turns diff -r dd4daa216398 -r 0ee6b01c7f30 share/hedgewars/Data/Scripts/Multiplayer/WxW.lua --- a/share/hedgewars/Data/Scripts/Multiplayer/WxW.lua Mon Apr 08 16:00:15 2019 +0200 +++ b/share/hedgewars/Data/Scripts/Multiplayer/WxW.lua Mon Apr 08 17:44:33 2019 +0200 @@ -848,6 +848,13 @@ end +function onCaseDrop() + if roundN == 100 then + allowCrate = crateGearsInGame < maxCrates + CheckCrateConditions() + end +end + function CheckCrateConditions() local crateSpawn = AreCratesUnlocked() @@ -935,6 +942,9 @@ function HandleBorderEffects() + if band(GetState(CurrentHedgehog), gstHHDriven) == 0 then + return + end effectTimer = effectTimer + 1 if effectTimer > 15 then --25 @@ -1269,6 +1279,17 @@ end end +function onEndTurn() + crateSpawned = false + crateCollected = false + wallsLeft = #wTouched + for i = 1, #wTouched do + wTouched[i] = false + end + hasSurfed = false + allWallsHit = false +end + function onNewTurn() turnsCount = turnsCount + 1 @@ -1290,20 +1311,7 @@ end end - wallsLeft = #wTouched - - for i = 1, #wTouched do - wTouched[i] = false - end - - hasSurfed = false - allWallsHit = false - crateCollected = false - - crateSpawned = false - if roundN == 100 then - allowCrate = crateGearsInGame < maxCrates local teamName = GetHogTeamName(CurrentHedgehog) @@ -1332,8 +1340,6 @@ setTeamValue(teamName, "skipPenalty", false) end - else - allowCrate = false end if roundN == 1 then @@ -1574,7 +1580,9 @@ if roundN == 100 then CheckForWallCollision() - CheckCrateConditions() + if band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 then + CheckCrateConditions() + end if (GetGearType(GetFollowGear()) == gtCase) then FollowGear(CurrentHedgehog)