diff --git a/src/cvars.cpp b/src/cvars.cpp index bdfa4599a..bcfedba5c 100644 --- a/src/cvars.cpp +++ b/src/cvars.cpp @@ -803,6 +803,7 @@ consvar_t cv_restrictskinchange = OnlineCheat("restrictskinchange", "Yes").yes_n consvar_t cv_spbtest = OnlineCheat("spbtest", "Off").on_off().description("SPB can never target a player"); consvar_t cv_timescale = OnlineCheat(cvlist_timer)("timescale", "1.0").floating_point().min_max(FRACUNIT/20, 20*FRACUNIT).description("Overclock or slow down the game"); consvar_t cv_ufo_follow = OnlineCheat("ufo_follow", "0").min_max(0, MAXPLAYERS).description("Make UFO Catcher folow this player"); +consvar_t cv_ufo_health = OnlineCheat("ufo_health", "100").min_max(0, 100).description("Override UFO Catcher health -- applied at spawn or when value is changed"); // diff --git a/src/objects/ufo.c b/src/objects/ufo.c index de45c0361..aa976f4d9 100644 --- a/src/objects/ufo.c +++ b/src/objects/ufo.c @@ -552,8 +552,34 @@ static void UFOUpdateSound(mobj_t *ufo) { } } +static void UFODebugSetHealth(mobj_t *ufo, UINT8 health) +{ + if (ufo->health == health + 1 || UFOEmeraldChase(ufo) == true) + { + return; + } + + extern consvar_t cv_ufo_follow; + + UINT8 pnum = max(1, cv_ufo_follow.value) - 1; + mobj_t *source = players[pnum].mo; + + if (playeringame[pnum] == false || P_MobjWasRemoved(source) == true) + { + return; + } + + ufo->health = health + 2; + Obj_SpecialUFODamage(ufo, ufo, source, DMG_NORMAL); // does 1 damage, updates pieces +} + void Obj_SpecialUFOThinker(mobj_t *ufo) { + { + extern consvar_t cv_ufo_health; + UFODebugSetHealth(ufo, cv_ufo_health.value); + } + UFOMove(ufo); UFOUpdateAngle(ufo); UFOUpdateDistanceToFinish(ufo); @@ -773,6 +799,11 @@ static UINT8 GetUFODamage(mobj_t *inflictor, UINT8 damageType) // Players deal damage relative to how many sneakers they used. return 15 * max(1, inflictor->player->numsneakers); } + case MT_SPECIAL_UFO: + { + // UFODebugSetHealth + return 1; + } default: { break;