This commit is contained in:
2022-08-13 08:33:59 +02:00
parent ddf946f58a
commit f37dfa90df
8 changed files with 10 additions and 14 deletions
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
+10 -14
View File
@@ -412,11 +412,6 @@ minetest.register_craftitem(
range = 100,
inventory_image = "portalgun_gun0_rndr.png",
wield_image = "portalgun_gun0_rndr.png",
tool_capabilities = {
full_punch_interval = 0.5,
max_drop_level = 3,
damage_groups = {fleshy = 1}
},
on_place = function(itemstack, user, pointed_thing)
local node = minetest.get_node(pointed_thing.under)
if node.name == "portalgun:button" then
@@ -428,10 +423,6 @@ minetest.register_craftitem(
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
--if pointing at turret then start breaking it
if pointed_thing.type == "node" then
local node = minetest.get_node(pointed_thing.under)
end
portalgun_onuse(itemstack, user, pointed_thing, 1)
return itemstack
end
@@ -442,12 +433,13 @@ local function rnd(r)
return math.floor(r + 0.5)
end
minetest.register_privilege("allblocksportal", "Can use place portals everywhere")
function portalgun_onuse(itemstack, user, pointed_thing, mode) -- using the gun
if pointed_thing.type == "object" then
portalgun_gravity(itemstack, user, pointed_thing)
return itemstack
end
local pos = user:get_pos()
local dir = user:get_look_dir()
local key = user:get_player_control()
@@ -493,10 +485,14 @@ function portalgun_onuse(itemstack, user, pointed_thing, mode) -- using the gun
if minetest.registered_nodes[nname].walkable then
portalgun_portal[name].lifelime = portalgun_lifelime
if minetest.get_node_group(nname, "antiportal") > 0 then
minetest.sound_play("portalgun_error", {pos = pos, max_hear_distance = 5, gain = 3})
return itemstack
elseif minetest.get_node_group(nname, "proportal") == 0 then
-- if minetest.get_node_group(nname, "antiportal") > 0 then
-- minetest.sound_play("portalgun_error", {pos = pos, max_hear_distance = 5, gain = 3})
-- return itemstack
-- end
--check if the name doesnt start with portalgun:testblock or if has priv allblocksportal
local allplace = minetest.check_player_privs(user:get_player_name(), {allblocksportal = true})
local istestblock = string.find(nname, "portalgun:testblock", 1)
if not istestblock and not allplace then
minetest.sound_play("portalgun_error", {pos = pos, max_hear_distance = 5, gain = 3})
return itemstack
end
Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB