summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua128
1 files changed, 128 insertions, 0 deletions
diff --git a/init.lua b/init.lua
new file mode 100644
index 0000000..088f66d
--- /dev/null
+++ b/init.lua
@@ -0,0 +1,128 @@
+local markers = {
+ "streets:mark_white_parking",
+ "streets:mark_yellow_parking",
+ "streets:mark_white_parking_on_asphalt",
+ "streets:mark_yellow_parking_on_asphalt",
+ "streets:micro_white_parking_1",
+ "streets:panel_white_parking_1",
+ "streets:micro_white_parking_2",
+ "streets:panel_white_parking_2",
+ "streets:micro_white_parking_4",
+ "streets:panel_white_parking_4",
+ "streets:micro_white_parking",
+ "streets:panel_white_parking",
+ "streets:micro_white_parking_12",
+ "streets:panel_white_parking_12",
+ "streets:micro_white_parking_14",
+ "streets:panel_white_parking_14",
+ "streets:micro_white_parking_15",
+ "streets:panel_white_parking_15",
+ "streets:stair_white_parking_outer",
+ "streets:stair_white_parking",
+ "streets:stair_white_parking_inner",
+ "streets:slab_white_parking_1",
+ "streets:slab_white_parking_2",
+ "streets:slab_white_parking_quarter",
+ "streets:slab_white_parking",
+ "streets:slab_white_parking_three_quarter",
+ "streets:slab_white_parking_14",
+ "streets:slab_white_parking_15",
+ "streets:slab_white_parking_two_sides",
+ "streets:slab_white_parking_three_sides",
+ "streets:slab_white_parking_three_sides_u",
+ "streets:stair_white_parking_half",
+ "streets:stair_white_parking_alt_1",
+ "streets:stair_white_parking_alt_2",
+ "streets:stair_white_parking_alt_4",
+ "streets:stair_white_parking_alt",
+ "streets:slope_white_parking",
+ "streets:slope_white_parking_half",
+ "streets:slope_white_parking_half_raised",
+ "streets:slope_white_parking_inner",
+ "streets:slope_white_parking_inner_half",
+ "streets:slope_white_parking_inner_half_raised",
+ "streets:slope_white_parking_inner_cut",
+ "streets:slope_white_parking_inner_cut_half",
+ "streets:slope_white_parking_inner_cut_half_raised",
+ "streets:slope_white_parking_outer",
+ "streets:slope_white_parking_outer_half",
+ "streets:slope_white_parking_outer_half_raised",
+ "streets:slope_white_parking_outer_cut",
+ "streets:slope_white_parking_outer_cut_half",
+ "streets:slope_white_parking_outer_cut_half_raised",
+ "streets:slope_white_parking_cut",
+ "streets:micro_yellow_parking_1",
+ "streets:panel_yellow_parking_1",
+ "streets:micro_yellow_parking_2",
+ "streets:panel_yellow_parking_2",
+ "streets:micro_yellow_parking_4",
+ "streets:panel_yellow_parking_4",
+ "streets:micro_yellow_parking",
+ "streets:panel_yellow_parking",
+ "streets:micro_yellow_parking_12",
+ "streets:panel_yellow_parking_12",
+ "streets:micro_yellow_parking_14",
+ "streets:panel_yellow_parking_14",
+ "streets:micro_yellow_parking_15",
+ "streets:panel_yellow_parking_15",
+ "streets:stair_yellow_parking_outer",
+ "streets:stair_yellow_parking",
+ "streets:stair_yellow_parking_inner",
+ "streets:slab_yellow_parking_1",
+ "streets:slab_yellow_parking_2",
+ "streets:slab_yellow_parking_quarter",
+ "streets:slab_yellow_parking",
+ "streets:slab_yellow_parking_three_quarter",
+ "streets:slab_yellow_parking_14",
+ "streets:slab_yellow_parking_15",
+ "streets:slab_yellow_parking_two_sides",
+ "streets:slab_yellow_parking_three_sides",
+ "streets:slab_yellow_parking_three_sides_u",
+ "streets:stair_yellow_parking_half",
+ "streets:stair_yellow_parking_alt_1",
+ "streets:stair_yellow_parking_alt_2",
+ "streets:stair_yellow_parking_alt_4",
+ "streets:stair_yellow_parking_alt",
+ "streets:slope_yellow_parking",
+ "streets:slope_yellow_parking_half",
+ "streets:slope_yellow_parking_half_raised",
+ "streets:slope_yellow_parking_inner",
+ "streets:slope_yellow_parking_inner_half",
+ "streets:slope_yellow_parking_inner_half_raised",
+ "streets:slope_yellow_parking_inner_cut",
+ "streets:slope_yellow_parking_inner_cut_half",
+ "streets:slope_yellow_parking_inner_cut_half_raised",
+ "streets:slope_yellow_parking_outer",
+ "streets:slope_yellow_parking_outer_half",
+ "streets:slope_yellow_parking_outer_half_raised",
+ "streets:slope_yellow_parking_outer_cut",
+ "streets:slope_yellow_parking_outer_cut_half",
+ "streets:slope_yellow_parking_outer_cut_half_raised",
+ "streets:slope_yellow_parking_cut",
+ "extra_street_signs:sign_eu_parking_site",
+}
+
+for _,v in ipairs(markers) do
+ if core.registered_nodes[v] then
+ local groups = core.registered_nodes[v].groups or {}
+ groups.parking = 1
+ core.override_item(v,{groups=groups})
+ end
+end
+
+for _,mod in ipairs({"vehicle_mash","motorbike","bike","ufos"}) do
+ for k,v in pairs(core.registered_entities) do
+ if string.sub(k,1,string.len(mod)) == mod then
+ local oldactivate = v.on_activate or function() end
+ v.on_activate = function(self,staticdata,dtime,...)
+ oldactivate(self,staticdata,dtime,...)
+ if dtime < 10 then return end
+ local obj = self.object
+ local pos = vector.round(obj:get_pos())
+ local maxradius = tonumber(core.settings:get("cars_despawn.search_radius") or 8) or 8
+ local parked = core.find_node_near(pos,maxradius,"group:parking",true)
+ if not parked then obj:remove() end
+ end
+ end
+ end
+end