Page 1 of 1

offset and offset_deviation in create_entity and create_asteroid_chunk

Posted: Thu Feb 20, 2025 4:20 am
by gogogadgetdisco
The noise in velocity and position of the resulting downsized asteroids when asteroids are destroyed appear to be accomplished by the offset and offset_deviation keys inside the dying_trigger_effects of the entity-type asteroids (used on both the create-entity and create-asteroid-chunk type effects).

So far as I can tell from the docs, neither Surface's create_entity() or SpacePlatform's create_asteroid_chunks() appear to take this as input, would it be possible to expose these on both methods?

My use case is spawning additional asteroid entities/chunks prior to asteroid destruction, and without this I think I'm restricted to noiseless/inorganic feeling methods to set the position and velocity for the new objects?

(Apologies if this duplicates another request, is documented somewhere I missed, or is a dumb ask that can be done another way, this is my first tiny mod to orient myself in the code)

Re: offset and offset_deviation in create_entity and create_asteroid_chunk

Posted: Thu Feb 20, 2025 9:43 am
by posila
gogogadgetdisco wrote: Thu Feb 20, 2025 4:20 amI'm restricted to noiseless/inorganic feeling methods to set the position and velocity for the new objects?
I don't understand what do you mean by this, or rather why do you think offset and offset_deviation makes things organic in a way that you can't do by setting position and velocity yourself? Trigger just uses uniform random generator to generate random offset. How would that be different from calling math.random in Lua on your side?

Re: offset and offset_deviation in create_entity and create_asteroid_chunk

Posted: Thu Feb 20, 2025 11:46 am
by gogogadgetdisco
You know, having trawled through a bunch of mod code and not having ran into any math.Random calls made me assume the determinism requirements prohibited random values BUT IT TURNS OUT I WAS A FOOL.

Thank you very much!

Edit: Ah, and now I see the line about it being reimplemented for determinism in the auxiliary docs! Sorry for wasting your time my friend.

Re: offset and offset_deviation in create_entity and create_asteroid_chunk

Posted: Thu Feb 20, 2025 12:21 pm
by posila
No time wasted, I was just confused by the request and wanted to understand :)