mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Fix tree decon for remote driving
This commit is contained in:
@@ -103,6 +103,7 @@ Event.on_nth_tick(300, function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
-- Clear trees when hit with a car
|
-- Clear trees when hit with a car
|
||||||
|
--- @param event EventData.on_entity_damaged
|
||||||
Event.add(defines.events.on_entity_damaged, function(event)
|
Event.add(defines.events.on_entity_damaged, function(event)
|
||||||
if not (event.damage_type.name == "impact" and event.force) then
|
if not (event.damage_type.name == "impact" and event.force) then
|
||||||
return
|
return
|
||||||
@@ -118,11 +119,15 @@ Event.add(defines.events.on_entity_damaged, function(event)
|
|||||||
|
|
||||||
local driver = event.cause.get_driver()
|
local driver = event.cause.get_driver()
|
||||||
if not driver then return end
|
if not driver then return end
|
||||||
|
if driver.object_name ~= "LuaPlayer" then
|
||||||
|
driver = driver.player
|
||||||
|
if not driver then return end
|
||||||
|
end
|
||||||
|
|
||||||
local allow = get_permission(driver.player.index)
|
local allow = get_permission(driver.index)
|
||||||
if allow == "fast" and HasEnabledDecon:get(driver.player) then
|
if allow == "fast" and HasEnabledDecon:get(driver) then
|
||||||
event.entity.destroy()
|
event.entity.destroy()
|
||||||
else
|
else
|
||||||
event.entity.order_deconstruction(event.force, driver.player)
|
event.entity.order_deconstruction(event.force, driver)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user