NSVehicle: add two new overridable methods. (bool)PreventPlayerMovement and (bool)PreventPlayerFire
This commit is contained in:
parent
04fe295035
commit
30a482e80e
|
@ -41,6 +41,15 @@ Game_Input(player pl)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSVehicle veh = (NSVehicle)pl.vehicle;
|
||||||
|
bool canfire = true;
|
||||||
|
if (veh)
|
||||||
|
if (veh.PreventPlayerFire() == true)
|
||||||
|
canfire = false;
|
||||||
|
|
||||||
|
if (canfire == false)
|
||||||
|
return;
|
||||||
|
|
||||||
if (input_buttons & INPUT_BUTTON0)
|
if (input_buttons & INPUT_BUTTON0)
|
||||||
Weapons_Primary(pl);
|
Weapons_Primary(pl);
|
||||||
else if (input_buttons & INPUT_BUTTON4)
|
else if (input_buttons & INPUT_BUTTON4)
|
||||||
|
|
|
@ -63,6 +63,8 @@ class NSVehicle:NSSurfacePropEntity
|
||||||
virtual float(void) DriverAnimation;
|
virtual float(void) DriverAnimation;
|
||||||
|
|
||||||
virtual bool(void) CanDriverCrouch;
|
virtual bool(void) CanDriverCrouch;
|
||||||
|
virtual bool(void) PreventPlayerMovement;
|
||||||
|
virtual bool(void) PreventPlayerFire;
|
||||||
};
|
};
|
||||||
|
|
||||||
enumflags
|
enumflags
|
||||||
|
|
|
@ -77,6 +77,18 @@ NSVehicle::CanDriverCrouch(void)
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
NSVehicle::PreventPlayerMovement(void)
|
||||||
|
{
|
||||||
|
return (true);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
NSVehicle::PreventPlayerFire(void)
|
||||||
|
{
|
||||||
|
return (true);
|
||||||
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
NSVehicle::DriverAnimation(void)
|
NSVehicle::DriverAnimation(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -308,6 +308,7 @@ void
|
||||||
NSClientPlayer::Physics_InputPreMove(void)
|
NSClientPlayer::Physics_InputPreMove(void)
|
||||||
{
|
{
|
||||||
NSVehicle veh = (NSVehicle)vehicle;
|
NSVehicle veh = (NSVehicle)vehicle;
|
||||||
|
bool canmove = true;
|
||||||
|
|
||||||
/* when pressing the 'use' button, we also walk slower for precision */
|
/* when pressing the 'use' button, we also walk slower for precision */
|
||||||
if (input_buttons & INPUT_BUTTON5) {
|
if (input_buttons & INPUT_BUTTON5) {
|
||||||
|
@ -327,7 +328,16 @@ NSClientPlayer::Physics_InputPreMove(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & FL_FROZEN || movetype == MOVETYPE_NONE) {
|
/* find all the valid ways to freeze a player... */
|
||||||
|
if (veh)
|
||||||
|
if (veh.PreventPlayerMovement() == true)
|
||||||
|
canmove = false;
|
||||||
|
|
||||||
|
if (flags & FL_FROZEN || movetype == MOVETYPE_NONE)
|
||||||
|
canmove = false;
|
||||||
|
|
||||||
|
/* freeze in place */
|
||||||
|
if (canmove == false) {
|
||||||
input_movevalues = [0,0,0];
|
input_movevalues = [0,0,0];
|
||||||
input_buttons &= ~INPUT_BUTTON2;
|
input_buttons &= ~INPUT_BUTTON2;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue