[Genhis] [1.1.94] LuaSurface.create_entity doesn't apply source_offset to streams

Post Reply
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

[Genhis] [1.1.94] LuaSurface.create_entity doesn't apply source_offset to streams

Post by Deadlock989 »

LuaSurface.create_entity can create beams and streams. The notes below the main doc for each of the additional per-entity-type properties say that both of them can have target_position, source_position, and source_offset. You still have to set position because it's mandatory (even if you've set source_position or you've set up source as an entity or a position).

However in testing, source_offset doesn't seem to work at all for streams despite being documented as available. Compare and contrast the following scripted dying_trigger_effect first using a stream then a beam. The stream's create_entity call is defined something like this:

Code: Select all

entity.surface.create_entity{
	name = "flamethrower-fire-stream",
	force = entity.force,
	position = entity.position,
	source_position = entity.position,
	source_offset = {0,-4},
	target_position = position,
	raise_built = false,
	create_build_effect_smoke = false,
}
and if 16 of them are sent to positions representing equally spaced points around an ellipse up to 8 tiles away, produces this:

Untitled2.jpg
Untitled2.jpg (240.81 KiB) Viewed 520 times

The beam's create_entity call is identical except for the addition of the duration parameter and that the given name is "laser-beam", and produces this:

Untitled1.jpg
Untitled1.jpg (334.51 KiB) Viewed 520 times

The source_offset is {0,-4} in both cases, which is also the offset of the explosion the particles are supposed to be coming from (specified by the ExplosionPrototype's height property). But while the beams are rendered as coming from that offset, the streams aren't. I've tried specifying source as the entity or a position and omitting source_position, or omitting source and only specifying source_position, but nothing works. You can't just offset the stream's actual position because then the stream isn't rendered properly (it looks like it's coming from the ground four tiles north, which is exactly what you told it to do). When you create streams as part of an action_delivery in a prototype (e.g. flamethrower turrets), there is also a source_offset parameter there, which does work. But it is ignored for streams when scripted with create_entity.
Image

Genhis
Factorio Staff
Factorio Staff
Posts: 120
Joined: Wed Dec 24, 2014 8:19 am
Contact:

Re: [Genhis] [1.1.94] LuaSurface.create_entity doesn't apply source_offset to streams

Post by Genhis »

Thanks for the report. FluidStream does not support source_offset, so the fix won't be quick. I will try to implement it when I have some time.

Post Reply

Return to “Assigned”