diff options
| author | cheapie <no-email-for-you@example.com> | 2026-04-17 10:09:45 -0500 |
|---|---|---|
| committer | cheapie <no-email-for-you@example.com> | 2026-04-17 10:09:45 -0500 |
| commit | 77d02ae03acf2f24d34a61bf59cf8e2717e3bc85 (patch) | |
| tree | f0768a83363df5fd26e9b3f813b5962337ed4eb2 /init.lua | |
| parent | da1504c9038293f3927bf5c961b95df6e1445088 (diff) | |
| download | carts_despawn-77d02ae03acf2f24d34a61bf59cf8e2717e3bc85.tar carts_despawn-77d02ae03acf2f24d34a61bf59cf8e2717e3bc85.tar.gz carts_despawn-77d02ae03acf2f24d34a61bf59cf8e2717e3bc85.tar.bz2 carts_despawn-77d02ae03acf2f24d34a61bf59cf8e2717e3bc85.tar.xz carts_despawn-77d02ae03acf2f24d34a61bf59cf8e2717e3bc85.zip | |
Change despawn algorithm to make things behave better
Diffstat (limited to 'init.lua')
| -rw-r--r-- | init.lua | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -1,12 +1,15 @@ local S = core.get_translator("carts_despawn") -local old_step = core.registered_entities["carts:cart"].on_step +local old_activate = core.registered_entities["carts:cart"].on_activate or function() end -core.registered_entities["carts:cart"].on_step = function(self,dtime,...) +core.registered_entities["carts:cart"].on_activate = function(self,staticdata,dtime,...) + old_activate(self,staticdata,dtime,...) local obj = self.object local pos = vector.round(obj:get_pos()) - obj:set_properties({static_save=(core.get_node(pos).name == "carts_despawn:parking_rail")}) - old_step(self,dtime,...) + local tracktype = core.get_node(pos).name + if tracktype ~= "carts_despawn:parking_rail" and dtime > 0 then + obj:remove() + end end carts:register_rail("carts_despawn:parking_rail", { |
