Add Radius Action thing

Thing type 4096, activates its action when a player enters the specified radius
This commit is contained in:
Sally Coolatta 2023-08-26 20:28:50 -04:00
parent 9bbd850d74
commit ea7ad31fef
4 changed files with 74 additions and 0 deletions

View file

@ -5810,6 +5810,8 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t
"MT_BATTLEUFO_BEAM",
"MT_POWERUP_AURA",
"MT_SCRIPT_THING",
};
const char *const MOBJFLAG_LIST[] = {

View file

@ -30313,6 +30313,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIPHEIGHT|MF_SCENERY, // flags
S_NULL // raisestate
},
{ // MT_SCRIPT_THING
4096, // doomednum
S_INVISIBLE, // spawnstate
1000, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
0, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
0, // speed
16*FRACUNIT, // radius
16*FRACUNIT, // height
0, // display offset
0, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOCLIPTHING|MF_NOGRAVITY|MF_SCENERY, // flags
S_NULL // raisestate
},
};
skincolor_t skincolors[MAXSKINCOLORS] = {

View file

@ -7000,6 +7000,8 @@ typedef enum mobj_type
MT_POWERUP_AURA,
MT_SCRIPT_THING,
MT_FIRSTFREESLOT,
MT_LASTFREESLOT = MT_FIRSTFREESLOT + NUMMOBJFREESLOTS - 1,
NUMMOBJTYPES

View file

@ -6716,6 +6716,49 @@ static void P_MobjSceneryThink(mobj_t *mobj)
case MT_ARKARROW:
Obj_ArkArrowThink(mobj);
break;
case MT_SCRIPT_THING:
{
if (mobj->thing_args[2] != 0)
{
// turned off
break;
}
UINT8 i;
for (i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i] == false)
{
continue;
}
player_t *player = &players[i];
if (P_MobjWasRemoved(player->mo) == true)
{
continue;
}
fixed_t dist = R_PointToDist2(
mobj->x, mobj->y,
player->mo->x, player->mo->y
);
if (dist < mobj->thing_args[0] * FRACUNIT)
{
P_ActivateThingSpecial(mobj, player->mo);
if (mobj->thing_args[1] == 0)
{
P_RemoveMobj(mobj);
return;
}
break;
}
}
break;
}
case MT_VWREF:
case MT_VWREB:
{