A_SpawnFreshCopy is an action that spawns a new Object that has the same position, Object type, angle, scale, target and tracer as the actor. All other Object properties are not carried over. If the Object type has a
SeeSound, the newly spawned Object will play it. In SRB2, this action is used by Brak Eggman's electric barrier, while invisible after being doused in water, to appear to re-spawn by creating a fresh copy of itself.
Code – A_SpawnFreshCopy
// Function: A_SpawnFreshCopy
// Description: Spawns a copy of the mobj. x, y, z, angle, scale, target and tracer carry over; everything else starts anew.
// Mostly writing this because I want to do multiple actions to pass these along in a single frame instead of several.
// var1 = unused
// var2 = unused
void A_SpawnFreshCopy(mobj_t *actor)
if (LUA_CallAction("A_SpawnFreshCopy", actor))
newObject = P_SpawnMobj(actor->x, actor->y, actor->z, actor->type);
newObject->angle = actor->angle;
newObject->destscale = actor->destscale;