removed experimental mods. Stripped to the core game

master
bas 2013-11-03 23:39:18 +01:00
parent 98833acbe8
commit 066b31f80d
993 changed files with 708 additions and 52475 deletions

View File

@ -1,23 +1,42 @@
--Bees mod by bas080
--[[TODO
Smoker
Grafting Tool
]]
local sound = {}
local particles = {}
--nodes
minetest.register_node("bees:bees", {
description = "Wild Bees",
drawtype = "airlike",
drawtype = "plantlike",
paramtype = "light",
tiles = {
{
name="bees_strip.png",
animation={type="vertical_frames", aspect_w=16,aspect_h=16, length=2.0}
}
},
damage_per_second = 1,
walkable = false,
buildable_to = true,
pointable = false,
on_punch = function(pos, node, puncher)
local health = puncher:get_hp()
puncher:set_hp(health-2)
end,
on_construct = function(pos)
spawn_bees(pos)
end,
on_destruct = function(pos)
remove_bees(pos)
end,
})
minetest.register_node("bees:hive", {
description = "Wild Bee Hive",
tile_images = {"bees_hive_wild_bottom.png","bees_hive_wild_bottom.png", "bees_hive_wild.png","bees_hive_wild_s.png", "bees_hive_wild_s.png", "bees_hive_wild_s.png"},
tile_images = {"bees_hive_wild.png","bees_hive_wild.png","bees_hive_wild.png", "bees_hive_wild.png", "bees_hive_wild_bottom.png"}, --Neuromancer's base texture
drawtype = "nodebox",
paramtype = "light",
paramtype2 = 'wallmounted',
@ -40,19 +59,23 @@ minetest.register_node("bees:hive", {
{-0.062500,-0.500000,-0.062500,0.062500,0.500000,0.062500}, --NodeBox 6
}
},
on_destruct = function(pos)
if sound["x"..pos.x.."y"..pos.y.."z"..pos.z] ~= nil then
minetest.sound_stop(sound["x"..pos.x.."y"..pos.y.."z"..pos.z])
sound["x"..pos.x.."y"..pos.y.."z"..pos.z] = nil
end
end,
on_construct = function(pos)
spawn_bees(pos)
minetest.get_node(pos).param2 = 0
end,
on_punch = function(pos, node, puncher)
local health = puncher:get_hp()
puncher:set_hp(health-2)
end,
after_dig_node = function(pos, oldnode, oldmetadata, user)
local wielded if user:get_wielded_item() ~= nil then wielded = user:get_wielded_item() else return end
if 'bees:grafting_tool' == wielded:get_name() then
local inv = user:get_inventory()
if inv then
inv:add_item("main", ItemStack("bees:queen"))
end
end
end
})
minetest.register_node("bees:hive_artificial", {
@ -75,9 +98,9 @@ minetest.register_node("bees:hive_artificial", {
}
},
on_construct = function(pos)
local tmr = minetest.env:get_node_timer(pos)
local tmr = minetest.get_node_timer(pos)
tmr:start(10)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
meta:set_string('inhabited','false')
meta:set_string('infotext','Requires the Queen bee');
end,
@ -108,19 +131,19 @@ minetest.register_node("bees:hive_artificial_inhabited", {
local rad = 10
local minp = {x=pos.x-rad, y=pos.y-rad, z=pos.z-rad}
local maxp = {x=pos.x+rad, y=pos.y+rad, z=pos.z+rad}
local flower_in_area = minetest.env:find_nodes_in_area(minp, maxp, "group:flower")
local flower_in_area = minetest.find_nodes_in_area(minp, maxp, "group:flower")
local flower_number = 0
for i in ipairs(flower_in_area) do
flower_number = flower_number + 1
end
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
local honey = meta:get_int("honey")
honey = honey + flower_number/10
if honey < 100 then
meta:set_string('infotext',honey.."%");
meta:set_int("honey", honey)
local tmr = minetest.env:get_node_timer(pos)
local tmr = minetest.get_node_timer(pos)
tmr:start(60)
else
meta:set_string('infotext',"100% - Time to harvest");
@ -128,9 +151,10 @@ minetest.register_node("bees:hive_artificial_inhabited", {
end
end,
on_construct = function(pos)
local tmr = minetest.env:get_node_timer(pos)
spawn_bees(pos)
local tmr = minetest.get_node_timer(pos)
tmr:start(60)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
meta:set_string('inhabited','false')
meta:set_int("honey", 0)
meta:set_string('infotext','0%');
@ -138,9 +162,10 @@ minetest.register_node("bees:hive_artificial_inhabited", {
on_punch = function(pos, node, puncher)
local health = puncher:get_hp()
puncher:set_hp(health-2)
spawn_bees(pos)
end,
on_rightclick = function(pos, node, puncher)
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
local honey = meta:get_int("honey")
if honey == 100 then
for i=math.random(1,3), 0, -1 do
@ -149,13 +174,23 @@ minetest.register_node("bees:hive_artificial_inhabited", {
end
meta:set_int("honey", 0)
meta:set_string('infotext',"0%");
local tmr = minetest.env:get_node_timer(pos)
local tmr = minetest.get_node_timer(pos)
tmr:start(60)
end
end,
after_dig_node = function(pos, oldnode, oldmetadata, user)
local wielded if user:get_wielded_item() ~= nil then wielded = user:get_wielded_item() else return end
if 'bees:grafting_tool' == wielded:get_name() then
local inv = user:get_inventory()
if inv then
inv:add_item("main", ItemStack("bees:queen"))
end
end
end
})
--abms
--[[
minetest.register_abm({ --for particles and sounds
nodenames = {"bees:hive", "bees:bees", "bees:hive_artificial_inhabited"},
interval = 1,
@ -168,10 +203,55 @@ minetest.register_abm({ --for particles and sounds
end
sound["x"..pos.x.."y"..pos.y.."z"..pos.z] = minetest.sound_play({name="bees"},{pos=pos, max_hear_distance=8, gain=0.6})
local p = {x=pos.x, y=pos.y+math.random()-0.5, z=pos.z}
minetest.add_particle(p, {x=(math.random()-0.5)*5,y=(math.random()-0.5)*5,z=(math.random()-0.5)*5}, {x=math.random()-0.5,y=math.random()-0.5,z=math.random()-0.5}, math.random(2,5), math.random(3), true, "bees_particle_bee.png")
end,
})
minetest.add_particle(
p,
{x=(math.random()-0.5)*5,y=(math.random()-0.5)*5,z=(math.random()-0.5)*5},
{x=math.random()-0.5,y=math.random()-0.5,z=math.random()-0.5},
math.random(2,5),
math.random(3),
true,
"bees_particle_bee.png"
)
minetest.add_particle(
pos,
velocity,
acceleration,
expirationtime,
size,
collisiondetection,
texture,
playername
)
]]
function spawn_bees(pos)
--[[local id = minetest.pos_to_string(pos)
if particles[id] ~= nil then return end
particles[id] = minetest.add_particlespawner(
2,
0,
{x=pos.x-0.5,y=pos.y-0.5,z=pos.z-0.5}, {x=pos.x+0.5,y=pos.y+0.5,z=pos.z+0.5},
{x=-2.5,y=-2.5,z=-2.5}, {x=2.5,y=2.5,z=2.5},
{x=-0.5,y=-0.5,z=-0.5}, {x=0.5,y=0.5,z=0.5},
2, 5,
1, 3,
true,
"bees_particle_bee.png"
)
]]
end
function remove_bees(pos)
--[[local id = particles[minetest.pos_to_string(pos)]
if id == nil then return end
minetest.delete_particlespawner(id)
]]
end
minetest.register_abm({ --spawn abm
nodenames = {"group:leafdecay"},
neighbors = {"default:apple"},
@ -254,3 +334,25 @@ minetest.register_craft({
{'group:wood','default:stick','group:wood'},
}
})
minetest.register_tool("bees:grafting_tool", {
description = "Grafting Tool",
inventory_image = "bees_grafting_tool.png",
tool_capabilities = {
full_punch_interval = 3.0,
max_drop_level=0,
groupcaps={
choppy = {times={[2]=3.00, [3]=2.00}, uses=10, maxlevel=1},
},
damage_groups = {fleshy=2},
},
})
minetest.register_craft({
output = 'bees:grafting_tool',
recipe = {
{'', '', 'default:steel_ingot'},
{'', 'default:stick', ''},
{'', '', ''},
}
})

View File

@ -4,28 +4,19 @@ Wild bees that spawn near flowers and in trees that can be harvested and domesti
version
-------
0.1
0.5
contributors
------------
bas080
VanessaE
Neuromancer
Minetest community
forum
-----
https://forum.minetest.net/viewtopic.php?pid=102905
changelog
---------
0.1
---
- wild bee hives that spawn near flowers and on beneath tree leaves
- domesticated hives that require queen bee to produce honey when flowers are nearby
- domesticated 100% hives drop honey comb when right clicked
- textures, particles and sounds
license
-------
WTFPL

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 B

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 B

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 B

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 B

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

View File

@ -1,844 +0,0 @@
-- BobBlocks mod by RabbiBob
-- State Changes
local update_bobblock = function (pos, node)
local nodename=""
local param2=""
--Switch Block State
if
-- Start Blocks
node.name == 'bobblocks:redblock_off' then nodename = 'bobblocks:redblock'
elseif node.name == 'bobblocks:redblock' then nodename = 'bobblocks:redblock_off'
elseif node.name == 'bobblocks:orangeblock_off' then nodename = 'bobblocks:orangeblock'
elseif node.name == 'bobblocks:orangeblock' then nodename = 'bobblocks:orangeblock_off'
elseif node.name == 'bobblocks:yellowblock_off' then nodename = 'bobblocks:yellowblock'
elseif node.name == 'bobblocks:yellowblock' then nodename = 'bobblocks:yellowblock_off'
elseif node.name == 'bobblocks:greenblock_off' then nodename = 'bobblocks:greenblock'
elseif node.name == 'bobblocks:greenblock' then nodename = 'bobblocks:greenblock_off'
elseif node.name == 'bobblocks:blueblock_off' then nodename = 'bobblocks:blueblock'
elseif node.name == 'bobblocks:blueblock' then nodename = 'bobblocks:blueblock_off'
elseif node.name == 'bobblocks:indigoblock_off' then nodename = 'bobblocks:indigoblock'
elseif node.name == 'bobblocks:indigoblock' then nodename = 'bobblocks:indigoblock_off'
elseif node.name == 'bobblocks:violetblock_off' then nodename = 'bobblocks:violetblock'
elseif node.name == 'bobblocks:violetblock' then nodename = 'bobblocks:violetblock_off'
elseif node.name == 'bobblocks:whiteblock_off' then nodename = 'bobblocks:whiteblock'
elseif node.name == 'bobblocks:whiteblock' then nodename = 'bobblocks:whiteblock_off'
-- Start Poles
elseif node.name == 'bobblocks:redpole_off' then nodename = 'bobblocks:redpole'
elseif node.name == 'bobblocks:redpole' then nodename = 'bobblocks:redpole_off'
elseif node.name == 'bobblocks:orangepole_off' then nodename = 'bobblocks:orangepole'
elseif node.name == 'bobblocks:orangepole' then nodename = 'bobblocks:orangepole_off'
elseif node.name == 'bobblocks:yellowpole_off' then nodename = 'bobblocks:yellowpole'
elseif node.name == 'bobblocks:yellowpole' then nodename = 'bobblocks:yellowpole_off'
elseif node.name == 'bobblocks:greenpole_off' then nodename = 'bobblocks:greenpole'
elseif node.name == 'bobblocks:greenpole' then nodename = 'bobblocks:greenpole_off'
elseif node.name == 'bobblocks:bluepole_off' then nodename = 'bobblocks:bluepole'
elseif node.name == 'bobblocks:bluepole' then nodename = 'bobblocks:bluepole_off'
elseif node.name == 'bobblocks:indigopole_off' then nodename = 'bobblocks:indigopole'
elseif node.name == 'bobblocks:indigopole' then nodename = 'bobblocks:indigopole_off'
elseif node.name == 'bobblocks:violetpole_off' then nodename = 'bobblocks:violetpole'
elseif node.name == 'bobblocks:violetpole' then nodename = 'bobblocks:violetpole_off'
elseif node.name == 'bobblocks:whitepole_off' then nodename = 'bobblocks:whitepole'
elseif node.name == 'bobblocks:whitepole' then nodename = 'bobblocks:whitepole_off'
end
minetest.env:add_node(pos, {name = nodename})
minetest.sound_play("bobblocks_glassblock",
{pos = pos, gain = 1.0, max_hear_distance = 32,})
end
-- Punch Blocks
local on_bobblock_punched = function (pos, node, puncher)
if
-- Start Blocks
node.name == 'bobblocks:redblock_off' or node.name == 'bobblocks:redblock' or
node.name == 'bobblocks:orangeblock_off' or node.name == 'bobblocks:orangeblock' or
node.name == 'bobblocks:yellowblock_off' or node.name == 'bobblocks:yellowblock' or
node.name == 'bobblocks:greenblock_off' or node.name == 'bobblocks:greenblock' or
node.name == 'bobblocks:blueblock_off' or node.name == 'bobblocks:blueblock' or
node.name == 'bobblocks:indigoblock_off' or node.name == 'bobblocks:indigoblock' or
node.name == 'bobblocks:violetblock_off' or node.name == 'bobblocks:violetblock' or
node.name == 'bobblocks:whiteblock_off' or node.name == 'bobblocks:whiteblock' or
--Start Poles
node.name == 'bobblocks:redpole_off' or node.name == 'bobblocks:redpole' or
node.name == 'bobblocks:orangepole_off' or node.name == 'bobblocks:orangepole' or
node.name == 'bobblocks:yellowpole_off' or node.name == 'bobblocks:yellowpole' or
node.name == 'bobblocks:greenpole_off' or node.name == 'bobblocks:greenpole' or
node.name == 'bobblocks:bluepole_off' or node.name == 'bobblocks:bluepole' or
node.name == 'bobblocks:indigopole_off' or node.name == 'bobblocks:indigopole' or
node.name == 'bobblocks:violetpole_off' or node.name == 'bobblocks:violetpole' or
node.name == 'bobblocks:whitepole_off' or node.name == 'bobblocks:whitepole'
then
update_bobblock(pos, node)
end
end
minetest.register_on_punchnode(on_bobblock_punched)
-- Nodes
-- Misc Node
minetest.register_node("bobblocks:btm", {
description = "Bobs TransMorgifier v5",
tile_images = {"bobblocks_btm_sides.png", "bobblocks_btm_sides.png", "bobblocks_btm_sides.png",
"bobblocks_btm_sides.png", "bobblocks_btm_sides.png", "bobblocks_btm.png"},
inventory_image = "bobblocks_btm.png",
paramtype2 = "facedir",
material = minetest.digprop_dirtlike(1.0),
legacy_facedir_simple = true,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
})
-- Start Block Nodes
minetest.register_node("bobblocks:redblock", {
description = "Red Block",
drawtype = "glasslike",
tile_images = {"bobblocks_redblock.png"},
inventory_image = minetest.inventorycube("bobblocks_redblock.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:redblock_off"
}}
})
minetest.register_node("bobblocks:redblock_off", {
description = "Red Block",
tile_images = {"bobblocks_redblock.png"},
is_ground_content = true,
alpha = WATER_ALPHA,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:redblock',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:redblock"
}}
})
minetest.register_node("bobblocks:orangeblock", {
description = "Orange Block",
drawtype = "glasslike",
tile_images = {"bobblocks_orangeblock.png"},
inventory_image = minetest.inventorycube("bobblocks_orangeblock.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:orangeblock_off"
}}
})
minetest.register_node("bobblocks:orangeblock_off", {
description = "Orange Block",
tile_images = {"bobblocks_orangeblock.png"},
is_ground_content = true,
alpha = WATER_ALPHA,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:orangeblock',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:orangeblock"
}}
})
minetest.register_node("bobblocks:yellowblock", {
description = "Yellow Block",
drawtype = "glasslike",
tile_images = {"bobblocks_yellowblock.png"},
inventory_image = minetest.inventorycube("bobblocks_yellowblock.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:yellowblock_off"
}}
})
minetest.register_node("bobblocks:yellowblock_off", {
description = "Yellow Block",
tile_images = {"bobblocks_yellowblock.png"},
is_ground_content = true,
alpha = WATER_ALPHA,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:yellowblock',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:yellowblock"
}}
})
minetest.register_node("bobblocks:greenblock", {
description = "Green Block",
drawtype = "glasslike",
tile_images = {"bobblocks_greenblock.png"},
inventory_image = minetest.inventorycube("bobblocks_greenblock.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:greenblock_off"
}}
})
minetest.register_node("bobblocks:greenblock_off", {
description = "Green Block",
tile_images = {"bobblocks_greenblock.png"},
is_ground_content = true,
alpha = WATER_ALPHA,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:greenblock',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:greenblock"
}}
})
minetest.register_node("bobblocks:blueblock", {
description = "Blue Block",
drawtype = "glasslike",
tile_images = {"bobblocks_blueblock.png"},
inventory_image = minetest.inventorycube("bobblocks_blueblock.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:blueblock_off"
}}
})
minetest.register_node("bobblocks:blueblock_off", {
description = "Blue Block",
tile_images = {"bobblocks_blueblock.png"},
is_ground_content = true,
alpha = WATER_ALPHA,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:blueblock',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:blueblock"
}}
})
minetest.register_node("bobblocks:indigoblock", {
description = "Indigo Block",
drawtype = "glasslike",
tile_images = {"bobblocks_indigoblock.png"},
inventory_image = minetest.inventorycube("bobblocks_indigoblock.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:indigoblock_off"
}}
})
minetest.register_node("bobblocks:indigoblock_off", {
description = "Indigo Block",
tile_images = {"bobblocks_indigoblock.png"},
is_ground_content = true,
alpha = WATER_ALPHA,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:indigoblock',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:indigoblock"
}}
})
minetest.register_node("bobblocks:violetblock", {
description = "Violet Block",
drawtype = "glasslike",
tile_images = {"bobblocks_violetblock.png"},
inventory_image = minetest.inventorycube("bobblocks_violetblock.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:violetblock_off"
}}
})
minetest.register_node("bobblocks:violetblock_off", {
description = "Violet Block",
tile_images = {"bobblocks_violetblock.png"},
is_ground_content = true,
alpha = WATER_ALPHA,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:violetblock',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:violetblock"
}}
})
minetest.register_node("bobblocks:whiteblock", {
description = "White Block",
drawtype = "glasslike",
tile_images = {"bobblocks_whiteblock.png"},
inventory_image = minetest.inventorycube("bobblocks_whiteblock.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:whiteblock_off"
}}
})
minetest.register_node("bobblocks:whiteblock_off", {
description = "White Block",
tile_images = {"bobblocks_whiteblock.png"},
is_ground_content = true,
alpha = WATER_ALPHA,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:whiteblock',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:whiteblock"
}}
})
minetest.register_node("bobblocks:greyblock", {
description = "Grey Block",
drawtype = "glasslike",
tile_images = {"bobblocks_greyblock.png"},
inventory_image = minetest.inventorycube("bobblocks_greyblock.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:greyblock_off"
}}
})
minetest.register_node("bobblocks:greyblock_off", {
description = "Grey Block",
tile_images = {"bobblocks_greyblock.png"},
is_ground_content = true,
alpha = WATER_ALPHA,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:greyblock',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:greyblock"
}}
})
-- Block Poles
minetest.register_node("bobblocks:redpole", {
description = "Red Pole",
drawtype = "fencelike",
tile_images = {"bobblocks_redblock.png"},
inventory_image = ("bobblocks_invredpole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:redpole_off"
}}
})
minetest.register_node("bobblocks:redpole_off", {
description = "Red Pole",
drawtype = "fencelike",
tile_images = {"bobblocks_redblock.png"},
inventory_image = ("bobblocks_invredpole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-10,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:redpole',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:redpole"
}}
})
minetest.register_node("bobblocks:orangepole", {
description = "Orange Pole",
drawtype = "fencelike",
tile_images = {"bobblocks_orangeblock.png"},
inventory_image = ("bobblocks_invorangepole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:orangepole_off"
}}
})
minetest.register_node("bobblocks:orangepole_off", {
description = "Orange Pole",
drawtype = "fencelike",
tile_images = {"bobblocks_orangeblock.png"},
inventory_image = ("bobblocks_invorangepole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-10,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:orangepole',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:orangepole"
}}
})
minetest.register_node("bobblocks:yellowpole", {
description = "Yellow Pole",
drawtype = "fencelike",
tile_images = {"bobblocks_yellowblock.png"},
inventory_image = ("bobblocks_invyellowpole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:yellowpole_off"
}}
})
minetest.register_node("bobblocks:yellowpole_off", {
description = "Yellow Pole",
drawtype = "fencelike",
tile_images = {"bobblocks_yellowblock.png"},
inventory_image = ("bobblocks_invyellowpole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-10,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:yellowpole',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:yellowpole"
}}
})
minetest.register_node("bobblocks:greenpole", {
description = "Green Pole",
drawtype = "fencelike",
tile_images = {"bobblocks_greenblock.png"},
inventory_image = ("bobblocks_invgreenpole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:greenpole_off"
}}
})
minetest.register_node("bobblocks:greenpole_off", {
description = "Green Pole",
drawtype = "fencelike",
tile_images = {"bobblocks_greenblock.png"},
inventory_image = ("bobblocks_invgreenpole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-10,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:greenpole',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:greenpole"
}}
})
minetest.register_node("bobblocks:bluepole", {
description = "Blue Pole",
drawtype = "fencelike",
tile_images = {"bobblocks_blueblock.png"},
inventory_image = ("bobblocks_invbluepole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:bluepole_off"
}}
})
minetest.register_node("bobblocks:bluepole_off", {
description = "Blue Pole",
drawtype = "fencelike",
tile_images = {"bobblocks_blueblock.png"},
inventory_image = ("bobblocks_invbluepole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-10,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:bluepole',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:bluepole"
}}
})
minetest.register_node("bobblocks:indigopole", {
description = "Indigo Pole",
drawtype = "fencelike",
tile_images = {"bobblocks_indigoblock.png"},
inventory_image = ("bobblocks_invindigopole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:indigopole_off"
}}
})
minetest.register_node("bobblocks:indigopole_off", {
description = "Indigo Pole",
drawtype = "fencelike",
tile_images = {"bobblocks_indigoblock.png"},
inventory_image = ("bobblocks_invindigopole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-10,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:indigopole',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:indigopole"
}}
})
minetest.register_node("bobblocks:violetpole", {
description = "Violet Pole",
drawtype = "fencelike",
tile_images = {"bobblocks_violetblock.png"},
inventory_image = ("bobblocks_invvioletpole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:violetpole_off"
}}
})
minetest.register_node("bobblocks:violetpole_off", {
description = "Violet Pole",
drawtype = "fencelike",
tile_images = {"bobblocks_violetblock.png"},
inventory_image = ("bobblocks_invvioletpole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-10,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:violetpole',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:violetpole"
}}
})
minetest.register_node("bobblocks:whitepole", {
description = "White Pole",
drawtype = "fencelike",
tile_images = {"bobblocks_whiteblock.png"},
inventory_image = ("bobblocks_invwhitepole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:whitepole_off"
}}
})
minetest.register_node("bobblocks:whitepole_off", {
description = "White Pole",
drawtype = "fencelike",
tile_images = {"bobblocks_whiteblock.png"},
inventory_image = ("bobblocks_invwhitepole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-10,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
drop = 'bobblocks:whitepole',
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:whitepole"
}}
})
minetest.register_node("bobblocks:greypole", {
description = "Grey Pole",
drawtype = "fencelike",
tile_images = {"bobblocks_greyblock.png"},
inventory_image = ("bobblocks_invgreypole.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
--light_source = LIGHT_MAX-0,
})
-- Crafts
-- BTM
minetest.register_craft({
output = 'NodeItem "bobblocks:btm" 1',
recipe = {
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:leaves" 1',
'node "default:mese" 1','node "default:rat" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:greyblock" 2',
recipe = {
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:cobble" 1'},
},
})
-- Red / Yellow / Blue / White
-- Red / Yellow -> Orange
-- Red / Blue -> Violet
-- Blue / Yellow -> Green
-- Red / Yellow / White -> Indigo
minetest.register_craft({
output = 'NodeItem "bobblocks:redblock" 2',
recipe = {
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:brick" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:yellowblock" 2',
recipe = {
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:sand" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:blueblock" 2',
recipe = {
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:gravel" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:whiteblock" 2',
recipe = {
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:dirt" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:orangeblock" 2',
recipe = {
{'node "bobblocks:redblock" 1', 'node "bobblocks:yellowblock" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:violetblock" 2',
recipe = {
{'node "bobblocks:redblock" 1', 'node "bobblocks:blueblock" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:greenblock" 2',
recipe = {
{'node "bobblocks:blueblock" 1', 'node "bobblocks:yellowblock" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:indigoblock" 3',
recipe = {
{'node "bobblocks:redblock" 1', 'node "bobblocks:blueblock" 1', 'node "bobblocks:whiteblock" 1'},
},
})
-- Poles
minetest.register_craft({
output = 'NodeItem "bobblocks:redpole" 1',
recipe = {
{'node "bobblocks:redblock" 1', 'node "default:stick" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:yellowpole" 1',
recipe = {
{'node "bobblocks:yellowblock" 1', 'node "default:stick" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:bluepole" 1',
recipe = {
{'node "bobblocks:blueblock" 1', 'node "default:stick" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:whitepole" 1',
recipe = {
{'node "bobblocks:whiteblock" 1', 'node "default:stick" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:orangepole" 1',
recipe = {
{'node "bobblocks:orangeblock" 1', 'node "default:stick" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:violetpole" 1',
recipe = {
{'node "bobblocks:violetblock" 1', 'node "default:stick" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:greenpole" 1',
recipe = {
{'node "bobblocks:greenblock" 1', 'node "default:stick" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:indigopole" 1',
recipe = {
{'node "bobblocks:indigoblock" 1', 'node "default:stick" 1'},
},
})
minetest.register_craft({
output = 'NodeItem "bobblocks:greypole" 1',
recipe = {
{'node "bobblocks:greyblock" 1', 'node "default:stick" 1'},
},
})
-- MESECON
-- Add jeija to bobblocks\default.txt and paste the below in at the bottom of bobblocks\blocks.lua

View File

@ -1,2 +0,0 @@
default
mesecons

View File

@ -1,95 +0,0 @@
local is_healthpack = function(node)
if node.name == 'bobblocks:health_off' or node.name == 'health_on' then
return true
end
return false
end
local update_healthpack = function (pos, node)
local nodename=""
local param2=""
--Switch HealthPack State
if node.name == 'bobblocks:health_off' then
nodename = 'bobblocks:health_on'
elseif node.name == 'bobblocks:health_on' then
nodename = 'bobblocks:health_off'
end
minetest.env:add_node(pos, {name = nodename})
end
local toggle_healthpack = function (pos, node)
if not is_healthgate(node) then return end
update_healthpack (pos, node, state)
end
local on_healthpack_punched = function (pos, node, puncher)
if node.name == 'bobblocks:health_off' or node.name == 'bobblocks:health_on' then
update_healthpack(pos, node)
end
end
-- Healing Node
minetest.register_node("bobblocks:health_off", {
description = "Health Pack 1 Off",
tile_images = {"bobblocks_health_off.png"},
inventory_image = "bobblocks_health_off.png",
paramtype2 = "facedir",
legacy_facedir_simple = true,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
is_ground_content = true,
walkable = false,
climbable = false,
mesecons = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:health_on"
}}
})
minetest.register_node("bobblocks:health_on", {
description = "Health Pack 1 On",
tile_images = {"bobblocks_health_on.png"},
paramtype2 = "facedir",
legacy_facedir_simple = true,
light_source = LIGHT_MAX-0,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
is_ground_content = true,
walkable = false,
climbable = false,
drop = "bobblocks:health_off",
mesecons = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:health_off"
}}
})
minetest.register_abm(
{nodenames = {"bobblocks:health_on"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local objs = minetest.env:get_objects_inside_radius(pos, 1)
for k, obj in pairs(objs) do
minetest.sound_play("bobblocks_health",
{pos = pos, gain = 1.0, max_hear_distance = 32,})
obj:set_hp(obj:get_hp()+10) -- give 10HP
minetest.env:remove_node(pos) -- remove the node after use
end
end,
})
--- Health
minetest.register_craft({
output = 'NodeItem "bobblocks:health_off" 1',
recipe = {
{'node "default:dirt" 1', 'node "default:paper" 1', 'node "default:apple" 2'},
},
})
minetest.register_on_punchnode(on_healthpack_punched)

View File

@ -1,13 +0,0 @@
print("[BobBlocks By minetest@rabbibob.com] Version 0.0.8 loading....")
print("[BobBlocks] loading Blocks")
dofile(minetest.get_modpath("bobblocks") .. "/blocks.lua")
print("[BobBlocks] loaded Blocks")
--[[
print("[BobBlocks] loading Health")
dofile(minetest.get_modpath("bobblocks") .. "/health.lua")
print("[BobBlocks] loaded Health")
print("[BobBlocks] loading Traps")
dofile(minetest.get_modpath("bobblocks") .. "/trap.lua")
print("[BobBlocks] loaded Traps")
print("[BobBlocks By minetest@rabbibob.com] Version 0.0.8 loaded!")
]]--

View File

@ -1,53 +0,0 @@
-- BobBlocks v0.0.8
-- (Minetest 0.4.5 compatible 20130315)
-- http://forum.minetest.net/viewtopic.php?id=1274
--------------------------------------------------------------------------
--------------------------------------------------------------------------
-- Requirements: Mesecons --
-- http://forum.minetest.net/viewtopic.php?id=628 --
-- --
-- Does not support jeija or older version of Mesecons --
-- before 1/20/2013 --
-- http://forum.minetest.net/viewtopic.php?pid=64976#p64976 --
--------------------------------------------------------------------------
--------------------------------------------------------------------------
-- Colored Lit Blocks
---- Default state = Solid lit block
---- Secondary state (punch) = transparent unlit block
---- Mesecons activation [CONDUCTOR]
-- Colored Lit Poles
---- Default state = Solid lit block
---- Secondary state (punch) = unlit block
---- Mesecons activation [CONDUCTOR]
-- Health Kit
---- Default state = health kit inactive
---- Secondary state (punch) = health kit active +10HP when walked through
---- Mesecons activation [CONDUCTOR]
-- Trap
---- Default Grass (walkable off)
---- Spike Minor (1HP per hit)
------ Spikes can be 'set' and activated when walked over
---- Spike Major (100HP per hit)
------ Spikes can be 'set' and activated when walked over
# [ATTRIBUTION]
# Unless otherwise noted, all graphics & sounds
# created by Rabbi Bob
# Licensed under the GPLv2/later
# [GRAPHICS]
# minor & major spikes by Death Dealer
# License: WTFPL
# http://minetest.net/forum/viewtopic.php?id=1582
# [SOUNDS]
# bobblocks_glass
# Author: Ch0cchi
# http://www.freesound.org/people/Ch0cchi/sounds/15285/
# Edited by rabbibob
# bobblocks_trap_fall & bobblocks_trap_fall_major
# Author: Rock Savage
# http://www.freesound.org/people/Rock%20Savage/sounds/65924/#
# Edited by rabbibob
# bobblocks_health
# http://hamsterrepublic.com/ohrrpgce/Free_Sound_Effects.html

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -1,183 +0,0 @@
-- State Changes
local update_bobtrap = function (pos, node)
local nodename=""
local param2=""
--Switch Trap State
if
-- Swap Traps
node.name == 'bobblocks:trap_spike' then nodename = 'bobblocks:trap_spike_set'
elseif node.name == 'bobblocks:trap_spike_set' then nodename = 'bobblocks:trap_spike'
elseif node.name == 'bobblocks:trap_spike_major' then nodename = 'bobblocks:trap_spike_major_set'
elseif node.name == 'bobblocks:trap_spike_major_set' then nodename = 'bobblocks:trap_spike_major'
end
minetest.env:add_node(pos, {name = nodename})
end
-- Punch Traps
local on_bobtrap_punched = function (pos, node, puncher)
if
-- Start Traps
node.name == 'bobblocks:trap_spike' or node.name == 'bobblocks:trap_spike_set' or
node.name == 'bobblocks:trap_spike_major' or node.name == 'bobblocks:trap_spike_major_set'
then
update_bobtrap(pos, node)
end
end
minetest.register_on_punchnode(on_bobtrap_punched)
--ABM (Spring The Traps)
minetest.register_abm(
{nodenames = {"bobblocks:trap_spike_set"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local objs = minetest.env:get_objects_inside_radius(pos, 1)
for k, obj in pairs(objs) do
update_bobtrap(pos, node)
end
end,
})
minetest.register_abm(
{nodenames = {"bobblocks:trap_spike_major_set"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local objs = minetest.env:get_objects_inside_radius(pos, 1)
for k, obj in pairs(objs) do
update_bobtrap(pos, node)
end
end,
})
-- Nodes
minetest.register_node("bobblocks:trap_grass", {
description = "Trap Grass",
tile_images = {"default_grass.png"},
paramtype2 = "facedir",
legacy_facedir_simple = true,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
is_ground_content = false,
walkable = false,
climbable = false,
})
minetest.register_node("bobblocks:trap_spike", {
description = "Trap Spike Minor",
drawtype = "plantlike",
visual_scale = 1,
tile_images = {"bobblocks_minorspike.png"},
inventory_image = ("bobblocks_minorspike.png"),
paramtype = "light",
walkable = false,
sunlight_propagates = true,
groups = {cracky=3,melty=3},
})
minetest.register_node("bobblocks:trap_spike_set", {
description = "Trap Spike Minor Set",
drawtype = "raillike",
visual_scale = 1,
tile_images = {"bobblocks_trap_set.png"},
paramtype = "light",
walkable = false,
sunlight_propagates = true,
groups = {cracky=3,melty=3,not_in_creative_inventory=1},
drop = 'bobblocks:trap_spike',
})
minetest.register_node("bobblocks:trap_spike_major", {
description = "Trap Spike Major",
drawtype = "plantlike",
visual_scale = 1,
tile_images = {"bobblocks_majorspike.png"},
inventory_image = ("bobblocks_majorspike.png"),
paramtype = "light",
walkable = false,
sunlight_propagates = true,
groups = {cracky=2,melty=2},
})
minetest.register_node("bobblocks:trap_spike_major_set", {
description = "Trap Spike Major Set",
drawtype = "raillike",
visual_scale = 1,
tile_images = {"bobblocks_trap_set.png"},
paramtype = "light",
walkable = false,
sunlight_propagates = true,
groups = {cracky=3,melty=3,not_in_creative_inventory=1},
drop = 'bobblocks:trap_spike_major',
})
-- Crafting
minetest.register_craft({
output = 'bobblocks:trap_spike',
recipe = {
{'', '', ''},
{'', 'default:cobble', ''},
{'default:cobble', 'default:apple', 'default:cobble'},
}
})
minetest.register_craft({
output = 'bobblocks:trap_spike_major',
recipe = {
{'', 'default:cobble', ''},
{'', 'default:apple', ''},
{'default:cobble', 'default:apple', 'default:cobble'},
}
})
minetest.register_craft({
output = 'bobblocks:trap_grass',
recipe = {
{'', '', ''},
{'', 'default:dirt', ''},
{'', 'default:stick', ''},
}
})
-- ABM
minetest.register_abm(
{nodenames = {"bobblocks:trap_spike"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local objs = minetest.env:get_objects_inside_radius(pos, 1)
for k, obj in pairs(objs) do
obj:set_hp(obj:get_hp()-1)
minetest.sound_play("bobblocks_trap_fall",
{pos = pos, gain = 1.0, max_hear_distance = 3,})
end
end,
})
minetest.register_abm(
{nodenames = {"bobblocks:trap_spike_major"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local objs = minetest.env:get_objects_inside_radius(pos, 1)
for k, obj in pairs(objs) do
obj:set_hp(obj:get_hp()-100)
minetest.sound_play("bobblocks_trap_fall",
{pos = pos, gain = 1.0, max_hear_distance = 3,})
end
end,
})

View File

@ -1,17 +0,0 @@
Minetest 0.4 mod: bones
=======================
License of source code:
-----------------------
Copyright (C) 2012 PilzAdam
WTFPL
License of media (textures and sounds)
--------------------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
Authors of media files
----------------------
Bad_Command_

View File

@ -1 +0,0 @@
default

View File

@ -1,131 +0,0 @@
-- Minetest 0.4 mod: bones
-- See README.txt for licensing and other information.
local function is_owner(pos, name)
local owner = minetest.get_meta(pos):get_string("owner")
if owner == "" or owner == name then
return true
end
return false
end
minetest.register_node("bones:bones", {
description = "Bones",
tiles = {
"bones_top.png",
"bones_bottom.png",
"bones_side.png",
"bones_side.png",
"bones_rear.png",
"bones_front.png"
},
paramtype2 = "facedir",
groups = {dig_immediate=2},
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_gravel_footstep", gain=0.5},
dug = {name="default_gravel_footstep", gain=1.0},
}),
can_dig = function(pos, player)
local inv = minetest.get_meta(pos):get_inventory()
return is_owner(pos, player:get_player_name()) and inv:is_empty("main")
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
if is_owner(pos, player:get_player_name()) then
return count
end
return 0
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
return 0
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
if is_owner(pos, player:get_player_name()) then
return stack:get_count()
end
return 0
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if meta:get_string("owner") ~= "" and meta:get_inventory():is_empty("main") then
meta:set_string("infotext", meta:get_string("owner").."'s old bones")
meta:set_string("formspec", "")
meta:set_string("owner", "")
end
end,
on_timer = function(pos, elapsed)
local meta = minetest.get_meta(pos)
local time = meta:get_int("time")+elapsed
local publish = 1200
if tonumber(minetest.setting_get("share_bones_time")) then
publish = tonumber(minetest.setting_get("share_bones_time"))
end
if publish == 0 then
return
end
if time >= publish then
meta:set_string("infotext", meta:get_string("owner").."'s old bones")
meta:set_string("owner", "")
else
return true
end
end,
})
minetest.register_on_dieplayer(function(player)
if minetest.setting_getbool("creative_mode") then
return
end
local pos = player:getpos()
pos.x = math.floor(pos.x+0.5)
pos.y = math.floor(pos.y+0.5)
pos.z = math.floor(pos.z+0.5)
local param2 = minetest.dir_to_facedir(player:get_look_dir())
local nn = minetest.get_node(pos).name
if minetest.registered_nodes[nn].can_dig and
not minetest.registered_nodes[nn].can_dig(pos, player) then
local player_inv = player:get_inventory()
for i=1,player_inv:get_size("main") do
player_inv:set_stack("main", i, nil)
end
for i=1,player_inv:get_size("craft") do
player_inv:set_stack("craft", i, nil)
end
return
end
minetest.dig_node(pos)
minetest.add_node(pos, {name="bones:bones", param2=param2})
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local player_inv = player:get_inventory()
inv:set_size("main", 8*4)
local empty_list = inv:get_list("main")
inv:set_list("main", player_inv:get_list("main"))
player_inv:set_list("main", empty_list)
for i=1,player_inv:get_size("craft") do
inv:add_item("main", player_inv:get_stack("craft", i))
player_inv:set_stack("craft", i, nil)
end
meta:set_string("formspec", "size[8,9;]"..
"list[current_name;main;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]")
meta:set_string("infotext", player:get_player_name().."'s fresh bones")
meta:set_string("owner", player:get_player_name())
meta:set_int("time", 0)
local timer = minetest.get_node_timer(pos)
timer:start(10)
end)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 B

View File

View File

@ -1,214 +0,0 @@
-- CHESS MOD
-- ======================================
-- chess/init.lua
-- ======================================
-- Registers the basic chess stuff
--
-- Contents:
--
-- [regis] Spawn Block
-- [craft] Spawn Block
-- [regis] board_black
-- [regis] board_white
-- ======================================
dofile(minetest.get_modpath("chess").."/pieces.lua")
dofile(minetest.get_modpath("chess").."/rules.lua")
dofile(minetest.get_modpath("chess").."/ownership.lua")
local function is_owner(pos, name)
local owner = minetest.env:get_meta(pos):get_string("owner")
if owner == "" or owner == name then
return true
end
return false
end
local letters = {"a", "b", "c", "d", "e", "f", "g", "h"}
local size = 9 --total width(10) including the border coordinate 0,0
local innerSize = 8 --inner width(8) including the coordinate 1,1
-- Register the spawn block
minetest.register_node("chess:spawn",{
description = "Chess Board",
tile_images = {"chess_border_spawn.png", "chess_board_black.png", "chess_board_black.png^chess_border_side.png"},
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=1,not_in_creative_inventory=1},
can_dig = function(pos, placer)
local player = placer:get_player_name()
return is_owner(pos, player)
end,
after_dig_node = function(pos, node, digger)
local size = 9
local p = {x=pos.x+1, y=pos.y, z=pos.z+1}
local n = minetest.env:get_node(p)
if n.name == "chess:board_black" then
for i = size, 0, -1 do
for ii = size, 0, -1 do
--remove board
local p = {x=pos.x+i, y=pos.y, z=pos.z+ii}
minetest.env:remove_node(p)
--remove pieces ontop
local p = {x=pos.x+i, y=pos.y+1, z=pos.z+ii}
minetest.env:remove_node(p)
end
end
end
end,
on_punch = function(pos)
--reset the pieces
end,
after_place_node = function(pos, placer)
--assign ownership to placer
local player = placer:get_player_name()
local meta = minetest.env:get_meta(pos)
meta:set_string("infotext", "[Chess] " .. player .. " is owner")
meta:set_string("owner", player)
--place chess board
for i = size, 0, -1 do
for ii = size, 0, -1 do
for iii = 1, 0, -1 do
if (i+ii+iii~=0) then
local p = {x=pos.x+i, y=pos.y+iii, z=pos.z+ii}
local n = minetest.env:get_node(p)
if(n.name ~= "air") then
minetest.chat_send_all("[Chess] cannot place chess board")
return
end
end
end
end
end
minetest.chat_send_all("[Chess] " .. player .. " placed chessboard, hit king to select color")
for i = size, 0, -1 do
for ii = size, 0, -1 do
--place chessboard
local p = {x=pos.x+i, y=pos.y, z=pos.z+ii}
local p_top = {x=pos.x+i, y=pos.y+1, z=pos.z+ii}
if (ii == 0) or (ii == size) or (i ==0) or (i == size) then --if border
if (ii == 0) and (i < size) and (i > 0) then --black letters
minetest.env:add_node(p, {name="chess:border_" .. letters[i]})
end
if (ii == size) and (i < size) and (i > 0) then --white letters
minetest.env:add_node(p, {name="chess:border_" .. letters[i], param2=2})
end
if (i == 0) and (ii < size) and (ii > 0) then --black numbers
minetest.env:add_node(p, {name="chess:border_" .. ii})
end
if (i == size) and (ii < size) and (ii > 0) then --white numbers
minetest.env:add_node(p, {name="chess:border_" .. ii, param2=2})
end
if (i == 0 or i == size) and (ii == 0 or ii == size) and i+ii ~= 0 then --corners
minetest.env:add_node(p, {name="chess:border"})
end
else--if inside border
if (((ii+i)/2) == math.floor((ii+i)/2)) then
minetest.env:add_node(p, {name="chess:board_black"})
else
minetest.env:add_node(p, {name="chess:board_white"})
end
end
--place pieces
local face = 2
if (ii == 2) and (i>0) and (i<size) then --pawns
minetest.env:add_node(p_top, {name="chess:pawn_white", param2 = face})
end
if (ii == 1) then --behind pawns
if (i == 1 or i == 8) then minetest.env:add_node(p_top, {name="chess:rook_white", param2 = face}) end
if (i == 2 or i == 7) then minetest.env:add_node(p_top, {name="chess:knight_white", param2 = face}) end
if (i == 3 or i == 6) then minetest.env:add_node(p_top, {name="chess:bishop_white", param2 = face}) end
if (i == 4) then minetest.env:add_node(p_top, {name="chess:queen_white", param2 = face}) end
if (i == 5) then minetest.env:add_node(p_top, {name="chess:king_white", param2 = face}) end
end
--black pieces
face = 0
if (ii == 7) and (i>0) and (i<size) then --pawns
minetest.env:add_node(p_top, {name="chess:pawn_black", param2 = face})
end
if (ii == 8) then --behind pawns
if (i == 1 or i == 8) then minetest.env:add_node(p_top, {name="chess:rook_black", param2 = face}) end
if (i == 2 or i == 7) then minetest.env:add_node(p_top, {name="chess:knight_black", param2 = face}) end
if (i == 3 or i == 6) then minetest.env:add_node(p_top, {name="chess:bishop_black", param2 = face}) end
if (i == 4) then minetest.env:add_node(p_top, {name="chess:queen_black", param2 = face}) end
if (i == 5) then minetest.env:add_node(p_top, {name="chess:king_black", param2 = face}) end
end
end
end
end,
})
-- Add crafting for the spawn block
minetest.register_craft({
output="chess:spawn",
recipe = {
{'default:wood','default:tree','default:wood'},
{'default:tree','default:wood','default:tree'},
{'default:wood','default:tree','default:wood'},
}
})
--Register the Board Blocks: white
minetest.register_node("chess:board_white",{
description = "White Chess Board Piece",
tile_images = {"chess_board_white.png"},
inventory_image = "chess_board_white.png",
groups = {indestructable, not_in_creative_inventory=1},
})
--Register the Board Blocks: black
minetest.register_node("chess:board_black",{
description = "Black Chess Board Piece",
tile_images = {"chess_board_black.png"},
inventory_image = "chess_board_black.png",
groups = {indestructable, not_in_creative_inventory=1},
})
minetest.register_node("chess:border",{
description = "Black Chess Board Piece",
tile_images = {"chess_board_black.png", "chess_board_black.png", "chess_board_black.png^chess_border_side.png"},
inventory_image = "chess_board_black.png",
groups = {indestructable, not_in_creative_inventory=1},
})
for iii = innerSize, 1, -1 do
minetest.register_node("chess:border_" .. letters[iii],{
description = "White Chess Board Piece",
tile_images = {"chess_board_black.png^chess_border_" .. letters[iii] .. ".png", "chess_board_black.png", "chess_board_black.png^chess_border_side.png"},
inventory_image = "chess_board_white.png",
paramtype2 = "facedir",
groups = {indestructable, not_in_creative_inventory=1},
})
minetest.register_node("chess:border_" .. iii,{
description = "White Chess Board Piece",
tile_images = {"chess_board_black.png^chess_border_" .. iii .. ".png", "chess_board_black.png", "chess_board_black.png^chess_border_side.png"},
inventory_image = "chess_board_white.png",
paramtype2 = "facedir",
groups = {indestructable, not_in_creative_inventory=1},
})
end
print("[Chess] Loaded!")

View File

@ -1,19 +0,0 @@
-- CHESS MOD
-- ======================================
-- chess/ownership.lua
-- ======================================
-- Ownershio function this is used in init and pieces lua
--
-- Contents:
--
-- [function] ownership
-- ======================================
--Node ownership functions
local function is_owner(pos, name)
local owner = minetest.env:get_meta(pos):get_string("owner")
if owner == "" or owner == name then
return true
end
return false
end

View File

@ -1,320 +0,0 @@
-- CHESS MOD
-- ======================================
-- chess/pieces.lua
-- ======================================
-- Registers the chess pieces
--
-- Contents:
--
-- [loop] registers pieces
-- ======================================
dofile(minetest.get_modpath("chess").."/ownership.lua")
local function is_owner(pos, name)
local owner = minetest.env:get_meta(pos):get_string("owner")
if owner == name then
return true
end
return false
end
local colors = {"black", "white",}
local piece_group = {snappy=3,not_in_creative_inventory=1}
--make a loop which makes the black and white nodes and crafting recipes
for color = 1, 2 do
--Pawn
minetest.register_node("chess:pawn_"..colors[color],
{
description = 'Pawn ('..colors[color]..')',
tiles = {"chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color].."_side.png", "chess_piece_"..colors[color].."_side.png"},
drawtype = "nodebox",
sunlight_propagates = true,
paramtype = 'light',
paramtype2 = "facedir",
light_source = 8,
node_box = {
type = "fixed",
fixed = {
{-0.2, -0.5, -0.3, 0.2, -0.4, 0.3},
{-0.3, -0.5, -0.2, 0.3, -0.4, 0.2},
{-0.1, -0.4, -0.2, 0.1, -0.3, 0.2},
{-0.2, -0.4, -0.1, 0.2, -0.3, 0.1},
{-0.1, -0.3, -0.1, 0.1, 0.2, 0.1},
{-0.2, -0.1, -0.1, 0.2, 0.1, 0.1},
{-0.1, -0.1, -0.2, 0.1, 0.1, 0.2},
},
},
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.2, 0.3},
},
groups = piece_group,
can_dig = function(pos, placer)
local player = placer:get_player_name()
return is_owner(pos, player)
end,
after_place_node = function(pos, placer)
local meta = minetest.env:get_meta(pos)
local player = placer:get_player_name()
meta:set_string("infotext", "[Chess] "..player)
meta:set_string("owner", player)
end,
})
--Rook
minetest.register_node("chess:rook_"..colors[color],
{
description = 'Rook ('..colors[color]..')',
tiles = {"chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color].."_side.png", "chess_piece_"..colors[color].."_side.png"},
drawtype = "nodebox",
sunlight_propagates = true,
paramtype = 'light',
paramtype2 = "facedir",
light_source = 8,
node_box = {
type = "fixed",
fixed = {
{-0.2, -0.5, -0.3, 0.2, -0.4, 0.3},
{-0.3, -0.5, -0.2, 0.3, -0.4, 0.2},
{-0.1, -0.4, -0.2, 0.1, -0.3, 0.2},
{-0.2, -0.4, -0.1, 0.2, -0.3, 0.1},
{-0.1, -0.3, -0.1, 0.1, 0.2, 0.1},
{-0.1, 0.2, -0.2, 0.1, 0.3, 0.2 },
{-0.2, 0.2, -0.1, 0.2, 0.3, 0.1},
{-0.2, 0.3, -0.2, 0.2, 0.4, 0.2},
{-0.2, 0.4, -0.2, -0.1, 0.5, -0.1},
{-0.05, 0.4, -0.2, 0.05, 0.5, -0.1},
{0.1, 0.4, -0.2, 0.2, 0.5, -0.1},
{-0.2, 0.4, -0.05, -0.1, 0.5, 0.05},
{0.1, 0.4, -0.05, 0.2, 0.5, 0.05},
{-0.2, 0.4, 0.1, -0.1, 0.5, 0.2},
{-0.05, 0.4, 0.1, 0.05, 0.5, 0.2},
{0.1, 0.4, 0.1, 0.2, 0.5, 0.2},
},
},
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},
},
groups = piece_group,
can_dig = function(pos, placer)
local player = placer:get_player_name()
return is_owner(pos, player)
end,
after_place_node = function(pos, placer)
local meta = minetest.env:get_meta(pos)
local player = placer:get_player_name()
meta:set_string("infotext", "[Chess] "..player)
meta:set_string("owner", player)
end,
})
--Knight
minetest.register_node("chess:knight_"..colors[color],
{
description = 'Knight ('..colors[color]..')',
tiles = {"chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color].."_side.png", "chess_piece_"..colors[color].."_side.png"},
drawtype = "nodebox",
sunlight_propagates = true,
paramtype = 'light',
paramtype2 = "facedir",
light_source = 8,
node_box = {
type = "fixed",
fixed = {
{-0.2, -0.5, -0.3, 0.2, -0.4, 0.3},
{-0.3, -0.5, -0.2, 0.3, -0.4, 0.2},
{-0.1, -0.4, -0.2, 0.1, -0.3, 0.2},
{-0.2, -0.4, -0.1, 0.2, -0.3, 0.1},
{-0.1, -0.3, -0.1, 0.1, 0.45, 0.1},
{-0.1, -0.2, -0.2, 0.1, 0.1, 0.15},
{-0.15, -0.2, -0.1, 0.15, 0.1, 0.1},
{-0.1, 0.2, -0.25, 0.1, 0.35, 0.15},
{-0.1, 0.45, 0.01, -0.07, 0.5, 0.06},
{0.07, 0.45, 0.01, 0.1, 0.5, 0.06},
},
},
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},
},
groups = piece_group,
can_dig = function(pos, placer)
local player = placer:get_player_name()
return is_owner(pos, player)
end,
after_place_node = function(pos, placer)
local meta = minetest.env:get_meta(pos)
local player = placer:get_player_name()
meta:set_string("infotext", "[Chess] "..player)
meta:set_string("owner", player)
end,
})
--Bishop
minetest.register_node("chess:bishop_"..colors[color],
{
description = 'Bishop ('..colors[color]..')',
tiles = {"chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color].."_side.png", "chess_piece_"..colors[color].."_side.png"},
drawtype = "nodebox",
sunlight_propagates = true,
paramtype = 'light',
paramtype2 = "facedir",
light_source = 8,
node_box = {
type = "fixed",
fixed = {
{-0.2, -0.5, -0.3, 0.2, -0.4, 0.3},
{-0.3, -0.5, -0.2, 0.3, -0.4, 0.2},
{-0.1, -0.4, -0.2, 0.1, -0.3, 0.2},
{-0.2, -0.4, -0.1, 0.2, -0.3, 0.1},
{-0.1, -0.3, -0.1, 0.1, 0.4, 0.1},
{-0.1, 0, -0.2, 0.1, 0.1, 0.2},
{-0.2, 0, -0.1, 0.2, 0.1, 0.1},
{-0.1, 0.15, -0.2, 0.1, 0.35, 0.2},
{-0.2, 0.15, -0.1, 0.2, 0.35, 0.1 },
{-0.05, 0.4, -0.05, 0.05, 0.5, 0.05},
},
},
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},
},
groups = piece_group,
can_dig = function(pos, placer)
local player = placer:get_player_name()
return is_owner(pos, player)
end,
after_place_node = function(pos, placer)
local meta = minetest.env:get_meta(pos)
local player = placer:get_player_name()
meta:set_string("infotext", "[Chess] "..player)
meta:set_string("owner", player)
end,
})
--Queen
minetest.register_node("chess:queen_"..colors[color],
{
description = 'Queen ('..colors[color]..')',
tiles = {"chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color].."_side.png", "chess_piece_"..colors[color].."_side.png"},
drawtype = "nodebox",
sunlight_propagates = true,
paramtype = 'light',
paramtype2 = "facedir",
light_source = 8,
node_box = {
type = "fixed",
fixed = {
{-0.2, -0.5, -0.3, 0.2, -0.4, 0.3},
{-0.3, -0.5, -0.2, 0.3, -0.4, 0.2},
{-0.1, -0.4, -0.2, 0.1, -0.3, 0.2},
{-0.2, -0.4, -0.1, 0.2, -0.3, 0.1},
{-0.1, -0.3, -0.1, 0.1, 0.2, 0.1},
{-0.1, 0, -0.2, 0.1, 0.1, 0.2},
{-0.2, 0, -0.1, 0.2, 0.1, 0.1},
{-0.1, 0.2, -0.2, 0.1, 0.4, 0.2},
{-0.2, 0.2, -0.1, 0.2, 0.4, 0.1},
{-0.07, 0.4, -0.19, 0.07, 0.44, -0.11},
{-0.07, 0.4, 0.11, 0.07, 0.44, 0.19},
{-0.19, 0.4, -0.07, -0.11, 0.44, 0.07},
{0.11, 0.4, -0.07, 0.19, 0.44, 0.07},
{-0.04, 0.4, -0.07, 0.04, 0.46, 0.07},
{-0.07, 0.4, -0.04, 0.07, 0.46, 0.04},
{-0.04, 0.46, -0.04, 0.04, 0.49, 0.04},
},
},
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},
},
groups = piece_group,
can_dig = function(pos, placer)
local player = placer:get_player_name()
return is_owner(pos, player)
end,
after_place_node = function(pos, placer)
local meta = minetest.env:get_meta(pos)
local player = placer:get_player_name()
meta:set_string("infotext", "[Chess] "..player)
meta:set_string("owner", player)
end,
})
--King
minetest.register_node("chess:king_"..colors[color],
{
description = 'King ('..colors[color]..')',
tiles = {"chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color].."_side.png", "chess_piece_"..colors[color].."_side.png"},
drawtype = "nodebox",
sunlight_propagates = true,
paramtype = 'light',
paramtype2 = "facedir",
light_source = 8,
node_box = {
type = "fixed",
fixed = {
{-0.2, -0.5, -0.3, 0.2, -0.4, 0.3},
{-0.3, -0.5, -0.2, 0.3, -0.4, 0.2},
{-0.1, -0.4, -0.2, 0.1, -0.3, 0.2},
{-0.2, -0.4, -0.1, 0.2, -0.3, 0.1},
{-0.1, -0.3, -0.1, 0.1, 0.2, 0.1},
{-0.1, 0, -0.2, 0.1, 0.1, 0.2},
{-0.2, 0, -0.1, 0.2, 0.1, 0.1},
{-0.1, 0.2, -0.2, 0.1, 0.4, 0.2},
{-0.2, 0.2, -0.1, 0.2, 0.4, 0.1},
{-0.02, 0.4, -0.02, 0.02, 0.5, 0.02},
{-0.02, 0.43, -0.05, 0.02, 0.47, 0.05},
{-0.05, 0.43, -0.02, 0.05, 0.47, 0.02},
},
},
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},
},
groups = piece_group,
can_dig = function(pos, placer)
local player = placer:get_player_name()
return is_owner(pos, player)
end,
after_place_node = function(pos, placer)
local meta = minetest.env:get_meta(pos)
local player = placer:get_player_name()
meta:set_string("infotext", "[Chess] "..player)
meta:set_string("owner", player)
end,
on_punch = function(pos, node, puncher)
local meta = minetest.env:get_meta(pos)
local owner = minetest.env:get_meta(pos):get_string("owner")
local player = puncher:get_player_name()
local p = {x=pos.x, y=pos.y, z=pos.z}
local n = minetest.env:get_node(p)
local plo
if (owner == "") then
local meta = minetest.env:get_meta(pos)
meta:set_string("infotext", "[Chess] "..player)
meta:set_string("owner", player)
if ( n.name == "chess:king_white" ) then
minetest.chat_send_all("[Chess] "..player .. " plays as WHITE")
plo = {x=pos.x+3, y=pos.y, z=pos.z}
else
minetest.chat_send_all("[Chess] "..player .. " plays as BLACK")
plo = {x=pos.x+3, y=pos.y, z=pos.z-1}
end
for i = 0, 7, 1 do
local p = {x=plo.x-i, y=plo.y, z=plo.z+1}
local meta = minetest.env:get_meta(p)
meta:set_string("infotext", "[Chess] "..player)
meta:set_string("owner", player)
local pt = {x=plo.x-i, y=plo.y, z=plo.z}
local meta = minetest.env:get_meta(pt)
meta:set_string("infotext", "[Chess] "..player)
meta:set_string("owner", player)
end
end
end,
})
end

View File

@ -1,34 +0,0 @@
_______ __ __ _______ _______ _______
| || | | || || || |
| || |_| || ___|| _____|| _____|
| || || |___ | |_____ | |_____
| _|| || ___||_____ ||_____ |
| |_ | _ || |___ _____| | _____| |
|_______||__| |__||_______||_______||_______|
BY: bas080
DESCRIPTION: Play chess in Minetest
VERSION: 1.0
LICENCE: WTFPL
FORUM: http://minetest.net/forum/viewtopic.php?id=2784
Changelog
1.0
* Added node ownership by punshing king
* Changed craft for chess spawner
0.5
* Chessboard with numbered and lettered border
* Added craft for chess spawner
0.2
* Tonyka contributed nodes for chess pieces
* Improved chess spawner with chess pieces
0.1
* Rubenwardy made code layout
* Chess spawner
Licence
WTFPL

View File

@ -1,12 +0,0 @@
-- CHESS MOD
-- =================================================
-- chess/rules.lua
-- =================================================
-- Registers the chess pieces
--
-- Contents:
--
-- [func] update(command) - Manages /move rook to A6
-- [func] checkMove(piece,target) - checks the piece can get there
-- [func] takePiece(piece)
-- =================================================

Binary file not shown.

Before

Width:  |  Height:  |  Size: 723 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 773 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 581 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 578 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 550 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 608 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 645 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 567 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 523 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 670 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 740 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 665 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 668 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 697 B

View File

@ -5,156 +5,137 @@ creative_inventory.creative_inventory_size = 0
-- Create detached creative inventory after loading all mods
minetest.after(0, function()
local inv = minetest.create_detached_inventory("creative", {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
return 0
end,
allow_put = function(inv, listname, index, stack, player)
return 0
end,
allow_take = function(inv, listname, index, stack, player)
return -1
end,
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
end,
on_put = function(inv, listname, index, stack, player)
end,
on_take = function(inv, listname, index, stack, player)
print(player:get_player_name().." takes item from creative inventory; listname="..dump(listname)..", index="..dump(index)..", stack="..dump(stack))
if stack then
print("stack:get_name()="..dump(stack:get_name())..", stack:get_count()="..dump(stack:get_count()))
end
end,
})
local creative_list = {}
for name,def in pairs(minetest.registered_items) do
if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0) and def.description and def.description ~= "" then
table.insert(creative_list, name)
local inv = minetest.create_detached_inventory("creative", {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if minetest.setting_getbool("creative_mode") then
return count
else
return 0
end
end,
allow_put = function(inv, listname, index, stack, player)
if minetest.setting_getbool("creative_mode") then
return -1
else
return 0
end
end,
allow_take = function(inv, listname, index, stack, player)
if minetest.setting_getbool("creative_mode") then
return -1
else
return 0
end
end,
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
end,
on_put = function(inv, listname, index, stack, player)
end,
on_take = function(inv, listname, index, stack, player)
print(player:get_player_name().." takes item from creative inventory; listname="..dump(listname)..", index="..dump(index)..", stack="..dump(stack))
if stack then
print("stack:get_name()="..dump(stack:get_name())..", stack:get_count()="..dump(stack:get_count()))
end
end,
})
local creative_list = {}
for name,def in pairs(minetest.registered_items) do
if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0)
and def.description and def.description ~= "" then
table.insert(creative_list, name)
end
end
end
table.sort(creative_list)
inv:set_size("main", #creative_list)
for _,itemstring in ipairs(creative_list) do
local stack = ItemStack(itemstring)
-- Make a stack of the right number of items
local stack2 = nil
if stack:get_stack_max() == 1 then
stack2 = ItemStack(stack:get_name())
else
-- Insert half full so that a taken stack can be put back
stack2 = ItemStack(stack:get_name().." "..(99))
table.sort(creative_list)
inv:set_size("main", #creative_list)
for _,itemstring in ipairs(creative_list) do
local stack = ItemStack(itemstring)
-- Make a stack of the right number of items
local stack2 = nil
if stack:get_stack_max() == 1 then
stack2 = ItemStack(stack:get_name())
else
-- Insert half full so that a taken stack can be put back
stack2 = ItemStack(stack:get_name().." "..(999))
end
inv:add_item("main", stack2)
end
inv:add_item("main", stack2)
end
creative_inventory.creative_inventory_size = #creative_list
print("creative inventory size: "..dump(creative_inventory.creative_inventory_size))
creative_inventory.creative_inventory_size = #creative_list
print("creative inventory size: "..dump(creative_inventory.creative_inventory_size))
end)
creative_inventory.set_creative_formspec = function(player, start_i, pagenum)
pagenum = math.floor(pagenum)
local pagemax = math.floor((creative_inventory.creative_inventory_size-1) / (5*8) + 1)
player:set_inventory_formspec("size[8,8]"..
"list[current_player;main;0,0;8,2;]"..
"list[detached:creative;main;0,3;8,5;"..tostring(start_i).."]"..
"button[0,2;1,1;creative_prev;<]"..
"button[1,2;1,1;creative_next;>]"..
"label[2,2;"..tostring(pagenum).."/"..tostring(pagemax).."]"..
"button[6,2;2,1;creative_clear;Clear]"..
"button[4,2;2,1;creative_switchpalette;Palette]")
end
creative_inventory.set_default_formspec = function(player)
player:set_inventory_formspec(
"size[8,8]"..
"list[current_player;craft;2.5,0;3,3;]"..
"list[current_player;craftpreview;3.5,3;1,1;]"..
"list[current_player;main;0,4;8,4;]")
player:get_inventory():set_size("main", 4*8)
player:get_inventory():set_width("craft", 3)
player:get_inventory():set_size("craft", 3*3)
player:get_inventory():set_size("craftpreview", 1)
pagenum = math.floor(pagenum)
local pagemax = math.floor((creative_inventory.creative_inventory_size-1) / (5*8) + 1)
player:set_inventory_formspec("size[9,8.5]"..
"list[current_player;main;0.5,0.3;8,2;]"..
"list[detached:creative;main;0.5,3.3;8,5;"..tostring(start_i).."]"..
"button[0.5,2.3;1,1;creative_prev;<]"..
"button[1.5,2.3;1,1;creative_next;>]"..
"label[2.5,2.4;"..tostring(pagenum).."/"..tostring(pagemax).."]"..
"button[6.5,2.3;2,1;creative_clear;Clear]"..
"button[4.5,2.3;2,1;creative_switchpalette;Palette]")
end
minetest.register_on_joinplayer(function(player)
-- If in creative mode, modify player's inventory forms
if not minetest.setting_getbool("creative_mode") then
creative_inventory.set_default_formspec(player)
return
end
creative_inventory.set_creative_formspec(player, 0, 1)
-- If in creative mode, modify player's inventory forms
if not minetest.setting_getbool("creative_mode") then
return
end
creative_inventory.set_creative_formspec(player, 0, 1)
end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
if not minetest.setting_getbool("creative_mode") then
--return
end
-- Figure out current page from formspec
local current_page = 0
local formspec = player:get_inventory_formspec()
local start_i = string.match(formspec, "list%[detached:creative;main;[%d.]+,[%d.]+;[%d.]+,[%d.]+;(%d+)%]")
start_i = tonumber(start_i) or 0
if not minetest.setting_getbool("creative_mode") then
return
end
-- Figure out current page from formspec
local current_page = 0
local formspec = player:get_inventory_formspec()
local start_i = string.match(formspec, "list%[detached:creative;main;[%d.]+,[%d.]+;[%d.]+,[%d.]+;(%d+)%]")
start_i = tonumber(start_i) or 0
if fields.creative_prev then
start_i = start_i - 8*5
end
if fields.creative_next then
start_i = start_i + 8*5
end
if fields.creative_clear then
local inv = minetest.get_inventory({type='player',name=player:get_player_name()})
for i=1,32 do
local stack = inv:get_stack("main", i)
if stack ~= nil and not stack:is_empty() then
inv:set_stack("main", i, nil)
end
if fields.creative_prev then
start_i = start_i - 8*5
end
end
if fields.creative_switchpalette then
local inv = minetest.get_inventory({type='player',name=player:get_player_name()})
local items = {}
for i=1,8 do
local stack = inv:get_stack("main", i)
local switchstack = inv:get_stack("main", (i+8))
items[i] = {}
items[i] = {name=switchstack:get_name(),count=switchstack:get_count()}
items[i+8] = {name=stack:get_name(),count=stack:get_count()}
if fields.creative_next then
start_i = start_i + 8*5
end
for i =1,16 do
if items[i].name and items[i].count then
inv:set_stack("main", (i), ItemStack(items[i].name.." "..items[i].count))
else
inv:set_stack("main", i, nil)
end
if fields.creative_clear then
local inv = minetest.get_inventory({type='player',name=player:get_player_name()})
for i=1,32 do
local stack = inv:get_stack("main", i)
if stack ~= nil and not stack:is_empty() then
inv:set_stack("main", i, nil)
end
end
end
if fields.creative_switchpalette then
local inv = minetest.get_inventory({type='player',name=player:get_player_name()})
local items = {}
for i=1,8 do
local stack = inv:get_stack("main", i)
local switchstack = inv:get_stack("main", (i+8))
items[i] = {}
items[i] = {name=switchstack:get_name(),count=switchstack:get_count()}
items[i+8] = {name=stack:get_name(),count=stack:get_count()}
end
for i =1,16 do
if items[i].name and items[i].count then
inv:set_stack("main", (i), ItemStack(items[i].name.." "..items[i].count))
else
inv:set_stack("main", i, nil)
end
end
end
if start_i < 0 then
start_i = start_i + 8*5
end
if start_i >= creative_inventory.creative_inventory_size then
start_i = start_i - 8*5
end
if start_i < 0 or start_i >= creative_inventory.creative_inventory_size then
start_i = 0
end
end
if start_i < 0 then
start_i = start_i + 8*5
end
if start_i >= creative_inventory.creative_inventory_size then
start_i = start_i - 8*5
end
if start_i < 0 or start_i >= creative_inventory.creative_inventory_size then
start_i = 0
end
creative_inventory.set_creative_formspec(player, start_i, start_i / (5*8) + 1)
creative_inventory.set_creative_formspec(player, start_i, start_i / (5*8) + 1)
end)
minetest.register_privilege("creative", "Can toggle between creative and non creative modes")
minetest.register_chatcommand("creative", {
privs = {creative=true},
params = "<state>",
description = "Enable or disable creative mode for player",
func = function(player, param)
if param == "on" then
minetest.chat_send_player(player, "Creative mode enabled")
creative_inventory.set_creative_formspec(minetest.get_player_by_name(player), 0, 1)
end
if param == "off" then
minetest.chat_send_player(player, "Creative mode disabled")
creative_inventory.set_default_formspec(minetest.get_player_by_name(player))
end
end
})

View File

@ -24,8 +24,9 @@ minetest.register_craft({
minetest.register_craft({
output = 'default:fence_wood 2',
recipe = {
{'default:stick', 'default:stick', 'default:stick'},
{'default:stick', 'default:stick', 'default:stick'},
{'default:wood', '', 'default:wood'},
{'default:wood', 'default:wood', 'default:wood'},
{'default:wood', '', 'default:wood'},
}
})

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 B

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 B

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 B

After

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 665 KiB

View File

@ -1,82 +0,0 @@
minetest.register_node("demon:demon", {
description = "Demon",
drawtype = "node",
paramtype = "light",
paramtype2 = "facedir",
tiles = {"demon_side.png","demon_side.png","demon_side.png","demon_side.png","demon_eyes_open.png", "demon_side.png"},
damage_per_second = 10,
light_source = 3,
walkable = false,
buildable_to = true,
on_punch = function(pos, node, puncher)
local health = puncher:get_hp()
puncher:set_hp(health-2)
end,
})
minetest.register_abm({ --remove bees
nodenames = {"demon:demon"},
interval = 2.5,
chance = 1,
action = function(pos, node, _, _)
local meta = minetest.get_meta(pos)
local range = 40
local player = meta:get_string("player")
if player == nil or player == "" then
for _,player in pairs(minetest.get_connected_players()) do
local s = pos
local p = player:getpos()
local dist = vector.distance(s,p)
if dist < range then
meta:set_string("player", player:get_player_name())
return
end
end
end
local player = meta:get_string("player")
if player == nil or player == "" then return end
local name = player
local player = minetest.get_player_by_name(player)
if player == nil or player == "" then return end
local posp = player:getpos()
local newpos = {x = (pos.x + posp.x) / 2, y = (pos.y + posp.y) / 2 +1, z = (pos.z + posp.z) / 2}
local face = minetest.dir_to_facedir(vector.direction(pos, newpos), false)
if minetest.get_node(newpos).name ~= "air" then return end
if vector.distance(newpos, posp) < 3 then
local health = player:get_hp()
player:set_hp(health-2)
minetest.sound_play({name="demon_move"},{pos=newpos, max_hear_distance=32, gain=1.5})
minetest.remove_node(pos)
return
end
if minetest.get_node_light(newpos, nil) > 2 then
if minetest.get_node_light(newpos, nil) > 8 then
minetest.remove_node(pos)
minetest.sound_play({name="demon_remove"},{pos=newpos, max_hear_distance=32, gain=1})
end
if node.param2 ~= face then
minetest.set_node(pos, {name=node.name, param2 = face} )
end
return
end
minetest.remove_node(pos)
minetest.set_node(newpos, {name="demon:demon", param2 = face})
local meta = minetest.get_meta(newpos)
meta:set_string("player", name)
minetest.sound_play({name="demon_move"},{pos=newpos, max_hear_distance=32, gain=1})
end,
})
minetest.register_abm({
nodenames = {"default:grass_5"},
neighbors = {"default:tree"},
interval = 60,
chance = 4,
action = function(pos, node, _, _)
if minetest.get_node_light(pos, nil) < 3 then
minetest.set_node(pos, {name="demon:demon"})
end
end,
})

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 B

Some files were not shown because too many files have changed in this diff Show More