# HG changeset patch # User Wuzzy # Date 1546722320 -3600 # Node ID d0441c7e90008f2b081445835c16dc7f4c2c30ab # Parent 8a11548cb1d2992cdd15ddda2ccd378ef0237a08 Lua: Add InitHealth, read-only variable containing the initial hog health setting diff -r 8a11548cb1d2 -r d0441c7e9000 ChangeLog.txt --- a/ChangeLog.txt Sat Jan 05 21:52:15 2019 +0100 +++ b/ChangeLog.txt Sat Jan 05 22:05:20 2019 +0100 @@ -36,6 +36,7 @@ + SimpleMission: Add isMissionTeam attribute for teams + SpeedShoppa/TargetPractice libraries: Remove custom hog and team info settings + Params explode, poison in the SpawnFake*Crate functions now optional and default to false + + New global: InitHealth: Initial hog health value from game scheme (read-only) ====================== 0.9.25 ====================== HIGHLIGHTS: diff -r 8a11548cb1d2 -r d0441c7e9000 QTfrontend/ui/widget/gamecfgwidget.cpp --- a/QTfrontend/ui/widget/gamecfgwidget.cpp Sat Jan 05 21:52:15 2019 +0100 +++ b/QTfrontend/ui/widget/gamecfgwidget.cpp Sat Jan 05 22:05:20 2019 +0100 @@ -336,6 +336,7 @@ bcfg << QString("e$gmflags %1").arg(getGameFlags()).toUtf8(); bcfg << QString("e$damagepct %1").arg(schemeData(26).toInt()).toUtf8(); bcfg << QString("e$turntime %1").arg(schemeData(27).toInt() * 1000).toUtf8(); + bcfg << QString("e$inithealth %1").arg(schemeData(28).toInt()).toUtf8(); bcfg << QString("e$sd_turns %1").arg(schemeData(29).toInt()).toUtf8(); bcfg << QString("e$casefreq %1").arg(schemeData(30).toInt()).toUtf8(); bcfg << QString("e$minestime %1").arg(schemeData(31).toInt() * 1000).toUtf8(); diff -r 8a11548cb1d2 -r d0441c7e9000 hedgewars/uCommandHandlers.pas --- a/hedgewars/uCommandHandlers.pas Sat Jan 05 21:52:15 2019 +0100 +++ b/hedgewars/uCommandHandlers.pas Sat Jan 05 22:05:20 2019 +0100 @@ -785,6 +785,11 @@ cHealthDecrease:= StrToInt(s) end; +procedure chInitHealth(var s: shortstring); +begin +cInitHealth:= StrToInt(s) +end; + procedure chDamagePercent(var s: shortstring); begin cDamagePercent:= StrToInt(s) @@ -926,6 +931,7 @@ RegisterVariable('sd_turns', @chSuddenDTurns , false); RegisterVariable('waterrise', @chWaterRise , false); RegisterVariable('healthdec', @chHealthDecrease, false); + RegisterVariable('inithealth',@chInitHealth, false); RegisterVariable('damagepct',@chDamagePercent , false); RegisterVariable('ropepct' , @chRopePercent , false); RegisterVariable('getawaytime' , @chGetAwayTime , false); diff -r 8a11548cb1d2 -r d0441c7e9000 hedgewars/uScript.pas --- a/hedgewars/uScript.pas Sat Jan 05 21:52:15 2019 +0100 +++ b/hedgewars/uScript.pas Sat Jan 05 22:05:20 2019 +0100 @@ -3614,6 +3614,7 @@ ScriptSetInteger('MaxCaseDrops', cMaxCaseDrops); ScriptSetInteger('HealthCaseProb', cHealthCaseProb); ScriptSetInteger('HealthCaseAmount', cHealthCaseAmount); +ScriptSetInteger('InitHealth', cInitHealth); ScriptSetInteger('DamagePercent', cDamagePercent); ScriptSetInteger('RopePercent', cRopePercent); ScriptSetInteger('MinesNum', cLandMines); @@ -3647,6 +3648,7 @@ cMaxCaseDrops := ScriptGetInteger('MaxCaseDrops'); cHealthCaseProb := ScriptGetInteger('HealthCaseProb'); cHealthCaseAmount:= ScriptGetInteger('HealthCaseAmount'); +cInitHealth := ScriptGetInteger('InitHealth'); cDamagePercent := ScriptGetInteger('DamagePercent'); cRopePercent := ScriptGetInteger('RopePercent'); cLandMines := ScriptGetInteger('MinesNum'); diff -r 8a11548cb1d2 -r d0441c7e9000 hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Sat Jan 05 21:52:15 2019 +0100 +++ b/hedgewars/uVariables.pas Sat Jan 05 22:05:20 2019 +0100 @@ -106,6 +106,8 @@ GameOver : boolean; cSuddenDTurns : LongInt; LastSuddenDWarn : LongInt; // last round in which the last SD warning appeared. -2 = no warning so far + cInitHealth : LongInt; // initial hedgehog health (from game scheme. note the real hog health is sent directly + // from frontend, this is only used to inform Lua scripts) cDamagePercent : LongInt; cMineDudPercent : LongWord; cTemplateFilter : LongInt; @@ -2806,6 +2808,7 @@ TagTurnTimeLeft := 0; cSuddenDTurns := 15; LastSuddenDWarn := -2; + cInitHealth := 100; cDamagePercent := 100; cRopePercent := 100; cGetAwayTime := 100;