2023-01-22 18:26:41 +01:00
|
|
|
minetest.register_item(":", { -- Hand
|
2023-01-22 20:51:24 +01:00
|
|
|
type = "none",
|
|
|
|
wield_image = "coke.png",
|
|
|
|
wield_scale = {x=.3,y=2,z=2.5},
|
|
|
|
range = 5,
|
|
|
|
tool_capabilities = {
|
|
|
|
max_drop_level = 0,
|
|
|
|
full_punch_interval = 0.4,
|
|
|
|
groupcaps = {
|
2023-01-26 13:42:13 +01:00
|
|
|
choppy = {times = {[1] = 2, [2] = 1.5, [3] = 1.3}, uses = 20, maxlevel = 1},
|
2023-01-28 11:04:13 +01:00
|
|
|
crumbly = {times = {[1] = 1.0, [2] = 0.9, [3] = 0.8}, uses = 20, maxlevel = 1},
|
2023-01-26 13:42:13 +01:00
|
|
|
cracky = {times = {[1] = 1.0, [2] = 0.7, [3] = 0.5}, uses = 20, maxlevel = 1},
|
2023-01-30 07:24:03 +01:00
|
|
|
flower = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 10, maxlevel=3},
|
2023-01-22 20:51:24 +01:00
|
|
|
},
|
|
|
|
damage_groups = {fleshy = 1, snappy = 1, cracky=1},
|
|
|
|
}
|
2023-01-22 18:26:41 +01:00
|
|
|
})
|
2023-02-03 18:13:48 +01:00
|
|
|
|
|
|
|
local function explode(pos, radius)
|
|
|
|
local objects = minetest.get_objects_inside_radius(pos, radius)
|
|
|
|
for _, obj in pairs(objects) do
|
|
|
|
local obj_pos = obj:get_pos()
|
|
|
|
local dir = vector.normalize(vector.subtract(obj_pos, pos))
|
|
|
|
obj:set_velocity(vector.multiply(dir, 10))
|
|
|
|
obj:punch(obj, 1.0, {
|
|
|
|
full_punch_interval = 1.0,
|
|
|
|
damage_groups = {fleshy = 4},
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
for x = -radius, radius do
|
|
|
|
for y = -radius, radius do
|
|
|
|
for z = -radius, radius do
|
|
|
|
local p = {x = pos.x + x, y = pos.y + y, z = pos.z + z}
|
|
|
|
local d = vector.distance(pos, p)
|
|
|
|
if d <= radius then
|
|
|
|
minetest.remove_node(p)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-01-07 21:26:50 +01:00
|
|
|
minetest.register_craftitem("amogus_items:amogus", {
|
2023-01-29 08:55:54 +01:00
|
|
|
description = "Mini Amogus friend",
|
2023-01-07 21:26:50 +01:00
|
|
|
inventory_image = "amogus_item.png",
|
2023-01-08 00:11:47 +01:00
|
|
|
|
2023-01-08 02:32:49 +01:00
|
|
|
--on_use = function(itemstack, user)
|
|
|
|
-- minetest.sound_play("amogus_sound", {
|
|
|
|
-- pos = user:get_pos(),
|
|
|
|
-- gain = 1.0,
|
|
|
|
-- max_hear_distance = 5
|
|
|
|
-- })
|
|
|
|
--end,
|
2023-01-08 00:11:47 +01:00
|
|
|
|
|
|
|
--on_place = function(itemstack, placer, pointed_thing)
|
|
|
|
-- local pos = pointed_thing.above
|
|
|
|
-- local dir = placer:get_look_dir()
|
|
|
|
-- local yaw = math.atan(dir.x/dir.z)
|
|
|
|
-- if dir.z > 0 then
|
|
|
|
-- yaw = yaw + math.pi
|
|
|
|
-- end
|
|
|
|
-- minetest.add_entity(pos, "amogus_entities:amogus", yaw)
|
|
|
|
--end
|
|
|
|
|
|
|
|
on_place = function(itemstack, placer, pointed_thing)
|
|
|
|
if pointed_thing.type == "node" then
|
|
|
|
local pos = pointed_thing.above
|
2023-01-29 08:55:54 +01:00
|
|
|
minetest.add_entity(pos, "amogus_entities:mini_crewmate")
|
2023-01-31 22:14:39 +01:00
|
|
|
--minetest.sound_play("amogus_sound", {
|
|
|
|
-- pos = pos,
|
|
|
|
-- gain = 1.0,
|
|
|
|
-- max_hear_distance = 5
|
|
|
|
--})
|
|
|
|
amogus_general.play_random_sound(
|
|
|
|
"amogus_sound",
|
|
|
|
pos,
|
|
|
|
1.0, -- gain
|
|
|
|
5, -- max_hear_distance
|
|
|
|
2.0 -- pitch
|
|
|
|
)
|
2023-02-04 16:17:05 +01:00
|
|
|
|
|
|
|
itemstack:take_item()
|
2023-01-08 00:11:47 +01:00
|
|
|
end
|
|
|
|
return itemstack
|
|
|
|
end
|
2023-01-08 14:04:18 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craftitem("amogus_items:sprite", {
|
|
|
|
description = "Sprite",
|
|
|
|
inventory_image = "sprite.png",
|
2023-01-24 22:22:14 +01:00
|
|
|
on_use = minetest.item_eat(10),
|
2023-01-08 14:04:18 +01:00
|
|
|
})
|
|
|
|
minetest.register_craftitem("amogus_items:coke", {
|
|
|
|
description = "Coke",
|
|
|
|
inventory_image = "coke.png",
|
2023-01-24 22:22:14 +01:00
|
|
|
on_use = minetest.item_eat(10),
|
2023-01-08 14:04:18 +01:00
|
|
|
})
|
|
|
|
minetest.register_craftitem("amogus_items:fanta", {
|
|
|
|
description = "Fanta",
|
|
|
|
inventory_image = "fanta.png",
|
2023-01-24 22:22:14 +01:00
|
|
|
on_use = minetest.item_eat(10),
|
2023-01-08 14:04:18 +01:00
|
|
|
})
|
|
|
|
minetest.register_craftitem("amogus_items:tomato", {
|
|
|
|
description = "Tomato",
|
|
|
|
inventory_image = "tomato.png",
|
2023-01-24 22:22:14 +01:00
|
|
|
on_use = minetest.item_eat(10),
|
2023-01-08 14:04:18 +01:00
|
|
|
})
|
|
|
|
minetest.register_craftitem("amogus_items:water", {
|
|
|
|
inventory_image = "water.png",
|
2023-01-24 22:22:14 +01:00
|
|
|
on_use = minetest.item_eat(10),
|
2023-01-08 14:04:18 +01:00
|
|
|
})
|
2023-01-09 02:35:45 +01:00
|
|
|
|
2023-01-08 15:29:39 +01:00
|
|
|
minetest.register_tool("amogus_items:lightsaber_blue", {
|
|
|
|
description = "Blue Lightsaber",
|
|
|
|
inventory_image = "lightsaber_blue.png",
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 0.1,
|
|
|
|
max_drop_level=3,
|
|
|
|
groupcaps={
|
|
|
|
snappy={times={[1]=0.1, [2]=0.1, [3]=0.1}, uses=0, maxlevel=3},
|
|
|
|
},
|
|
|
|
damage_groups = {fleshy=10},
|
|
|
|
},
|
|
|
|
sound = {breaks = "amogus_sound"},
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_tool("amogus_items:lightsaber_red", {
|
|
|
|
description = "Red Lightsaber",
|
|
|
|
inventory_image = "lightsaber_red.png",
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 0.1,
|
|
|
|
max_drop_level=3,
|
|
|
|
groupcaps={
|
|
|
|
snappy={times={[1]=0.1, [2]=0.1, [3]=0.1}, uses=0, maxlevel=3},
|
|
|
|
},
|
|
|
|
damage_groups = {fleshy=10},
|
|
|
|
},
|
2023-01-29 08:55:54 +01:00
|
|
|
|
2023-01-08 15:29:39 +01:00
|
|
|
sound = {breaks = "amogus_sound"},
|
|
|
|
})
|
2023-01-08 14:04:18 +01:00
|
|
|
|
2023-01-08 15:29:39 +01:00
|
|
|
minetest.register_tool("amogus_items:lightsaber_green", {
|
|
|
|
description = "Green Lightsaber",
|
|
|
|
inventory_image = "lightsaber_green.png",
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 0.1,
|
|
|
|
max_drop_level=3,
|
|
|
|
groupcaps={
|
|
|
|
snappy={times={[1]=0.1, [2]=0.1, [3]=0.1}, uses=0, maxlevel=3},
|
|
|
|
},
|
|
|
|
damage_groups = {fleshy=10},
|
|
|
|
},
|
|
|
|
sound = {breaks = "amogus_sound"},
|
2023-01-09 02:35:45 +01:00
|
|
|
})
|
2023-01-12 18:13:21 +01:00
|
|
|
|
2023-01-12 19:03:24 +01:00
|
|
|
-- add theese items : goldenpickaxe, wooden plank, gold_ingot, sussium_ingot
|
|
|
|
minetest.register_craftitem("amogus_items:wooden_plank", {
|
|
|
|
description = "Wooden Plank",
|
2023-01-22 18:26:41 +01:00
|
|
|
inventory_image = "wood.png",
|
2023-01-12 19:03:24 +01:00
|
|
|
})
|
|
|
|
minetest.register_craftitem("amogus_items:gold_ingot", {
|
|
|
|
description = "Gold Ingot",
|
|
|
|
inventory_image = "gold_ingot.png",
|
2023-01-22 20:51:24 +01:00
|
|
|
})minetest.register_craftitem("amogus_items:rock", {
|
|
|
|
description = "Rock",
|
|
|
|
inventory_image = "rocks.png",
|
2023-01-12 19:03:24 +01:00
|
|
|
})
|
|
|
|
minetest.register_craftitem("amogus_items:sussium_ingot", {
|
|
|
|
description = "Sussium Ingot",
|
|
|
|
inventory_image = "sussium_ingot.png",
|
|
|
|
})
|
2023-01-22 18:26:41 +01:00
|
|
|
--add theese items goldenpickaxe, stonepickaxe and allow them slowly break nodes and destroy it after 30 uses
|
2023-01-22 20:51:24 +01:00
|
|
|
minetest.register_tool("amogus_items:goldenplumba", {
|
|
|
|
description = "Golden Plumba",
|
|
|
|
inventory_image = "goldenplumba.png",
|
2023-01-12 19:03:24 +01:00
|
|
|
tool_capabilities = {
|
2023-01-22 20:51:24 +01:00
|
|
|
full_punch_interval = 0.1,
|
|
|
|
max_drop_level = 3,
|
|
|
|
groupcaps = {
|
|
|
|
unbreakable = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 10, maxlevel=3},
|
|
|
|
crumbly = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 10, maxlevel=3},
|
|
|
|
snappy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 10, maxlevel=3},
|
|
|
|
choppy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 10, maxlevel=3},
|
|
|
|
cracky = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 10, maxlevel=3},
|
|
|
|
crumbly = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 10, maxlevel=3},
|
|
|
|
cracky = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 10, maxlevel=3},
|
2023-01-12 19:03:24 +01:00
|
|
|
},
|
2023-01-22 20:51:24 +01:00
|
|
|
damage_groups = {fleshy = 10},
|
2023-01-12 19:03:24 +01:00
|
|
|
},
|
2023-01-22 20:51:24 +01:00
|
|
|
on_use = function(itemstack, user, pointed_thing)
|
|
|
|
if pointed_thing.type == "node" then
|
|
|
|
minetest.node_dig(pointed_thing.under, minetest.get_node(pointed_thing.under), user)
|
|
|
|
end
|
|
|
|
itemstack:add_wear(65535/10)
|
|
|
|
return itemstack
|
|
|
|
end,
|
2023-01-22 18:26:41 +01:00
|
|
|
sound = {breaks = "default_tool_breaks"},
|
2023-01-12 19:03:24 +01:00
|
|
|
})
|
2023-01-22 20:51:24 +01:00
|
|
|
|
|
|
|
minetest.register_tool("amogus_items:susplumba", {
|
|
|
|
description = "Sus Plumba",
|
|
|
|
inventory_image = "plumba.png",
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 0.1,
|
|
|
|
max_drop_level = 3,
|
|
|
|
groupcaps = {
|
|
|
|
unbreakable = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 10, maxlevel=3},
|
|
|
|
crumbly = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 10, maxlevel=3},
|
|
|
|
snappy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 10, maxlevel=3},
|
|
|
|
choppy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 10, maxlevel=3},
|
|
|
|
cracky = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 10, maxlevel=3},
|
|
|
|
crumbly = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 10, maxlevel=3},
|
|
|
|
cracky = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 10, maxlevel=3},
|
|
|
|
},
|
|
|
|
damage_groups = {fleshy = 10},
|
|
|
|
},
|
|
|
|
on_use = function(itemstack, user, pointed_thing)
|
|
|
|
if pointed_thing.type == "node" then
|
|
|
|
minetest.node_dig(pointed_thing.under, minetest.get_node(pointed_thing.under), user)
|
|
|
|
end
|
|
|
|
itemstack:add_wear(65535/40)
|
|
|
|
return itemstack
|
|
|
|
end,
|
|
|
|
sound = {breaks = "default_tool_breaks"},
|
|
|
|
})
|
|
|
|
|
2023-01-22 18:26:41 +01:00
|
|
|
minetest.register_tool("amogus_items:stonepickaxe", {
|
|
|
|
description = "Stone Pickaxe",
|
|
|
|
inventory_image = "stone_pick.png",
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 1.0,
|
|
|
|
max_drop_level=1,
|
|
|
|
groupcaps={
|
2023-01-27 13:07:56 +01:00
|
|
|
stone={times={[1]=2.5, [2]=1.0, [3]=0.50}, uses=30, maxlevel=1},
|
2023-01-26 13:42:13 +01:00
|
|
|
},
|
|
|
|
damage_groups = {fleshy=2},
|
|
|
|
},
|
|
|
|
sound = {breaks = "default_tool_breaks"},
|
|
|
|
})
|
|
|
|
minetest.register_tool("amogus_items:goldenpickaxe", {
|
|
|
|
description = "Golden Pickaxe",
|
|
|
|
inventory_image = "golden_pick.png",
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 1.0,
|
|
|
|
max_drop_level=1,
|
|
|
|
groupcaps={
|
2023-01-27 13:07:56 +01:00
|
|
|
stone={times={[1]=1.3, [2]=0.60, [3]=0.40}, uses=30, maxlevel=1},
|
2023-01-26 13:42:13 +01:00
|
|
|
},
|
|
|
|
damage_groups = {fleshy=2},
|
|
|
|
},
|
|
|
|
sound = {breaks = "default_tool_breaks"},
|
|
|
|
})
|
|
|
|
minetest.register_tool("amogus_items:sussiumpickaxe", {
|
|
|
|
description = "Sussium Pickaxe",
|
|
|
|
inventory_image = "sussium_pickaxe.png",
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 1.0,
|
|
|
|
max_drop_level=1,
|
|
|
|
groupcaps={
|
2023-01-28 19:12:16 +01:00
|
|
|
stone={times={[0.5]=2.0,[1]=0.85, [2]=0.40, [3]=0.20}, uses=30, maxlevel=1},
|
2023-01-22 18:26:41 +01:00
|
|
|
},
|
|
|
|
damage_groups = {fleshy=2},
|
|
|
|
},
|
|
|
|
sound = {breaks = "default_tool_breaks"},
|
2023-01-22 20:51:24 +01:00
|
|
|
})
|
|
|
|
minetest.register_tool("amogus_items:goldenaxe", {
|
|
|
|
description = "Golden Axe",
|
|
|
|
inventory_image = "goldenaxe.png",
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 1.0,
|
|
|
|
max_drop_level=1,
|
|
|
|
groupcaps={
|
2023-01-27 13:07:56 +01:00
|
|
|
choppy={times={[1]=2.50, [2]=1.40, [3]=0.45}, uses=30, maxlevel=2},
|
2023-01-24 22:22:14 +01:00
|
|
|
},
|
|
|
|
damage_groups = {fleshy=4},
|
|
|
|
},
|
|
|
|
groups = {flammable = 2}
|
|
|
|
})
|
|
|
|
minetest.register_tool("amogus_items:stoneaxe", {
|
|
|
|
description = "Stone Axe",
|
2023-01-26 13:42:13 +01:00
|
|
|
inventory_image = "stone_axe.png",
|
2023-01-24 22:22:14 +01:00
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 1.0,
|
|
|
|
max_drop_level=1,
|
|
|
|
groupcaps={
|
2023-01-26 13:42:13 +01:00
|
|
|
choppy={times={[1]=2.50, [2]=1.40, [3]=0.80}, uses=30, maxlevel=2},
|
2023-01-22 20:51:24 +01:00
|
|
|
},
|
|
|
|
damage_groups = {fleshy=4},
|
|
|
|
},
|
|
|
|
groups = {flammable = 2}
|
|
|
|
})
|
2023-01-27 13:07:56 +01:00
|
|
|
minetest.register_tool("amogus_items:sussiumaxe", {
|
|
|
|
description = "Sussium Axe",
|
|
|
|
inventory_image = "sussium_axe.png",
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 1.0,
|
|
|
|
max_drop_level=1,
|
|
|
|
groupcaps={
|
2023-01-28 11:04:13 +01:00
|
|
|
choppy={times={[1]=0.90, [2]=0.80, [3]=0.35}, uses=30, maxlevel=2},
|
2023-01-27 13:07:56 +01:00
|
|
|
},
|
|
|
|
damage_groups = {fleshy=4},
|
|
|
|
},
|
|
|
|
|
2023-01-28 11:04:13 +01:00
|
|
|
groups = {flammable = 2}
|
|
|
|
})
|
|
|
|
|
2023-01-28 19:12:16 +01:00
|
|
|
minetest.register_tool("amogus_items:stoneshovel", {
|
|
|
|
description = "stone shovel",
|
|
|
|
inventory_image = "stone_shovel.png",
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 1.0,
|
|
|
|
max_drop_level=1,
|
|
|
|
groupcaps={
|
|
|
|
crumbly={times={[1]=1.5, [2]=1.0, [3]=0.9}, uses=30, maxlevel=2},
|
|
|
|
},
|
|
|
|
damage_groups = {fleshy=4},
|
|
|
|
},
|
|
|
|
groups = {flammable = 2}
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
minetest.register_tool("amogus_items:goldenshovel", {
|
|
|
|
description = "golden shovel",
|
|
|
|
inventory_image = "golden_shovel.png",
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 1.0,
|
|
|
|
max_drop_level=1,
|
|
|
|
groupcaps={
|
|
|
|
crumbly={times={[1]=1.0, [2]=0.8, [3]=0.6}, uses=30, maxlevel=2},
|
|
|
|
},
|
|
|
|
damage_groups = {fleshy=4},
|
|
|
|
},
|
|
|
|
groups = {flammable = 2}
|
|
|
|
})
|
|
|
|
minetest.register_tool("amogus_items:sussiumshovel", {
|
|
|
|
description = "sussium shovel",
|
|
|
|
inventory_image = "sussium_shovel.png",
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 1.0,
|
|
|
|
max_drop_level=1,
|
|
|
|
groupcaps={
|
|
|
|
crumbly={times={[1]=0.8, [2]=0.6, [3]=0.35}, uses=30, maxlevel=2},
|
|
|
|
},
|
|
|
|
damage_groups = {fleshy=4},
|
|
|
|
},
|
|
|
|
groups = {flammable = 2}
|
|
|
|
})
|
|
|
|
|
2023-01-28 11:04:13 +01:00
|
|
|
minetest.register_tool("amogus_items:obsussian_hammer", {
|
|
|
|
description = "obsussian hammer",
|
|
|
|
inventory_image = "obsusian_hammer.png",
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 1.0,
|
|
|
|
max_drop_level=1,
|
|
|
|
groupcaps={
|
|
|
|
choppy={times={[1]=0.90, [2]=0.40, [3]=0.06}, uses=30, maxlevel=2},
|
|
|
|
crumbly={times={[1]=0.90, [2]=0.40, [3]=0.06}, uses=30, maxlevel=2},
|
|
|
|
stone={times={[1]=0.90, [2]=0.40, [3]=0.06}, uses=30, maxlevel=1},
|
|
|
|
crumbly={times={[1]=0.90, [2]=0.40, [3]=0.06}, uses=30, maxlevel=2},
|
|
|
|
},
|
|
|
|
damage_groups = {fleshy=4},
|
|
|
|
},
|
|
|
|
|
2023-01-27 13:07:56 +01:00
|
|
|
groups = {flammable = 2}
|
2023-02-03 18:13:48 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craftitem("amogus_items:pcb", {
|
|
|
|
description = "PCB",
|
|
|
|
inventory_image = "PCB.png",
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craftitem("amogus_items:capacitor", {
|
|
|
|
description = "Capacitor",
|
|
|
|
inventory_image = "capacitor.png",
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craftitem("amogus_items:sugar", {
|
|
|
|
description = "Sugar",
|
|
|
|
inventory_image = "sugar.png",
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craftitem("amogus_items:iron_ingot", {
|
|
|
|
description = "Iron Ingot",
|
|
|
|
inventory_image = "iron_ingot.png",
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_tool("amogus_items:dynamite", {
|
|
|
|
description = "dynamite",
|
|
|
|
inventory_image = "dynamite.png",
|
|
|
|
|
|
|
|
on_place = function(itemstack, placer, pointed_thing)
|
|
|
|
if pointed_thing.type == "node" then
|
|
|
|
local pos = pointed_thing.above
|
|
|
|
minetest.add_entity(pos, "amogus_items:dynamite_entity")
|
2023-02-04 16:17:05 +01:00
|
|
|
-- remove one item from the itemstack
|
|
|
|
itemstack:take_item()
|
2023-02-03 18:13:48 +01:00
|
|
|
end
|
|
|
|
return itemstack
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_entity("amogus_items:dynamite_entity", {
|
|
|
|
physical = true,
|
|
|
|
collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
|
|
|
|
visual = "sprite",
|
|
|
|
textures = {"dynamite.png"},
|
|
|
|
on_step = function(self, dtime)
|
|
|
|
local pos = self.object:get_pos()
|
|
|
|
explode(pos,5)
|
|
|
|
minetest.add_particlespawner({
|
|
|
|
amount = 2900,
|
|
|
|
time = 0.5,
|
|
|
|
-- create 15 block radius of particles
|
|
|
|
minpos = {x=pos.x-5, y=pos.y-5, z=pos.z-5},
|
|
|
|
maxpos = {x=pos.x+5, y=pos.y+5, z=pos.z+5},
|
|
|
|
minvel = {x=-2, y=-2, z=-2},
|
|
|
|
maxvel = {x=2, y=2, z=2},
|
|
|
|
minacc = {x=0, y=-10, z=0},
|
|
|
|
maxacc = {x=0, y=-10, z=0},
|
|
|
|
minexptime = 1,
|
|
|
|
maxexptime = 3,
|
|
|
|
minsize = 1,
|
|
|
|
maxsize = 2,
|
2023-02-04 16:17:05 +01:00
|
|
|
texture = "capacitor.png",
|
2023-02-03 18:13:48 +01:00
|
|
|
})
|
|
|
|
self.object:remove()
|
|
|
|
end
|
|
|
|
})
|
2023-02-05 02:17:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
-- below is modified code from bucket mod from minetest_game. (Minetest 0.4 mod: bucket)
|
|
|
|
-- original is licensed under:
|
|
|
|
-- GNU Lesser General Public License, version 2.1
|
|
|
|
-- Copyright (C) 2011-2016 Kahrl <kahrl@gmx.net>
|
|
|
|
-- Copyright (C) 2011-2016 celeron55, Perttu Ahola <celeron55@gmail.com>
|
|
|
|
-- Copyright (C) 2011-2016 Various Minetest developers and contributors
|
|
|
|
|
|
|
|
minetest.register_alias("empty_bucket", "amogus_items:empty_bucket")
|
|
|
|
minetest.register_alias("water_bucket", "amogus_items:water_bucket")
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "bucket:empty_bucket 1",
|
|
|
|
recipe = {
|
|
|
|
{"amogus_items:iron_ingot", "", "amogus_items:iron_ingot"},
|
|
|
|
{"", "amogus_items:iron_ingot", ""},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
bucket = {}
|
|
|
|
bucket.liquids = {}
|
|
|
|
|
|
|
|
local function check_protection(pos, name, text)
|
|
|
|
if minetest.is_protected(pos, name) then
|
|
|
|
minetest.log("action", (name ~= "" and name or "A mod")
|
|
|
|
.. " tried to " .. text
|
|
|
|
.. " at protected position "
|
|
|
|
.. minetest.pos_to_string(pos)
|
|
|
|
.. " with a bucket")
|
|
|
|
minetest.record_protection_violation(pos, name)
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- Register a new liquid
|
|
|
|
-- source = name of the source node
|
|
|
|
-- flowing = name of the flowing node
|
|
|
|
-- itemname = name of the new bucket item (or nil if liquid is not takeable)
|
|
|
|
-- inventory_image = texture of the new bucket item (ignored if itemname == nil)
|
|
|
|
-- name = text description of the bucket item
|
|
|
|
-- groups = (optional) groups of the bucket item, for example {water_bucket = 1}
|
|
|
|
-- force_renew = (optional) bool. Force the liquid source to renew if it has a
|
|
|
|
-- source neighbour, even if defined as 'liquid_renewable = false'.
|
|
|
|
-- Needed to avoid creating holes in sloping rivers.
|
|
|
|
-- This function can be called from any mod (that depends on bucket).
|
|
|
|
function bucket.register_liquid(source, flowing, itemname, inventory_image, name,
|
|
|
|
groups, force_renew)
|
|
|
|
bucket.liquids[source] = {
|
|
|
|
source = source,
|
|
|
|
flowing = flowing,
|
|
|
|
itemname = itemname,
|
|
|
|
force_renew = force_renew,
|
|
|
|
}
|
|
|
|
bucket.liquids[flowing] = bucket.liquids[source]
|
|
|
|
|
|
|
|
if itemname ~= nil then
|
|
|
|
minetest.register_craftitem(itemname, {
|
|
|
|
description = name,
|
|
|
|
inventory_image = inventory_image,
|
|
|
|
stack_max = 1,
|
|
|
|
liquids_pointable = true,
|
|
|
|
groups = groups,
|
|
|
|
|
|
|
|
on_place = function(itemstack, user, pointed_thing)
|
|
|
|
-- Must be pointing to node
|
|
|
|
if pointed_thing.type ~= "node" then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
local node = minetest.get_node_or_nil(pointed_thing.under)
|
|
|
|
local ndef = node and minetest.registered_nodes[node.name]
|
|
|
|
|
|
|
|
-- Call on_rightclick if the pointed node defines it
|
|
|
|
if ndef and ndef.on_rightclick and
|
|
|
|
not (user and user:is_player() and
|
|
|
|
user:get_player_control().sneak) then
|
|
|
|
return ndef.on_rightclick(
|
|
|
|
pointed_thing.under,
|
|
|
|
node, user,
|
|
|
|
itemstack)
|
|
|
|
end
|
|
|
|
|
|
|
|
local lpos
|
|
|
|
|
|
|
|
-- Check if pointing to a buildable node
|
|
|
|
if ndef and ndef.buildable_to then
|
|
|
|
-- buildable; replace the node
|
|
|
|
lpos = pointed_thing.under
|
|
|
|
else
|
|
|
|
-- not buildable to; place the liquid above
|
|
|
|
-- check if the node above can be replaced
|
|
|
|
|
|
|
|
lpos = pointed_thing.above
|
|
|
|
node = minetest.get_node_or_nil(lpos)
|
|
|
|
local above_ndef = node and minetest.registered_nodes[node.name]
|
|
|
|
|
|
|
|
if not above_ndef or not above_ndef.buildable_to then
|
|
|
|
-- do not remove the bucket with the liquid
|
|
|
|
return itemstack
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if check_protection(lpos, user
|
|
|
|
and user:get_player_name()
|
|
|
|
or "", "place "..source) then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
minetest.set_node(lpos, {name = source})
|
|
|
|
return ItemStack("amogus_items:empty_bucket")
|
|
|
|
end
|
|
|
|
})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- random prefixes for names
|
|
|
|
local bucket_names_prefixes = {
|
|
|
|
"Sussy",
|
|
|
|
"Sussy wussy",
|
|
|
|
"Sus",
|
|
|
|
"Imposterous",
|
|
|
|
"This is",
|
|
|
|
"I wonder what is the",
|
|
|
|
"You probably need",
|
|
|
|
"Big",
|
|
|
|
"Cursed",
|
|
|
|
"I want that",
|
|
|
|
"Very funny",
|
|
|
|
"Suspicious",
|
|
|
|
"SuspicioususUSSuS",
|
|
|
|
"SuspiciousususSuSuSsSSuS",
|
|
|
|
"AAAAA!! IT'S AGAIN THAT",
|
|
|
|
"Fantastick",
|
|
|
|
"I don't know what is that",
|
|
|
|
"This is propably the longest item name you will ever see and btw this item is called",
|
|
|
|
"I like",
|
|
|
|
"Whatever that is, I've got my own",
|
|
|
|
"A",
|
|
|
|
"Wonderful",
|
|
|
|
"Respectful",
|
|
|
|
"Amogus shaped",
|
|
|
|
"Impostor shaped",
|
|
|
|
"Imposter shaped",
|
|
|
|
"Sussy shaped"
|
|
|
|
}
|
|
|
|
|
|
|
|
-- random name
|
|
|
|
local empty_bucket_names = {
|
|
|
|
"Bmpty Eucket",
|
|
|
|
"Bupty Emcket",
|
|
|
|
"Emptt Buckey",
|
|
|
|
"Emckty Bupet"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
minetest.register_craftitem("amogus_items:empty_bucket", {
|
|
|
|
-- random name
|
|
|
|
--description = (empty_bucket_names[math.random(1, #empty_bucket_names)]),
|
|
|
|
description = (bucket_names_prefixes[math.random(1, #bucket_names_prefixes)] .. " " .. empty_bucket_names[math.random(1, #empty_bucket_names)]),
|
|
|
|
inventory_image = "empty_bucket.png",
|
|
|
|
groups = {tool = 1},
|
|
|
|
liquids_pointable = true,
|
|
|
|
on_use = function(itemstack, user, pointed_thing)
|
|
|
|
if pointed_thing.type == "object" then
|
|
|
|
pointed_thing.ref:punch(user, 1.0, { full_punch_interval=1.0 }, nil)
|
|
|
|
return user:get_wielded_item()
|
|
|
|
elseif pointed_thing.type ~= "node" then
|
|
|
|
-- do nothing if it's neither object nor node
|
|
|
|
return
|
|
|
|
end
|
|
|
|
-- Check if pointing to a liquid source
|
|
|
|
local node = minetest.get_node(pointed_thing.under)
|
|
|
|
local liquiddef = bucket.liquids[node.name]
|
|
|
|
local item_count = user:get_wielded_item():get_count()
|
|
|
|
|
|
|
|
if liquiddef ~= nil
|
|
|
|
and liquiddef.itemname ~= nil
|
|
|
|
and node.name == liquiddef.source then
|
|
|
|
if check_protection(pointed_thing.under,
|
|
|
|
user:get_player_name(),
|
|
|
|
"take ".. node.name) then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
-- default set to return filled bucket
|
|
|
|
local giving_back = liquiddef.itemname
|
|
|
|
|
|
|
|
-- check if holding more than 1 empty bucket
|
|
|
|
if item_count > 1 then
|
|
|
|
|
|
|
|
-- if space in inventory add filled bucked, otherwise drop as item
|
|
|
|
local inv = user:get_inventory()
|
|
|
|
if inv:room_for_item("main", {name=liquiddef.itemname}) then
|
|
|
|
inv:add_item("main", liquiddef.itemname)
|
|
|
|
else
|
|
|
|
local pos = user:get_pos()
|
|
|
|
pos.y = math.floor(pos.y + 0.5)
|
|
|
|
minetest.add_item(pos, liquiddef.itemname)
|
|
|
|
end
|
|
|
|
|
|
|
|
-- set to return empty buckets minus 1
|
|
|
|
giving_back = "amogus_items:empty_bucket "..tostring(item_count-1)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
-- force_renew requires a source neighbour
|
|
|
|
local source_neighbor = false
|
|
|
|
if liquiddef.force_renew then
|
|
|
|
source_neighbor =
|
|
|
|
minetest.find_node_near(pointed_thing.under, 1, liquiddef.source)
|
|
|
|
end
|
|
|
|
if not (source_neighbor and liquiddef.force_renew) then
|
|
|
|
minetest.add_node(pointed_thing.under, {name = "air"})
|
|
|
|
end
|
|
|
|
|
|
|
|
return ItemStack(giving_back)
|
|
|
|
else
|
|
|
|
-- non-liquid nodes will have their on_punch triggered
|
|
|
|
local node_def = minetest.registered_nodes[node.name]
|
|
|
|
if node_def then
|
|
|
|
node_def.on_punch(pointed_thing.under, node, user, pointed_thing)
|
|
|
|
end
|
|
|
|
return user:get_wielded_item()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
-- random name
|
|
|
|
local water_bucket_names = {
|
|
|
|
"Bater Wucket",
|
|
|
|
"Buter Wacket",
|
|
|
|
"Watet Bucker",
|
|
|
|
"Wacker Butet"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bucket.register_liquid(
|
|
|
|
"amogus_blocks:water_source",
|
|
|
|
"amogus_blocks:water_flowing",
|
|
|
|
"amogus_items:water_bucket",
|
|
|
|
"water_bucket.png",
|
|
|
|
-- random name
|
|
|
|
(bucket_names_prefixes[math.random(1, #bucket_names_prefixes)] .. " " .. water_bucket_names[math.random(1, #water_bucket_names)]),
|
|
|
|
{tool = 1, water_bucket = 1}
|
|
|
|
)
|
|
|
|
|
|
|
|
-- end of modifed code from bucket mod from minetest_game
|