(0.18) clouds with damage = 0 don't trigger event

Bugs that are actually features.
User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 401
Joined: Thu Dec 21, 2017 8:02 am
Contact:

(0.18) clouds with damage = 0 don't trigger event

Post by ownlyme »

this is my cloud action:

Code: Select all

action =
		{
			type = "direct",
			action_delivery =
			{
				type = "instant",
				target_effects =
				{
					type = "nested-result",
					action =
					{
						type = "area",
						radius = 14,
						entity_flags = {"placeable-off-grid"},
						action_delivery =
						{
							type = "instant",
							target_effects =
							{
							type = "damage",
							damage = { amount = 0, type = "poison"}
							}
						}
					}
				}
			}
		}
i was using it for radiation damage in realistic reactors to find trees, players and vehicles with players inside, but in 0.18 it doesn't trigger the on_entity_damaged event anymore unless i increase the damage to 0.0001, but then it would damage stones which is unimmersive.
(and i'm not even complaining about the damaged animation playing on the tank for 0.0001 damage ... oops i actually did)
Last edited by ownlyme on Thu Jan 23, 2020 1:43 pm, edited 1 time in total.
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5221
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: (0.18) clouds with damage = 0 don't trigger event

Post by Klonan »

Not a bug

This is the perfect use-case for the new script trigger effect

https://lua-api.factorio.com/latest/eve ... ger_effect

User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 401
Joined: Thu Dec 21, 2017 8:02 am
Contact:

Re: (0.18) clouds with damage = 0 don't trigger event

Post by ownlyme »

oh okay thanks.. i'll figure out that one then
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5221
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: (0.18) clouds with damage = 0 don't trigger event

Post by Klonan »

ownlyme wrote:
Thu Jan 23, 2020 1:44 pm
oh okay thanks.. i'll figure out that one then
Its super easy, just put something like this instead of the damage effect:

Code: Select all

  {
    type = "script",
    effect_id = "radiation-damage"
  }
and then in control lua:

Code: Select all

local on_script_trigger_effect = function(event)
  if event.effect_id == "radiation-damage" then
    do_radiation_damage(event)
  end
end

User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 401
Joined: Thu Dec 21, 2017 8:02 am
Contact:

Re: (0.18) clouds with damage = 0 don't trigger event

Post by ownlyme »

thank you, very friendly :) was already about to ask because it's not yet in the wiki
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance

User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 401
Joined: Thu Dec 21, 2017 8:02 am
Contact:

Re: (0.18) clouds with damage = 0 don't trigger event

Post by ownlyme »

hmm the event doesn't contain a "target" or "target_position" variable.. am i doing it wrong?
(it does seem to trigger for every target)

Code: Select all

{
	type = "direct",
	action_delivery =
	{
		type = "instant",
		target_effects =
		{
			type = "nested-result",
			action =
			{
				type = "area",
				radius = radius,
				entity_flags = {"placeable-off-grid"},
				action_delivery =
				{
					type = "instant",
					target_effects =
					{
						type = "script",
						effect_id = "radiation-damage"
					}
				}
			}
		}
	}
}

Code: Select all

script.on_event(defines.events.on_script_trigger_effect,function(event)
game.print(event.target) --nil
	if event.effect_id == "radiation-damage" and event.target then
	....
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance

posila
Factorio Staff
Factorio Staff
Posts: 5291
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: (0.18) clouds with damage = 0 don't trigger event

Post by posila »

It's target_entity, the doc is wrong (also check source_entity, trigger system is super weird and sometimes source and target is not what one would expect)

EDIT: Just FYI, for "it would damage stones" there is also a system: 71657

User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 401
Joined: Thu Dec 21, 2017 8:02 am
Contact:

Re: (0.18) clouds with damage = 0 don't trigger event

Post by ownlyme »

that did the trick, thanks :)
source_entity always seems to be correct
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance

Post Reply

Return to “Not a bug”