diff --git a/src/gamedata/p_terrain.cpp b/src/gamedata/p_terrain.cpp index f8f89eec94..8472b1fab3 100644 --- a/src/gamedata/p_terrain.cpp +++ b/src/gamedata/p_terrain.cpp @@ -185,6 +185,7 @@ static const char *TerrainKeywords[] = "liquid", "friction", "allowprotection", + "damageonland", NULL }; @@ -220,6 +221,7 @@ static FGenericParse TerrainParser[] = { GEN_Bool, {myoffsetof(FTerrainDef, IsLiquid)} }, { GEN_Custom, {(size_t)ParseFriction} }, { GEN_Bool, {myoffsetof(FTerrainDef, AllowProtection)} }, + { GEN_Bool, {myoffsetof(FTerrainDef, DamageOnLand)} }, }; @@ -734,5 +736,6 @@ DEFINE_FIELD(FTerrainDef, LeftStepSound) DEFINE_FIELD(FTerrainDef, RightStepSound) DEFINE_FIELD(FTerrainDef, IsLiquid) DEFINE_FIELD(FTerrainDef, AllowProtection) +DEFINE_FIELD(FTerrainDef, DamageOnLand) DEFINE_FIELD(FTerrainDef, Friction) DEFINE_FIELD(FTerrainDef, MoveFactor) diff --git a/src/gamedata/p_terrain.h b/src/gamedata/p_terrain.h index 5bf6342e87..f041ef7a66 100644 --- a/src/gamedata/p_terrain.h +++ b/src/gamedata/p_terrain.h @@ -115,6 +115,7 @@ struct FTerrainDef FSoundID RightStepSound; bool IsLiquid; bool AllowProtection; + bool DamageOnLand; double Friction; double MoveFactor; }; diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index ab0c296283..00f1feb645 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -6043,6 +6043,13 @@ foundone: if (splashnum == -1) return Terrains[terrainnum].IsLiquid; + const bool dealDamageOnLand = thing->player + && Terrains[terrainnum].DamageOnLand + && Terrains[terrainnum].DamageAmount + && (thing->Level->time & Terrains[terrainnum].DamageTimeMask); + if (dealDamageOnLand) + P_DamageMobj(thing, nullptr, nullptr, Terrains[terrainnum].DamageAmount, Terrains[terrainnum].DamageMOD); + // don't splash when touching an underwater floor if (thing->waterlevel >= 1 && pos.Z <= thing->floorz) return Terrains[terrainnum].IsLiquid; diff --git a/wadsrc/static/terrain.txt b/wadsrc/static/terrain.txt index c59f5a0418..3cb5ea9784 100644 --- a/wadsrc/static/terrain.txt +++ b/wadsrc/static/terrain.txt @@ -143,6 +143,7 @@ terrain Lava damageamount 5 damagetype lava damagetimemask 31 + damageonland } terrain Ice diff --git a/wadsrc/static/zscript/base.zs b/wadsrc/static/zscript/base.zs index e3d4c0a32d..48e66b05eb 100644 --- a/wadsrc/static/zscript/base.zs +++ b/wadsrc/static/zscript/base.zs @@ -895,6 +895,7 @@ struct TerrainDef native native Sound RightStepSound; native bool IsLiquid; native bool AllowProtection; + native bool DamageOnLand; native double Friction; native double MoveFactor; };