Browse Source

initial D00Med/vehicles support

main
Hendrik Langer 4 years ago
parent
commit
9a73acd246
  1. 1
      init.lua
  2. 2
      mod.conf
  3. 15
      player.lua
  4. 23
      vehicles.lua

1
init.lua

@ -19,6 +19,7 @@ dofile(creative_regions.modpath.."/chatcommands.lua")
dofile(creative_regions.modpath.."/items.lua")
dofile(creative_regions.modpath.."/mod_areas.lua")
dofile(creative_regions.modpath.."/arena.lua")
dofile(creative_regions.modpath.."/vehicles.lua")
function creative_regions:update_player(player)

2
mod.conf

@ -1,4 +1,4 @@
name = creative_regions
description = Toggle privs in areas
depends = default, sfinv
optional_depends = areas, unified_inventory, hunger_ng
optional_depends = areas, unified_inventory, hunger_ng, vehicles

15
player.lua

@ -81,6 +81,21 @@ function creative_regions:player_enter_region(player, new_privs_table)
new_mode = "survival"
end
if minetest.get_modpath("vehicles") then
if privs_revoke.vehicles and not privs_grant.vehicles then
local attached_to = player:get_attach()
if attached_to and attached_to:get_luaentity() then
local entity = attached_to:get_luaentity()
if entity ~= nil and entity.driver then
minetest.chat_send_player(name, "attached to something")
vehicles.object_detach(entity, entity.driver, {x=1, y=0, z=1})
vehicles.explodinate(entity, 5)
entity.object:remove()
end
end
end
end
if new_mode ~= old_mode then
if old_mode == "arena" then

23
vehicles.lua

@ -0,0 +1,23 @@
if minetest.get_modpath("vehicles") then
minetest.register_privilege("vehicles", {
description = "Player is allowed to drive vehicles.",
give_to_singleplayer= true,
})
minetest.register_node("creative_regions:protector_vehicles", {
description = "No driving protector",
tiles = {"default_cobble.png^vehicles_wheel.png"},
is_ground_content = true,
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=1},
light_source = 1,
after_place_node = function(pos, placer, itemstack, pointed_thing)
return creative_regions.protector_set_area_privs(pos, placer, itemstack, pointed_thing, "-vehicles", "No driving Protector")
end,
can_dig = creative_regions.protector_can_dig,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
return creative_regions.protector_remove_area_privs(pos, oldnode, oldmetadata, digger, "No driving protector")
end
})
end
Loading…
Cancel
Save