Added fake fire, scaffolding and pickup mod
|
@ -0,0 +1 @@
|
|||
default
|
|
@ -0,0 +1,134 @@
|
|||
minetest.register_node("fake_fire:fake_fire", {
|
||||
description = "fake_fire",
|
||||
tiles = {
|
||||
{name="fake_fire_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1.5}},
|
||||
},
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
inventory_image = 'fake_fire.png',
|
||||
wield_image = {
|
||||
{name="fake_fire_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1.5}},
|
||||
},
|
||||
drawtype = "plantlike",
|
||||
light_source = 14,
|
||||
drop = '',
|
||||
groups = {dig_immediate=3,attached_node=1},
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
sounds = minetest.sound_play("fire_small", {pos=cp, loop=true}),
|
||||
on_punch = function (pos,node,puncher)
|
||||
minetest.sound_play("fire_extinguish",
|
||||
{pos = pos, gain = 1.0, max_hear_distance = 20,})
|
||||
end
|
||||
})
|
||||
minetest.register_craftitem("fake_fire:old_flint_and_steel", {
|
||||
description = "Never ending flint and steel",
|
||||
inventory_image = "flint_and_steel.png",
|
||||
stack_max = 1,
|
||||
liquids_pointable = false,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
n = minetest.env:get_node(pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
minetest.env:add_node(pointed_thing.above, {name="fake_fire:fake_fire"})
|
||||
minetest.sound_play("",
|
||||
{gain = 1.0, max_hear_distance = 20,})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- new code --
|
||||
|
||||
-- found then changed to my likeing from flint mod --
|
||||
local function get_nodedef_field(nodename, fieldname)
|
||||
if not minetest.registered_nodes[nodename] then
|
||||
return nil
|
||||
end
|
||||
return minetest.registered_nodes[nodename][fieldname]
|
||||
end
|
||||
|
||||
local function set_fake_fire(pointed_thing)
|
||||
local n = minetest.env:get_node(pointed_thing.above)
|
||||
if n.name ~= "" and n.name == "air" then
|
||||
minetest.env:set_node(pointed_thing.above, {name="fake_fire:fake_fire"})
|
||||
end
|
||||
end
|
||||
|
||||
-- the flint and steel --
|
||||
|
||||
minetest.register_tool("fake_fire:flint_and_steel", {
|
||||
description = "Flint and steel",
|
||||
inventory_image = "flint_and_steel.png",
|
||||
liquids_pointable = false,
|
||||
stack_max = 1,
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.0,
|
||||
max_drop_level=0,
|
||||
groupcaps={
|
||||
flamable = {uses=65, maxlevel=1},
|
||||
}
|
||||
},
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
set_fake_fire(pointed_thing)
|
||||
minetest.sound_play("",
|
||||
{gain = 1.0, max_hear_distance = 2,})
|
||||
itemstack:add_wear(65535/65)
|
||||
return itemstack
|
||||
end
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
-- water and lava puts out fake fire --
|
||||
minetest.register_abm({
|
||||
nodenames = {"fake_fire:fake_fire"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
if minetest.env:find_node_near(pos, 1, {"default:water_source", "default:water_flowing","default:lava_source","default:lava_flowing"}) then
|
||||
minetest.sound_play("fire_extinguish",
|
||||
{gain = 1.0, max_hear_distance = 20,})
|
||||
node.name = "air"
|
||||
minetest.env:set_node(pos, node)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("fake_fire:flint", {
|
||||
description = "flint",
|
||||
inventory_image = "flint.png",
|
||||
stack_max = 99,
|
||||
liquids_pointable = false,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'fake_fire:flint_and_steel 1',
|
||||
recipe = {
|
||||
{'fake_fire:flint', '', ''},
|
||||
{'', 'default:steel_ingot', ''},
|
||||
{'', '', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'fake_fire:flint 1',
|
||||
recipe = {
|
||||
{'default:gravel', '', ''},
|
||||
{'', '', ''},
|
||||
{'', '', ''},
|
||||
}
|
||||
})
|
||||
|
||||
if minetest.setting_get("log_mods") then
|
||||
minetest.log("action", "fake_fire loaded")
|
||||
end
|
||||
|
||||
|
||||
-- Thanks-
|
||||
|
||||
-- Many thanks for addi for his help in coding. --
|
||||
|
||||
-- Many thanks for the players on the King Arthur's land server for giving --
|
||||
-- me support, ideas and allowing me to add the mod to the server itself. --
|
||||
|
||||
-- slight tuning by pitriss
|
After Width: | Height: | Size: 847 B |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
|
@ -0,0 +1,75 @@
|
|||
minetest.register_globalstep(function(dtime)
|
||||
for _,player in ipairs(minetest.get_connected_players()) do
|
||||
if player:get_hp() > 0 or not minetest.setting_getbool("enable_damage") then
|
||||
local pos = player:getpos()
|
||||
pos.y = pos.y+0.5
|
||||
local inv = player:get_inventory()
|
||||
|
||||
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 1)) do
|
||||
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
||||
if inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
|
||||
inv:add_item("main", ItemStack(object:get_luaentity().itemstring))
|
||||
if object:get_luaentity().itemstring ~= "" then
|
||||
minetest.sound_play("item_drop_pickup", {
|
||||
to_player = player:get_player_name(),
|
||||
gain = 0.4,
|
||||
})
|
||||
end
|
||||
object:get_luaentity().itemstring = ""
|
||||
object:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 2)) do
|
||||
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
||||
if object:get_luaentity().collect then
|
||||
if inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
|
||||
local pos1 = pos
|
||||
pos1.y = pos1.y+0.2
|
||||
local pos2 = object:getpos()
|
||||
local vec = {x=pos1.x-pos2.x, y=pos1.y-pos2.y, z=pos1.z-pos2.z}
|
||||
vec.x = vec.x*3
|
||||
vec.y = vec.y*3
|
||||
vec.z = vec.z*3
|
||||
object:setvelocity(vec)
|
||||
object:get_luaentity().physical_state = false
|
||||
object:get_luaentity().object:set_properties({
|
||||
physical = false
|
||||
})
|
||||
|
||||
minetest.after(1, function(args)
|
||||
local lua = object:get_luaentity()
|
||||
if object == nil or lua == nil or lua.itemstring == nil then
|
||||
return
|
||||
end
|
||||
if inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
|
||||
inv:add_item("main", ItemStack(object:get_luaentity().itemstring))
|
||||
if object:get_luaentity().itemstring ~= "" then
|
||||
minetest.sound_play("item_drop_pickup", {
|
||||
to_player = player:get_player_name(),
|
||||
gain = 0.4,
|
||||
})
|
||||
end
|
||||
object:get_luaentity().itemstring = ""
|
||||
object:remove()
|
||||
else
|
||||
object:setvelocity({x=0,y=0,z=0})
|
||||
object:get_luaentity().physical_state = true
|
||||
object:get_luaentity().object:set_properties({
|
||||
physical = true
|
||||
})
|
||||
end
|
||||
end, {player, object})
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
if minetest.setting_get("log_mods") then
|
||||
minetest.log("action", "item_pickup loaded")
|
||||
end
|
|
@ -0,0 +1 @@
|
|||
default
|
|
@ -0,0 +1,154 @@
|
|||
|
||||
minetest.register_node("scaffolding:scaffolding", {
|
||||
description = "scaffolding",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"scaffolding_wooden_scaffolding_top.png", "scaffolding_wooden_scaffolding_top.png", "scaffolding_wooden_scaffolding.png",
|
||||
"scaffolding_wooden_scaffolding.png", "scaffolding_wooden_scaffolding.png", "scaffolding_wooden_scaffolding.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
climbable = true,
|
||||
walkable = false,
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("scaffolding:iron_scaffolding", {
|
||||
description = "scaffolding",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"scaffolding_iron_scaffolding_top.png", "scaffolding_iron_scaffolding_top.png", "scaffolding_iron_scaffolding.png",
|
||||
"scaffolding_iron_scaffolding.png", "scaffolding_iron_scaffolding.png", "scaffolding_iron_scaffolding.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
climbable = true,
|
||||
walkable = true,
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,cracky=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'scaffolding:scaffolding 6',
|
||||
recipe = {
|
||||
{'default:wood', 'default:wood', 'default:wood'},
|
||||
{'default:stick', '', 'default:stick'},
|
||||
{'default:wood', 'default:wood', 'default:wood'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'scaffolding:iron_scaffolding 6',
|
||||
recipe = {
|
||||
{'default:wood', 'default:wood', 'default:wood'},
|
||||
{'default:steel_ingot', '', 'default:steel_ingot'},
|
||||
{'default:wood', 'default:wood', 'default:wood'},
|
||||
}
|
||||
})
|
||||
|
||||
scaffolding_nodenames={"scaffolding:scaffolding"}
|
||||
|
||||
minetest.register_on_dignode(function(pos, node)
|
||||
local i=1
|
||||
while scaffolding_nodenames[i]~=nil do
|
||||
if node.name==scaffolding_nodenames[i] then
|
||||
np={x=pos.x, y=pos.y+1, z=pos.z}
|
||||
while minetest.env:get_node(np).name==scaffolding_nodenames[i] do
|
||||
minetest.env:remove_node(np)
|
||||
minetest.env:add_item(np, scaffolding_nodenames[i])
|
||||
np={x=np.x, y=np.y+1, z=np.z}
|
||||
end
|
||||
end
|
||||
i=i+1
|
||||
end
|
||||
end)
|
||||
|
||||
iron_scaffolding_nodenames={"scaffolding:iron_scaffolding"}
|
||||
|
||||
minetest.register_on_dignode(function(pos, node)
|
||||
local i=1
|
||||
while iron_scaffolding_nodenames[i]~=nil do
|
||||
if node.name==iron_scaffolding_nodenames[i] then
|
||||
np={x=pos.x, y=pos.y, z=pos.z+1}
|
||||
while minetest.env:get_node(np).name==iron_scaffolding_nodenames[i] do
|
||||
minetest.env:remove_node(np)
|
||||
minetest.env:add_item(np, iron_scaffolding_nodenames[i])
|
||||
np={x=np.x, y=np.y, z=np.z+1}
|
||||
end
|
||||
end
|
||||
i=i+1
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_dignode(function(pos, node)
|
||||
local i=1
|
||||
while iron_scaffolding_nodenames[i]~=nil do
|
||||
if node.name==iron_scaffolding_nodenames[i] then
|
||||
np={x=pos.x, y=pos.y, z=pos.z-1}
|
||||
while minetest.env:get_node(np).name==iron_scaffolding_nodenames[i] do
|
||||
minetest.env:remove_node(np)
|
||||
minetest.env:add_item(np, iron_scaffolding_nodenames[i])
|
||||
np={x=np.x, y=np.y, z=np.z-1}
|
||||
end
|
||||
end
|
||||
i=i-1
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_dignode(function(pos, node)
|
||||
local i=1
|
||||
while iron_scaffolding_nodenames[i]~=nil do
|
||||
if node.name==iron_scaffolding_nodenames[i] then
|
||||
np={x=pos.x+1, y=pos.y, z=pos.z}
|
||||
while minetest.env:get_node(np).name==iron_scaffolding_nodenames[i] do
|
||||
minetest.env:remove_node(np)
|
||||
minetest.env:add_item(np, iron_scaffolding_nodenames[i])
|
||||
np={x=np.x+1, y=np.y, z=np.z}
|
||||
end
|
||||
end
|
||||
i=i+1
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_dignode(function(pos, node)
|
||||
local i=1
|
||||
while iron_scaffolding_nodenames[i]~=nil do
|
||||
if node.name==iron_scaffolding_nodenames[i] then
|
||||
np={x=pos.x-1, y=pos.y, z=pos.z}
|
||||
while minetest.env:get_node(np).name==iron_scaffolding_nodenames[i] do
|
||||
minetest.env:remove_node(np)
|
||||
minetest.env:add_item(np, iron_scaffolding_nodenames[i])
|
||||
np={x=np.x-1, y=np.y, z=np.z}
|
||||
end
|
||||
end
|
||||
i=i-1
|
||||
end
|
||||
end)
|
||||
|
||||
if minetest.setting_get("log_mods") then
|
||||
minetest.log("action", "scaffolding loaded")
|
||||
end
|
||||
-- slight tuning by pitriss
|
After Width: | Height: | Size: 484 B |
After Width: | Height: | Size: 392 B |
After Width: | Height: | Size: 492 B |
After Width: | Height: | Size: 404 B |