Fixes #5 by implementing func_pushable
This commit is contained in:
parent
be02bb696d
commit
e8edad9fc4
6 changed files with 76 additions and 21 deletions
|
@ -150,6 +150,23 @@ void func_breakable_touch( void ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void func_breakable_respawn( void ) {
|
||||||
|
if ( self.spawnflags & SF_TRIGGER ) {
|
||||||
|
self.takedamage = DAMAGE_NO;
|
||||||
|
} else {
|
||||||
|
self.takedamage = DAMAGE_YES;
|
||||||
|
self.vPain = func_breakable_pain;
|
||||||
|
self.vDeath = func_breakable_die;
|
||||||
|
self.iBleeds = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( self.spawnflags & SF_TOUCH || self.spawnflags & SF_PRESSURE ) {
|
||||||
|
self.touch = func_breakable_touch;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.vUse = func_breakable_use;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
SPAWN: func_breakable
|
SPAWN: func_breakable
|
||||||
|
@ -158,23 +175,6 @@ Entry function for the brushes that can die etc.
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void func_breakable( void ) {
|
void func_breakable( void ) {
|
||||||
static void func_breakable_respawn( void ) {
|
|
||||||
if ( self.spawnflags & SF_TRIGGER ) {
|
|
||||||
self.takedamage = DAMAGE_NO;
|
|
||||||
} else {
|
|
||||||
self.takedamage = DAMAGE_YES;
|
|
||||||
self.vPain = func_breakable_pain;
|
|
||||||
self.vDeath = func_breakable_die;
|
|
||||||
self.iBleeds = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( self.spawnflags & SF_TOUCH || self.spawnflags & SF_PRESSURE ) {
|
|
||||||
self.touch = func_breakable_touch;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.vUse = func_breakable_use;
|
|
||||||
}
|
|
||||||
|
|
||||||
func_wall();
|
func_wall();
|
||||||
func_breakable_respawn();
|
func_breakable_respawn();
|
||||||
|
|
||||||
|
|
54
Source/Server/FuncPushable.c
Normal file
54
Source/Server/FuncPushable.c
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
OpenCS Project
|
||||||
|
Copyright (C) 2016, 2017 Marco "eukara" Hladik
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void func_pushable( void ) {
|
||||||
|
static void func_pushable_touch( void ) {
|
||||||
|
if ( other.classname == "player" ) {
|
||||||
|
func_breakable_touch();
|
||||||
|
self.movedir = other.movement;
|
||||||
|
self.v_angle = other.angles;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void func_pushable_use( void ) {
|
||||||
|
self.movedir = eActivator.movement;
|
||||||
|
self.v_angle = eActivator.angles;
|
||||||
|
}
|
||||||
|
static void func_pushable_physics( void ) {
|
||||||
|
input_movevalues = [ self.movedir_x, self.movedir_y, 0 ];
|
||||||
|
input_impulse = input_buttons = 0;
|
||||||
|
input_angles = self.v_angle;
|
||||||
|
self.movedir = '0 0 0';
|
||||||
|
runstandardplayerphysics( self );
|
||||||
|
}
|
||||||
|
static void func_pushable_respawn( void ) {
|
||||||
|
func_breakable_respawn();
|
||||||
|
self.iUsable = TRUE;
|
||||||
|
self.solid = SOLID_SLIDEBOX;
|
||||||
|
self.movetype = MOVETYPE_WALK;
|
||||||
|
self.customphysics = func_pushable_physics;
|
||||||
|
self.touch = func_pushable_touch;
|
||||||
|
self.vUse = func_pushable_use;
|
||||||
|
}
|
||||||
|
|
||||||
|
func_wall();
|
||||||
|
func_pushable_respawn();
|
||||||
|
|
||||||
|
Entities_InitRespawnable( func_pushable_respawn );
|
||||||
|
}
|
|
@ -219,7 +219,7 @@ void Player_UseDown( void ) {
|
||||||
traceline ( vSource, vSource + ( v_forward * 64 ), FALSE, self);
|
traceline ( vSource, vSource + ( v_forward * 64 ), FALSE, self);
|
||||||
|
|
||||||
if ( trace_ent.iUsable ) {
|
if ( trace_ent.iUsable ) {
|
||||||
if ( trace_ent.classname != "c4bomb" ) {
|
if ( ( trace_ent.classname != "c4bomb" ) && ( trace_ent.classname != "func_pushable" ) ) {
|
||||||
self.flags = ( self.flags - FL_USERELEASED );
|
self.flags = ( self.flags - FL_USERELEASED );
|
||||||
sound( self, CHAN_WEAPON, "common/wpn_select.wav", 0.25, ATTN_IDLE );
|
sound( self, CHAN_WEAPON, "common/wpn_select.wav", 0.25, ATTN_IDLE );
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ Entities.c
|
||||||
Triggers.c
|
Triggers.c
|
||||||
EnvObjects.c
|
EnvObjects.c
|
||||||
FuncBreakable.c
|
FuncBreakable.c
|
||||||
|
FuncPushable.c
|
||||||
FuncLadder.c
|
FuncLadder.c
|
||||||
FuncHostageRescue.c
|
FuncHostageRescue.c
|
||||||
FuncVIPSafetyZone.c
|
FuncVIPSafetyZone.c
|
||||||
|
|
|
@ -101,9 +101,9 @@ void WeaponC4BOMB_Drop( vector vBombPos ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void C4BombUse( void ) {
|
static void C4BombUse( void ) {
|
||||||
/*if ( eActivator.team != TEAM_CT ) {
|
if ( eActivator.team != TEAM_CT ) {
|
||||||
return;
|
return;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
// On first use, play defusing sound
|
// On first use, play defusing sound
|
||||||
if ( self.eUser == world ) {
|
if ( self.eUser == world ) {
|
||||||
|
@ -121,7 +121,7 @@ void WeaponC4BOMB_Drop( vector vBombPos ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the user has for the right equipment, make 10 seconds pass twice as fast
|
// If the user has the right equipment, make 10 seconds pass twice as fast
|
||||||
if ( eActivator.iEquipment & EQUIPMENT_DEFUSALKIT ) {
|
if ( eActivator.iEquipment & EQUIPMENT_DEFUSALKIT ) {
|
||||||
fDefuseProgress += ( frametime * 2 );
|
fDefuseProgress += ( frametime * 2 );
|
||||||
} else {
|
} else {
|
||||||
|
|
BIN
opencs/progs.dat
BIN
opencs/progs.dat
Binary file not shown.
Loading…
Reference in a new issue