This commit is contained in:
2022-07-11 10:30:14 +02:00
parent dec116cc5e
commit bad55d19a0
19 changed files with 752 additions and 61 deletions
+63 -23
View File
@@ -1,3 +1,15 @@
stone_sounds = {}
stone_sounds.footstep = {name="stone_walk", gain=1.0}
stone_sounds.dug = {name="stone_break", gain=1.0}
stone_sounds.place = {name="block_place", gain=1.0}
glass_sounds = {}
glass_sounds.footstep = {name="glass_walk", gain=1.0}
glass_sounds.dug = {name="glass_break", gain=1.0}
glass_sounds.place = {name="block_place", gain=1.0}
wood_sounds = {}
wood_sounds.footstep = {name="wood_walk", gain=1.0}
wood_sounds.dug = {name="wood_break", gain=1.0}
wood_sounds.place = {name="block_place", gain=1.0}
local snuma=1
for ii = 0, 9, 1 do
if ii==1 then snuma=0 end
@@ -7,7 +19,7 @@ minetest.register_node("portalgun:sign_numa".. ii, {
drop="portalgun:sign_numa1",
drawtype = "nodebox",
groups = {mesecon=2,portalnuma=1,dig_immediate = 3, not_in_creative_inventory=snuma},
sounds = default.node_sound_wood_defaults(),
sounds = wood_sounds,
is_ground_content = false,
paramtype2 = "facedir",
paramtype = "light",
@@ -51,7 +63,7 @@ minetest.register_node("portalgun:sign_numb".. ii, {
drop="portalgun:sign_numa1",
drawtype = "nodebox",
groups = {mesecon=2,portalnumb=1,dig_immediate = 3, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
sounds = wood_sounds,
is_ground_content = false,
paramtype2 = "facedir",
paramtype = "light",
@@ -87,7 +99,7 @@ minetest.register_node("portalgun:turretgun2", {
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
sounds = default.node_sound_defaults(),
sounds = stone_sounds,
tiles = {"portalgun_sentry_turret.png"},
drawtype = "mesh",
mesh="torret2.obj",
@@ -152,7 +164,7 @@ minetest.register_node("portalgun:turretgun", {
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
sounds = default.node_sound_defaults(),
sounds = stone_sounds,
tiles = {"portalgun_sentry_turret.png"},
drawtype = "mesh",
mesh="torret1.obj",
@@ -207,6 +219,22 @@ minetest.register_node("portalgun:turretgun", {
end
})
--giveitems register_chatcommand
minetest.register_chatcommand("giveitems", {
description = "Give items to player",
privs = {give=true},
func = function(name)
local player = minetest.get_player_by_name(name)
if player then
--give all items that dont have not_in_creative_inventory=1
for i,v in pairs(minetest.registered_items) do
if v.not_in_creative_inventory==nil or v.not_in_creative_inventory==0 then
player:get_inventory():add_item("main",i.." 1")
end
end
end
end,
})
minetest.register_node("portalgun:warntape", {
description = "Warntape",
@@ -214,7 +242,7 @@ minetest.register_node("portalgun:warntape", {
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
sounds = default.node_sound_defaults(),
sounds = stone_sounds,
tiles = {"portalgun_warntape.png",},
walkable = false,
drawtype = "nodebox",
@@ -249,7 +277,6 @@ minetest.register_node("portalgun:toxwater_1", {
liquid_range = 3,
post_effect_color = {a = 200, r = 119, g = 70, b = 16},
groups = {water = 3, liquid = 3},
sounds = default.node_sound_water_defaults(),
})
minetest.register_node("portalgun:toxwater_2", {
@@ -275,8 +302,7 @@ minetest.register_node("portalgun:toxwater_2", {
liquid_renewable = false,
liquid_range = 3,
post_effect_color = {a = 200, r = 119, g = 70, b = 16},
groups = {water = 3, liquid = 3, not_in_creative_inventory = 1},
sounds = default.node_sound_water_defaults(),
groups = {water = 3, liquid = 3, not_in_creative_inventory = 1}
})
minetest.register_tool("portalgun:ed", {
@@ -311,10 +337,10 @@ minetest.register_node("portalgun:cake", {
paramtype = "light",
sunlight_propagates = true,
selection_box = {type = "fixed",fixed = { -0.3, -0.5, -0.3, 0.3, 0, 0.3 }},
sounds = default.node_sound_defaults(),
sounds = stone_sounds,
tiles = {
"default_dirt.png^portalgun_cake1.png",
"default_dirt.png^portalgun_cake2.png",
"dirt.png^portalgun_cake1.png",
"dirt.png^portalgun_cake2.png",
},
drawtype = "nodebox",
node_box = {
@@ -339,14 +365,14 @@ minetest.register_node("portalgun:testblock", {
description = "Test block",
tiles = {"portalgun_testblock.png"},
groups = {cracky = 1},
sounds = default.node_sound_stone_defaults(),
sounds = stone_sounds,
})
minetest.register_node("portalgun:apb", {
description = "Anti portal block",
tiles = {"portalgun_testblock.png^[colorize:#ffffffaa"},
groups = {cracky = 3,antiportal=1},
sounds = default.node_sound_stone_defaults(),
sounds = stone_sounds,
})
minetest.register_node("portalgun:apg", {
@@ -354,18 +380,18 @@ minetest.register_node("portalgun:apg", {
drawtype="glasslike",
paramtype="light",
sunlight_propagates = true,
tiles = {"default_glass.png^[colorize:#ffffffaa"},
tiles = {"glass.png^[colorize:#ffffffaa"},
groups = {cracky = 1,antiportal=1},
sounds = default.node_sound_glass_defaults(),
sounds = glass_sounds,
})
minetest.register_node("portalgun:hard_glass", {
description = "Hard glass",
drawtype="glasslike",
paramtype="light",
sunlight_propagates = true,
tiles = {"default_glass.png^[colorize:#ddddddaa"},
tiles = {"glass.png^[colorize:#ddddddaa"},
groups = {cracky = 1},
sounds = default.node_sound_glass_defaults(),
sounds = glass_sounds,
})
function portalgun_visiable(pos,ob)
@@ -425,7 +451,7 @@ minetest.register_node("portalgun:secam_off", {
drawtype = "nodebox",
walkable=false,
groups = {dig_immediate = 3},
sounds = default.node_sound_glass_defaults(),
sounds = glass_sounds,
is_ground_content = false,
paramtype = "light",
paramtype2 = "facedir",
@@ -449,7 +475,7 @@ minetest.register_node("portalgun:secam", {
drawtype = "nodebox",
walkable=false,
groups = {dig_immediate = 3,stone=1,not_in_creative_inventory=1},
sounds = default.node_sound_glass_defaults(),
sounds = glass_sounds,
is_ground_content = false,
paramtype = "light",
paramtype2 = "facedir",
@@ -482,14 +508,28 @@ on_timer=function(pos, elapsed)
end,
})
--register command for admins to build a testblock at the players position
minetest.register_chatcommand("testblock", {
params = "",
description = "builds a testblock at the players position",
privs = {server=true},
func = function(name, param)
local player = minetest.get_player_by_name(name)
local pos = player:get_pos()
minetest.set_node(pos, {name = "portalgun:testblock"})
end,
})
minetest.register_entity("portalgun:bullet1",{
hp_max = 1,
--physical = true,
--collisionbox={-0.01,-0.01,-0.01,0.01,0.01,0.01},
pointable=false,
visual = "sprite",
visual = "mesh",
mesh = "bullet.obj",
--yellow color as tiles
tiles = {"#color[yellow]"},
visual_size = {x=0.1, y=0.1},
textures = {"default_mese_block.png"},
initial_sprite_basepos = {x=0, y=0},
portalgun=2,
bullet=1,
@@ -524,7 +564,7 @@ minetest.register_node("portalgun:sign1", {
inventory_image = "portalgun_testblock.png^portalgun_sign1.png",
drawtype = "nodebox",
groups = {snappy = 3, not_in_creative_inventory=0},
sounds = default.node_sound_wood_defaults(),
sounds = wood_sounds,
is_ground_content = false,
paramtype2 = "facedir",
paramtype = "light",
@@ -539,7 +579,7 @@ minetest.register_node("portalgun:sign2", {
inventory_image = "portalgun_testblock.png^portalgun_sign2.png",
drawtype = "nodebox",
groups = {snappy = 3, not_in_creative_inventory=0},
sounds = default.node_sound_wood_defaults(),
sounds = wood_sounds,
is_ground_content = false,
paramtype2 = "facedir",
paramtype = "light",