From cb6e022bb7aadf56d4f7ebc136f652fc18fbc44e Mon Sep 17 00:00:00 2001 From: Mikko Tiusanen Date: Thu, 9 Oct 2014 17:49:05 +0300 Subject: Added spawn [buildingname] admin command. --- src/game/g_buildable.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/game/g_buildable.c') diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 37e3e66..65e7077 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -4855,6 +4855,12 @@ static void G_SpawnBuildableThink( gentity_t *ent ) G_FreeEntity( ent ); } +static void G_ForceSpawnBuildableThink( gentity_t *ent ) +{ + G_FinishSpawningBuildable( ent, qtrue ); + G_FreeEntity( ent ); +} + /* ============ G_SpawnBuildable @@ -4875,6 +4881,16 @@ void G_SpawnBuildable( gentity_t *ent, buildable_t buildable ) ent->think = G_SpawnBuildableThink; } +void G_ForceSpawnBuildable( gentity_t *ent, buildable_t buildable ) +{ + ent->s.modelindex = buildable; + + // some movers spawn on the second frame, so delay item + // spawns until the third frame so they can ride trains + ent->nextthink = level.time + FRAMETIME * 2; + ent->think = G_ForceSpawnBuildableThink; +} + /* ============ G_LayoutSave @@ -5083,6 +5099,20 @@ static void G_LayoutBuildItem( buildable_t buildable, vec3_t origin, G_SpawnBuildable( builder, buildable ); } +static void G_LayoutForceBuildItem( buildable_t buildable, vec3_t origin, + vec3_t angles, vec3_t origin2, vec3_t angles2 ) +{ + gentity_t *builder; + + builder = G_Spawn( ); + builder->client = 0; + VectorCopy( origin, builder->s.pos.trBase ); + VectorCopy( angles, builder->s.angles ); + VectorCopy( origin2, builder->s.origin2 ); + VectorCopy( angles2, builder->s.angles2 ); + G_ForceSpawnBuildable( builder, buildable ); +} + /* ============== G_LayoutExists -- cgit