Added multi_manager ( Fixes #6 )

Added multisource
This commit is contained in:
Marco Cawthorne 2017-01-09 22:07:23 +01:00
parent e8edad9fc4
commit f8c0518292
5 changed files with 58 additions and 9 deletions

View file

@ -61,6 +61,7 @@ void Entities_UseTargets( void ) {
entity eOld = self; entity eOld = self;
while ( eFind ) { while ( eFind ) {
self = eFind; self = eFind;
bprint( sprintf( "Triggering %s %s\n", self.classname, self.targetname ) );
self.vUse(); self.vUse();
eFind = eFind.chain; eFind = eFind.chain;
} }

View file

@ -115,7 +115,7 @@ void func_breakable_die( int iNull ) {
Entities_Remove(); Entities_Remove();
} }
static void func_breakable_use( void ) { void func_breakable_use( void ) {
func_breakable_die( 0 ); func_breakable_die( 0 );
} }
@ -139,7 +139,7 @@ void func_breakable_touch( void ) {
} }
} }
if ( ( self.spawnflags & SF_PRESSURE ) && other.absmin_z >= self.maxs_z - 2 ) { if ( ( self.spawnflags & SF_PRESSURE ) && ( other.absmin_z >= self.maxs_z - 2 ) ) {
self.think = func_breakable_use; self.think = func_breakable_use;
if ( self.delay == 0 ) { if ( self.delay == 0 ) {
@ -160,7 +160,7 @@ void func_breakable_respawn( void ) {
self.iBleeds = FALSE; self.iBleeds = FALSE;
} }
if ( self.spawnflags & SF_TOUCH || self.spawnflags & SF_PRESSURE ) { if ( ( self.spawnflags & SF_TOUCH ) || ( self.spawnflags & SF_PRESSURE ) ) {
self.touch = func_breakable_touch; self.touch = func_breakable_touch;
} }

View file

@ -18,15 +18,32 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
/*
=================
SPAWN: func_pushable
Entry function for the brushes that players can push.
Pushables are an extension of breakables, so they mostly
explain themselves.
=================
*/
void func_pushable( void ) { void func_pushable( void ) {
static void func_pushable_touch( void ) { static void func_pushable_touch( void ) {
if ( other.classname == "player" ) { if ( other.classname == "player" ) {
func_breakable_touch(); func_breakable_touch();
self.movedir = other.movement;
self.v_angle = other.angles; if ( other.absmin_z <= self.maxs_z - 2 ) {
} self.movedir = other.movement;
self.v_angle = other.angles;
}
}
} }
static void func_pushable_use( void ) { static void func_pushable_use( void ) {
if ( eActivator.classname != "player" ) {
func_breakable_use();
return;
}
self.movedir = eActivator.movement; self.movedir = eActivator.movement;
self.v_angle = eActivator.angles; self.v_angle = eActivator.angles;
} }
@ -35,16 +52,18 @@ void func_pushable( void ) {
input_impulse = input_buttons = 0; input_impulse = input_buttons = 0;
input_angles = self.v_angle; input_angles = self.v_angle;
self.movedir = '0 0 0'; self.movedir = '0 0 0';
runstandardplayerphysics( self ); runstandardplayerphysics( self );
} }
static void func_pushable_respawn( void ) { static void func_pushable_respawn( void ) {
func_breakable_respawn(); func_breakable_respawn();
self.iUsable = TRUE;
self.solid = SOLID_SLIDEBOX; self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_WALK; self.movetype = MOVETYPE_WALK;
self.customphysics = func_pushable_physics; self.customphysics = func_pushable_physics;
self.touch = func_pushable_touch; self.touch = func_pushable_touch;
self.vUse = func_pushable_use; self.vUse = func_pushable_use;
self.iUsable = TRUE;
} }
func_wall(); func_wall();

View file

@ -190,7 +190,7 @@ Attributes:
Name (targetname) - Property used to identify entities. Name (targetname) - Property used to identify entities.
Flags: Flags:
Multithreaded (1) - See notes below for an explanation. Multithreaded (1)
Notes: Notes:
There were better ways to do this, but someone thought it was viable to use custom, user defined fields There were better ways to do this, but someone thought it was viable to use custom, user defined fields
@ -201,10 +201,39 @@ TODO: Try to find out what garbled mess __fullspawndata is trying to give us
================= =================
*/ */
void multi_manager( void ) { void multi_manager( void ) {
static void multi_manager_enttrigger( void ) {
Entities_UseTargets();
remove( self );
}
static void multi_manager_use( void ) { static void multi_manager_use( void ) {
eprint( self ); int iFields = tokenize( self.message );
for ( int i = 1; i < ( iFields - 1 ); i += 2 ) {
// Sigh, let's attempt to sanitize this
if ( ( argv( i ) != "classname" ) && ( argv( i ) != "origin" ) && ( argv( i ) != "targetname" ) ) {
entity eTemp = spawn();
eTemp.target = argv( i );
eTemp.think = multi_manager_enttrigger;
eTemp.nextthink = time + stof( argv( i + 1 ) );
}
}
} }
self.message = __fullspawndata; self.message = __fullspawndata;
self.vUse = multi_manager_use; self.vUse = multi_manager_use;
} }
/*
=================
multisource
TODO: State crap
=================
*/
void multisource( void ) {
static void multisource_use( void ) {
Entities_UseTargets();
}
self.vUse = multisource_use;
}

Binary file not shown.