mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
Add a cvar g_commanderbody_nogod
to make the com. body destructable.
The commanders body entity is special, because it's spawned in god mode. That's no problem in the baseq2 and addons campaigns. But it may break some custom maps and prevents some hacks, one example is putting the entity inside an killbox. Submitted by Евгений T.
This commit is contained in:
parent
635f6ffb16
commit
ee945625d3
7 changed files with 55 additions and 1 deletions
|
@ -138,6 +138,10 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable`
|
|||
disable it again before playing Ground Zero maps in co-op. By
|
||||
default this cvar is disabled (set to 0).
|
||||
|
||||
* **g_commanderbody_nogod**: If set to `1` the tank commanders body
|
||||
entity can be destroyed. If the to `0` (the default) it is
|
||||
indestructible.
|
||||
|
||||
* **g_footsteps**: If set to `1` (the default) footstep sounds are
|
||||
generated when the player faster than 255. This is the behaviour of
|
||||
Vanilla Quake II. If set to `2` footestep sound always generated. If
|
||||
|
|
|
@ -56,6 +56,7 @@ cvar_t *g_select_empty;
|
|||
cvar_t *dedicated;
|
||||
cvar_t *g_footsteps;
|
||||
cvar_t *g_fix_triggered;
|
||||
cvar_t *g_commanderbody_nogod;
|
||||
|
||||
cvar_t *filterban;
|
||||
|
||||
|
|
|
@ -1610,6 +1610,40 @@ commander_body_drop(edict_t *self)
|
|||
self->s.origin[2] += 2;
|
||||
}
|
||||
|
||||
void
|
||||
commander_body_die(edict_t *self, edict_t *inflictor /* unused */,
|
||||
edict_t *attacker /* unused */, int damage, vec3_t point /* unused */)
|
||||
{
|
||||
int n;
|
||||
|
||||
if (!self)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* check for gib */
|
||||
if (self->health <= self->gib_health)
|
||||
{
|
||||
gi.sound(self, CHAN_BODY, gi.soundindex("tank/pain.wav"), 1, ATTN_NORM, 0);
|
||||
|
||||
for (n = 0; n < 1; n++)
|
||||
{
|
||||
ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC);
|
||||
}
|
||||
|
||||
for (n = 0; n < 4; n++)
|
||||
{
|
||||
ThrowGib(self, "models/objects/gibs/sm_metal/tris.md2", damage, GIB_METALLIC);
|
||||
}
|
||||
|
||||
ThrowGib(self, "models/objects/gibs/chest/tris.md2", damage, GIB_ORGANIC);
|
||||
ThrowHead(self, "models/objects/gibs/gear/tris.md2", damage, GIB_METALLIC);
|
||||
self->deadflag = DEAD_DEAD;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SP_monster_commander_body(edict_t *self)
|
||||
{
|
||||
|
@ -1626,8 +1660,19 @@ SP_monster_commander_body(edict_t *self)
|
|||
VectorSet(self->maxs, 32, 32, 48);
|
||||
self->use = commander_body_use;
|
||||
self->takedamage = DAMAGE_YES;
|
||||
self->flags = FL_GODMODE;
|
||||
self->s.renderfx |= RF_FRAMELERP;
|
||||
|
||||
if (g_commanderbody_nogod->value)
|
||||
{
|
||||
self->deadflag = DEAD_DEAD;
|
||||
self->svflags |= SVF_MONSTER | SVF_DEADMONSTER;
|
||||
self->die = commander_body_die;
|
||||
}
|
||||
else
|
||||
{
|
||||
self->flags = FL_GODMODE;
|
||||
}
|
||||
|
||||
gi.linkentity(self);
|
||||
|
||||
gi.soundindex("tank/thud.wav");
|
||||
|
|
|
@ -521,6 +521,7 @@ extern cvar_t *g_select_empty;
|
|||
extern cvar_t *dedicated;
|
||||
extern cvar_t *g_footsteps;
|
||||
extern cvar_t *g_fix_triggered;
|
||||
extern cvar_t *g_commanderbody_nogod;
|
||||
|
||||
extern cvar_t *filterban;
|
||||
|
||||
|
|
|
@ -238,6 +238,7 @@ InitGame(void)
|
|||
maxentities = gi.cvar("maxentities", "1024", CVAR_LATCH);
|
||||
g_footsteps = gi.cvar("g_footsteps", "1", CVAR_ARCHIVE);
|
||||
g_fix_triggered = gi.cvar ("g_fix_triggered", "0", 0);
|
||||
g_commanderbody_nogod = gi.cvar("g_commanderbody_nogod", "0", CVAR_ARCHIVE);
|
||||
|
||||
/* change anytime vars */
|
||||
dmflags = gi.cvar("dmflags", "0", CVAR_SERVERINFO);
|
||||
|
|
|
@ -812,6 +812,7 @@ extern void misc_deadsoldier_die ( edict_t * self , edict_t * inflictor , edict_
|
|||
extern void SP_misc_banner ( edict_t * ent ) ;
|
||||
extern void misc_banner_think ( edict_t * ent ) ;
|
||||
extern void SP_monster_commander_body ( edict_t * self ) ;
|
||||
extern void commander_body_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ;
|
||||
extern void commander_body_drop ( edict_t * self ) ;
|
||||
extern void commander_body_use ( edict_t * self , edict_t * other , edict_t * activator ) ;
|
||||
extern void commander_body_think ( edict_t * self ) ;
|
||||
|
|
|
@ -812,6 +812,7 @@
|
|||
{"SP_misc_banner", (byte *)SP_misc_banner},
|
||||
{"misc_banner_think", (byte *)misc_banner_think},
|
||||
{"SP_monster_commander_body", (byte *)SP_monster_commander_body},
|
||||
{"commander_body_die", (byte *)commander_body_die},
|
||||
{"commander_body_drop", (byte *)commander_body_drop},
|
||||
{"commander_body_use", (byte *)commander_body_use},
|
||||
{"commander_body_think", (byte *)commander_body_think},
|
||||
|
|
Loading…
Reference in a new issue