diff options
author | /dev/humancontroller <devhc@example.com> | 2015-06-14 15:37:16 +0200 |
---|---|---|
committer | /dev/humancontroller <devhc@example.com> | 2017-03-09 13:51:17 +0100 |
commit | c3142a1b4cff9432a809b30d953b8a16e107065c (patch) | |
tree | eaaa7863ea7b8f9ca39e798ee35baf0a6b3296b1 /src | |
parent | 9a5788ed94c9c57ec14c3132dcb3ffa7dae4fe05 (diff) |
when spawning buildables, replace the "builder" entity with a buildable (instead of allocating a new entity), to retain the entity number
Diffstat (limited to 'src')
-rw-r--r-- | src/game/g_buildable.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index a335e04e..7a6ad366 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -2770,7 +2770,8 @@ void G_BuildableThink( gentity_t *ent, int msec ) G_BuildableTouchTriggers( ent ); // Fall back on normal physics routines - G_Physics( ent, msec ); + if( msec != 0 ) + G_Physics( ent, msec ); } @@ -3568,8 +3569,14 @@ static gentity_t *G_Build( gentity_t *builder, buildable_t buildable, G_FreeMarkedBuildables( builder, readable, sizeof( readable ), buildnums, sizeof( buildnums ) ); - // Spawn the buildable - built = G_Spawn(); + if( builder->client ) + { + // Spawn the buildable + built = G_Spawn(); + } + else + built = builder; + built->s.eType = ET_BUILDABLE; built->killedBy = ENTITYNUM_NONE; built->classname = BG_Buildable( buildable )->entityName; @@ -3926,7 +3933,7 @@ Complete spawning a buildable using its placeholder static void G_SpawnBuildableThink( gentity_t *ent ) { G_FinishSpawningBuildable( ent, qfalse ); - G_FreeEntity( ent ); + G_BuildableThink( ent, 0 ); } /* @@ -4502,15 +4509,13 @@ void G_BuildLogRevertThink( gentity_t *ent ) } built = G_FinishSpawningBuildable( ent, qtrue ); - if( ( built->deconstruct = ent->deconstruct ) ) - built->deconstructTime = ent->deconstructTime; built->buildTime = built->s.time = 0; G_KillBox( built ); G_LogPrintf( "revert: restore %d %s\n", (int)( built - g_entities ), BG_Buildable( built->s.modelindex )->name ); - G_FreeEntity( ent ); + G_BuildableThink( built, 0 ); } void G_BuildLogRevert( int id ) |