[No] zscript createThing/addThing/removeThing

Moderator: GZDoom Developers

zscript createThing/addThing/removeThing

Postby kevansevans » Mon Jul 26, 2021 12:40 pm

I'm not sure if there's already a method to do this, but I couldn't find it. As far as I could find, there's currently no way to create a thing in ZScript without putting it onto the map, later adding said thing to the map, or removing them from the map without deleting them from memory. A lot of "object" based frameworks I've worked with typically work this way, where creating and removing a new class would go as so:

(Pseudo code)
Code: Select allExpand view
//Creates the actor in memory only
//Usder can assign needed properties here
   Shells shelly = new Shells();

//Puts thing on map. User can set it's position afterwards.
   map.addChild(shelly);

//Takes it out of the map but does not remove from memory.
//Properties of this actor remain persistent until deleted or whatever
   map.removeChild(shelly);

The exact wording of it isn't important, but I imagine it would be a lot easier for thing manipulation if on adding/removal, you wouldn't have to dedicate a separate class/struct to track it's info and have to rely on thing.destroy() and then spawning a whole new actor when the user needs to re-summon it, or rely on hacky tricks like teleporting the actor way outside the map to hide it.
User avatar
kevansevans
Disciple of The Great God Imp
Spotlight Team
 
Joined: 05 Oct 2010
Github ID: kevansevans
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia with Vulkan support

Re: zscript createThing/addThing/removeThing

Postby Graf Zahl » Mon Jul 26, 2021 2:28 pm

You cannot have a thinker that isn't on the map. The game code contains countless optimizations that assume that any thinker present is on the map. Remove that assumption and things will become a lot more complicated.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 2 guests