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, range = 100,
inventory_image = "portalgun_gun0_rndr.png", inventory_image = "portalgun_gun0_rndr.png",
wield_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) on_place = function(itemstack, user, pointed_thing)
local node = minetest.get_node(pointed_thing.under) local node = minetest.get_node(pointed_thing.under)
if node.name == "portalgun:button" then if node.name == "portalgun:button" then
@@ -428,10 +423,6 @@ minetest.register_craftitem(
return itemstack return itemstack
end, end,
on_use = function(itemstack, user, pointed_thing) 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) portalgun_onuse(itemstack, user, pointed_thing, 1)
return itemstack return itemstack
end end
@@ -442,12 +433,13 @@ local function rnd(r)
return math.floor(r + 0.5) return math.floor(r + 0.5)
end end
minetest.register_privilege("allblocksportal", "Can use place portals everywhere")
function portalgun_onuse(itemstack, user, pointed_thing, mode) -- using the gun function portalgun_onuse(itemstack, user, pointed_thing, mode) -- using the gun
if pointed_thing.type == "object" then if pointed_thing.type == "object" then
portalgun_gravity(itemstack, user, pointed_thing) portalgun_gravity(itemstack, user, pointed_thing)
return itemstack return itemstack
end end
local pos = user:get_pos() local pos = user:get_pos()
local dir = user:get_look_dir() local dir = user:get_look_dir()
local key = user:get_player_control() 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 if minetest.registered_nodes[nname].walkable then
portalgun_portal[name].lifelime = portalgun_lifelime portalgun_portal[name].lifelime = portalgun_lifelime
if minetest.get_node_group(nname, "antiportal") > 0 then -- if minetest.get_node_group(nname, "antiportal") > 0 then
minetest.sound_play("portalgun_error", {pos = pos, max_hear_distance = 5, gain = 3}) -- minetest.sound_play("portalgun_error", {pos = pos, max_hear_distance = 5, gain = 3})
return itemstack -- return itemstack
elseif minetest.get_node_group(nname, "proportal") == 0 then -- 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}) minetest.sound_play("portalgun_error", {pos = pos, max_hear_distance = 5, gain = 3})
return itemstack return itemstack
end 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