Page 1 of 1

[posila] Making multiple beams from the same turrets / strange behavior

Posted: Mon Jun 10, 2019 2:12 pm
by ownlyme
When you create multiple beams from the same turret and at least 1 of the beam durations is equal to the cooldown, only 1 beam gets fired.
But when you set the cooldown to 1 higher than the beam durations, the target random offset gets randomized every shot.
At least it's not noticeable that the beam gets interrupted for 1 tick...
I don't really want to disable the target random offset either...

My other idea was to add the second beam to the action of the first beam, but that results in the second beam being active for 1 interval longer than the first beam...

I hope you can fix this, help me or implement the glow in the base game, cause it really improves visual aesthetics
unknown.png
unknown.png (260.28 KiB) Viewed 5460 times

Code: Select all

data.raw["electric-turret"]["laser-turret"]. attack_parameters =
	{
		type = "beam",
		cooldown = 21,
		range = 24,
		source_direction_count = 64,
		source_offset = {0, -3.423489 / 4},
		damage_modifier = 2,
		ammo_type =
		{
			category = "laser-turret",
			energy_consumption = "1kJ",
			action =
			{
				{
					type = "direct",
					action_delivery =
					{
						type = "beam",
						beam = "laser-beam",
						max_length = 24,
						duration = 20,
						source_offset = {0, -1.31439 }
					}
				},
				{
					type = "direct",
					action_delivery =
					{
						type = "beam",
						beam = "laser-beam-light",
						max_length = 24,
						duration = 20,
						source_offset = {0, 0.0 }
					}
				}
			}
		}
	}

Re: Making multiple beams from the same turrets / strange behavior

Posted: Mon Jun 10, 2019 2:21 pm
by Klonan
ownlyme wrote: Mon Jun 10, 2019 2:12 pm I hope you can fix this, help me or implement the glow in the base game, cause it really improves visual aesthetics
Why not just add the light to the base game beam? You can specify multiple layers for the light sprite

Re: Making multiple beams from the same turrets / strange behavior

Posted: Mon Jun 10, 2019 2:22 pm
by ownlyme
then the glow would be around the beam and not on the floor under the beam.
https://mods.factorio.com/mod/laser_fix ... looks a bit weird

Re: Making multiple beams from the same turrets / strange behavior

Posted: Mon Jun 10, 2019 2:38 pm
by ownlyme
just noticed that the two beams solution (at the turret) only works when it is shooting at the player... as soon as i change it's force and spawn a behemoth biter, i just get 1 beam again...

btw: the second beam shows up for 1 interval, but disappears then.

Re: Making multiple beams from the same turrets / strange behavior

Posted: Mon Jun 10, 2019 2:39 pm
by Klonan
ownlyme wrote: Mon Jun 10, 2019 2:22 pm then the glow would be around the beam and not on the floor under the beam.
You can shift the sprite down in the sprite definition

Re: Making multiple beams from the same turrets / strange behavior

Posted: Mon Jun 10, 2019 2:44 pm
by ownlyme
i know ;) didn't really try it but that would create a fixed offset, which would still be off when the turrets shoot at the feet (which in itself is also a bit weird ;) )

Re: Making multiple beams from the same turrets / strange behavior

Posted: Mon Jun 10, 2019 2:58 pm
by ownlyme
Guess i'll decrease the damage interval of my beam to 1/4, that seems to make the delayed glow unnoticeable.
It will probably eat quite some ups, especially with mods that monitor the entity_damaged event ..

Still hoping for a better solution though ;)

Re: Making multiple beams from the same turrets / strange behavior

Posted: Mon Jun 10, 2019 7:12 pm
by ownlyme
Guess the laser defense equipment defeated me...
The second beam in the beam prototype gets ignored and when added to the equipment, it flickers a bit...

Re: Making multiple beams from the same turrets / strange behavior

Posted: Mon Jun 17, 2019 7:52 am
by posila
Thanks for the report.
It should be fixed for 0.17.50

Re: [posila] Making multiple beams from the same turrets / strange behavior

Posted: Tue Jun 18, 2019 12:16 pm
by ownlyme
Thanks, i updated my mod.
Equipment beams also work perfectly now.
From the download count i'm getting i think you should have added it to the base game ;)

Re: [posila] Making multiple beams from the same turrets / strange behavior

Posted: Wed Jun 26, 2019 12:26 pm
by ownlyme
Wha
posila wrote: Mon Jun 17, 2019 7:52 am Thanks for the report.
It should be fixed for 0.17.50
What about a runtime tint for beams? (I guess based on the force's/player's color?)
Would allow some cool rainbow effects by changing the player color every tick :D

Code: Select all

/c 
	r = 100
	g = 0
	b = 100
	i=0
script.on_event(defines.events.on_tick, function(event) 
	i=i+1
	if i <= 100 then 
		b = b-1
	elseif i <= 200 then 
		g=g+1
	elseif i <= 300 then
		r=r-1
	elseif i <= 400 then 
		b=b+1
	elseif i <= 500 then 
		g=g-1
	elseif i <= 600 then 
		r=r+1
	end
	if i == 600 then
		i=0
	end
	game.players[1].color = {r=r/100,g=g/100,b=b/100}
end)