Add ufo_health cheat, set UFO Catcher health

This commit is contained in:
James R. 2023-09-12 03:04:51 -07:00
parent 21e8431e1a
commit d9d6a0da18
2 changed files with 32 additions and 0 deletions

View file

@ -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");
//

View file

@ -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;