deconstruction of tree and rocks when drive over them
This commit is contained in:
@@ -96,4 +96,14 @@ Event.on_nth_tick(300, function()
|
|||||||
for key, _ in pairs(chache) do
|
for key, _ in pairs(chache) do
|
||||||
chache[key] = nil
|
chache[key] = nil
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Event.add(defines.events.on_entity_damaged, function(event)
|
||||||
|
if not (event.damage_type.name == 'impact' and event.force) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if event.entity.type == 'tree' or event.entity.type == 'simple-entity' then
|
||||||
|
event.entity.destroy()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user