CS: Add support for King Mode and PlaceHog
authorWuzzy <Wuzzy@disroot.org>
Wed, 28 Jun 2023 21:16:14 +0200
changeset 15999 9128bb16aaf5
parent 15998 91c487e7d11d
child 16000 a803428704fd
CS: Add support for King Mode and PlaceHog
share/hedgewars/Data/Scripts/Multiplayer/Continental_supplies.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Continental_supplies.lua	Wed Jun 28 21:14:56 2023 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Continental_supplies.lua	Wed Jun 28 21:16:14 2023 +0200
@@ -236,8 +236,27 @@
 		select_wep = ""
 		quit_hint = ""
 	end
+	local gameFlagPrepend = ""
+	local continentInfoPlace = loc("Continents: Select a continent after placing your hogs.")
+	local continentInfoNormal = loc("Continents: Select a continent at the beginning.")
+	local continentInfo = continentInfoNormal
+	if GetGameFlag(gfKing) then
+		gameFlagPrepend = gameFlagPrepend .. GetEngineString("TGoalStrId", gidKing).."|"
+		if GetGameFlag(gfPlaceHog) then
+			gameFlagPrepend = gameFlagPrepend .. GetEngineString("TGoalStrId", gidPlaceHog).."|"
+		else
+			gameFlagPrepend = gameFlagPrepend .. GetEngineString("TGoalStrId", gidPlaceKing).."|"
+		end
+		continentInfo = continentInfoPlace
+	else
+		if GetGameFlag(gfPlaceHog) then
+			gameFlagPrepend = gameFlagPrepend .. GetEngineString("TGoalStrId", gidPlaceHog).."|"
+			continentInfo = continentInfoPlace
+		end
+	end
 	local general_information =
-		loc("Continents: Select a continent at the beginning.").."|"..
+		gameFlagPrepend..
+		continentInfo.."|"..
 		loc("Supplies: Each continent gives you unique weapons, specials and health.").."|"..
 		loc("Weapon specials: Some weapons have special modes (see weapon description).")..
 		select_wep..
@@ -1145,10 +1164,14 @@
 function onGameInit()
 	SuddenDeathTurns= SuddenDeathTurns+1
 	-- Disable GameFlags that are incompatible with this game
-	DisableGameFlags(gfKing, gfPlaceHog, gfPerHogAmmo, gfSharedAmmo, gfResetWeps)
+	DisableGameFlags(gfPerHogAmmo, gfSharedAmmo, gfResetWeps)
 end
 
 function onEndTurn()
+	if(TotalRounds == -1) then
+		-- Do nothing if placing hogs
+		return
+	end
 	if(CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]==0)
 	then
 		CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=GetRandom(#CS.CONTINENT_INFORMATION)+1
@@ -1190,7 +1213,7 @@
 	SetAttackState(true)
 
 	--when all hogs are "placed"
-	if(GetCurAmmoType()~=amTeleport)
+	if(TotalRounds ~= -1)
 	then
 		--will run once when the game really starts (after placing hogs and so on
 		if(CS.INIT_TEAMS[GetHogTeamName(CurrentHedgehog)] == nil)