If I hit it, it dies.

This is the place to request new mods or give ideas about what could be done.
Post Reply
nljr
Long Handed Inserter
Long Handed Inserter
Posts: 97
Joined: Tue May 30, 2017 2:32 am
Contact:

If I hit it, it dies.

Post by nljr »

I want a mod that will automatically mark for harvest any tree, rock or cliff that I run a vehicle into.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: If I hit it, it dies.

Post by darkfrei »

nljr wrote:
Sat May 23, 2020 11:28 pm
I want a mod that will automatically mark for harvest any tree, rock or cliff that I run a vehicle into.
Just place this code to your mod into the control.lua:

Code: Select all

script.on_event(defines.events.on_entity_damaged, function(event)
	local entity = event.entity
	local force = event.force
	if entity.type == "tree" and force then
		entity.order_deconstruction(force)
	end
end)

ichVII
Long Handed Inserter
Long Handed Inserter
Posts: 98
Joined: Mon Feb 27, 2017 10:16 pm
Contact:

Re: If I hit it, it dies.

Post by ichVII »

This would also mark burning trees for deconstruction, which would kill a lot of robots.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: If I hit it, it dies.

Post by darkfrei »

ichVII wrote:
Sun Jun 14, 2020 1:17 pm
This would also mark burning trees for deconstruction, which would kill a lot of robots.
You are right, it must be impact only.

Code: Select all

script.on_event(defines.events.on_entity_damaged, function(event)
	local entity = event.entity
	local force = event.force
	if entity.type == "tree" and event.damage_type.name == "impact" and force then
		entity.order_deconstruction(force)
	end
end)

Post Reply

Return to “Ideas and Requests For Mods”