Added register_torch and Replace Bluestone Torch
12
games/default/files/bluestone/bluestone_torch/README.txt
Normal file
@ -0,0 +1,12 @@
|
||||
MultiCraft Game mod: bluestone torch
|
||||
====================================
|
||||
|
||||
Code was derived by sofar and MoNTE48 from the 'torches' mod by
|
||||
BlockMen (LGPLv3.0+)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 3.0 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
http://www.gnu.org/licenses/lgpl-3.0.html
|
27
games/default/files/bluestone/bluestone_torch/init.lua
Normal file
@ -0,0 +1,27 @@
|
||||
default.register_torch("bluestone_torch:torch", {
|
||||
description = "Bluestone Torch",
|
||||
tiles = {{
|
||||
name = "bluestone_torch.png",
|
||||
-- name = "bluestone_torch_animated.png",
|
||||
-- animation = {type = "vertical_frames", aspect_w = 32, aspect_h = 32, length = 3.3}
|
||||
}},
|
||||
inventory_image = "bluestone_torch.png",
|
||||
wield_image = "bluestone_torch.png",
|
||||
light_source = 10,
|
||||
groups = {choppy = 2, dig_immediate = 3, flammable = 1, attached_node = 1, torch = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
mesecons = {receptor = {
|
||||
state = mesecon.state.on
|
||||
}},
|
||||
on_blast = mesecon.on_blastnode
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "bluestone_torch:torch 4",
|
||||
recipe = {
|
||||
{"mesecons:wire_00000000_off"},
|
||||
{"default:stick"},}
|
||||
})
|
||||
|
||||
minetest.register_alias("mesecons_torch:mesecon_torch_off", "bluestone_torch:torch")
|
||||
minetest.register_alias("mesecons_torch:mesecon_torch_on", "bluestone_torch:torch")
|
After Width: | Height: | Size: 239 B |
@ -12,3 +12,36 @@ minetest.register_craft({
|
||||
cooktime = 2
|
||||
})
|
||||
|
||||
-- Bluestone Block
|
||||
|
||||
minetest.register_node("mesecons_materials:bluestoneblock", {
|
||||
description = "Bluestone Block",
|
||||
tiles = {"bluestone_block.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 1},
|
||||
light_source = minetest.LIGHT_MAX - 3,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
mesecons = {receptor = {
|
||||
state = mesecon.state.on
|
||||
}},
|
||||
on_blast = mesecon.on_blastnode
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mesecons_materials:bluestoneblock",
|
||||
recipe = {
|
||||
{'mesecons:wire_00000000_off','mesecons:wire_00000000_off','mesecons:wire_00000000_off'},
|
||||
{'mesecons:wire_00000000_off','mesecons:wire_00000000_off','mesecons:wire_00000000_off'},
|
||||
{'mesecons:wire_00000000_off','mesecons:wire_00000000_off','mesecons:wire_00000000_off'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'mesecons:wire_00000000_off 9',
|
||||
recipe = {
|
||||
{'mesecons_materials:bluestoneblock'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_alias("mesecons_torch:bluestoneblock", "mesecons_materials:bluestoneblock")
|
||||
|
Before Width: | Height: | Size: 950 B After Width: | Height: | Size: 950 B |
@ -1,157 +0,0 @@
|
||||
--MESECON TORCHES
|
||||
|
||||
local rotate_torch_rules = function (rules, param2)
|
||||
if param2 == 5 then
|
||||
return mesecon.rotate_rules_right(rules)
|
||||
elseif param2 == 2 then
|
||||
return mesecon.rotate_rules_right(mesecon.rotate_rules_right(rules)) --180 degrees
|
||||
elseif param2 == 4 then
|
||||
return mesecon.rotate_rules_left(rules)
|
||||
elseif param2 == 1 then
|
||||
return mesecon.rotate_rules_down(rules)
|
||||
elseif param2 == 0 then
|
||||
return mesecon.rotate_rules_up(rules)
|
||||
else
|
||||
return rules
|
||||
end
|
||||
end
|
||||
|
||||
local torch_get_output_rules = function(node)
|
||||
local rules = {
|
||||
{x = 1, y = 0, z = 0},
|
||||
{x = 0, y = 0, z = 1},
|
||||
{x = 0, y = 0, z =-1},
|
||||
{x = 0, y = 1, z = 0},
|
||||
{x = 0, y =-1, z = 0}}
|
||||
|
||||
return rotate_torch_rules(rules, node.param2)
|
||||
end
|
||||
|
||||
local torch_get_input_rules = function(node)
|
||||
local rules = {{x = -2, y = 0, z = 0},
|
||||
{x = -1, y = 1, z = 0}}
|
||||
|
||||
return rotate_torch_rules(rules, node.param2)
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mesecons_torch:mesecon_torch_on 4",
|
||||
recipe = {
|
||||
{"mesecons:wire_00000000_off"},
|
||||
{"default:stick"},}
|
||||
})
|
||||
|
||||
local torch_selectionbox =
|
||||
{
|
||||
type = "wallmounted",
|
||||
wall_top = {-0.1, 0.5-0.6, -0.1, 0.1, 0.5, 0.1},
|
||||
wall_bottom = {-0.1, -0.5, -0.1, 0.1, -0.5+0.6, 0.1},
|
||||
wall_side = {-0.5, -0.1, -0.1, -0.5+0.6, 0.1, 0.1},
|
||||
}
|
||||
|
||||
--[[minetest.register_node("mesecons_torch:mesecon_torch_off", {
|
||||
drawtype = "torchlike",
|
||||
tiles = {"jeija_torches_off.png", "jeija_torches_off_ceiling.png", "jeija_torches_off_side.png"},
|
||||
inventory_image = "jeija_torches_off.png",
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
walkable = false,
|
||||
paramtype2 = "wallmounted",
|
||||
selection_box = torch_selectionbox,
|
||||
groups = {dig_immediate = 3, attached_node = 1, not_in_creative_inventory = 1},
|
||||
drop = "mesecons_torch:mesecon_torch_on",
|
||||
sounds = default.node_sound_defaults(),
|
||||
mesecons = {receptor = {
|
||||
state = mesecon.state.off,
|
||||
rules = torch_get_output_rules
|
||||
}},
|
||||
on_blast = mesecon.on_blastnode,
|
||||
})]]
|
||||
|
||||
minetest.register_node("mesecons_torch:mesecon_torch_on", {
|
||||
description = "Bluestone Torch",
|
||||
drawtype = "torchlike",
|
||||
tiles = {"jeija_torches_on.png", "jeija_torches_on_ceiling.png", "jeija_torches_on_side.png"},
|
||||
inventory_image = "jeija_torches_on.png",
|
||||
wield_image = "jeija_torches_on.png",
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
paramtype2 = "wallmounted",
|
||||
selection_box = torch_selectionbox,
|
||||
groups = {dig_immediate = 3, attached_node = 1},
|
||||
light_source = minetest.LIGHT_MAX - 5,
|
||||
sounds = default.node_sound_defaults(),
|
||||
mesecons = {receptor = {
|
||||
state = mesecon.state.on,
|
||||
rules = torch_get_output_rules
|
||||
}},
|
||||
on_blast = mesecon.on_blastnode,
|
||||
})
|
||||
|
||||
minetest.register_alias("mesecons_torch:mesecon_torch_off", "mesecons_torch:mesecon_torch_on")
|
||||
|
||||
--[[minetest.register_abm({
|
||||
nodenames = {"mesecons_torch:mesecon_torch_off","mesecons_torch:mesecon_torch_on"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
local is_powered = false
|
||||
for _, rule in ipairs(torch_get_input_rules(node)) do
|
||||
local src = vector.add(pos, rule)
|
||||
if mesecon.is_power_on(src) then
|
||||
is_powered = true
|
||||
end
|
||||
end
|
||||
|
||||
if is_powered then
|
||||
if node.name == "mesecons_torch:mesecon_torch_on" then
|
||||
minetest.swap_node(pos, {name = "mesecons_torch:mesecon_torch_off", param2 = node.param2})
|
||||
mesecon.receptor_off(pos, torch_get_output_rules(node))
|
||||
end
|
||||
elseif node.name == "mesecons_torch:mesecon_torch_off" then
|
||||
minetest.swap_node(pos, {name = "mesecons_torch:mesecon_torch_on", param2 = node.param2})
|
||||
mesecon.receptor_on(pos, torch_get_output_rules(node))
|
||||
end
|
||||
end
|
||||
})]]
|
||||
|
||||
minetest.register_node("mesecons_torch:bluestoneblock", {
|
||||
description = "Bluestone Block",
|
||||
tiles = {"bluestone_block.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 1},
|
||||
light_source = minetest.LIGHT_MAX - 3,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
mesecons = {receptor = {
|
||||
state = mesecon.state.on,
|
||||
rules = torch_get_output_rules
|
||||
}},
|
||||
on_blast = mesecon.on_blastnode,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mesecons_torch:bluestoneblock",
|
||||
recipe = {
|
||||
{'mesecons:wire_00000000_off','mesecons:wire_00000000_off','mesecons:wire_00000000_off'},
|
||||
{'mesecons:wire_00000000_off','mesecons:wire_00000000_off','mesecons:wire_00000000_off'},
|
||||
{'mesecons:wire_00000000_off','mesecons:wire_00000000_off','mesecons:wire_00000000_off'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'mesecons:wire_00000000_off 9',
|
||||
recipe = {
|
||||
{'mesecons_torch:bluestoneblock'},
|
||||
}
|
||||
})
|
||||
|
||||
-- Param2 Table (Block Attached To)
|
||||
-- 5 = z-1
|
||||
-- 3 = x-1
|
||||
-- 4 = z+1
|
||||
-- 2 = x+1
|
||||
-- 0 = y+1
|
||||
-- 1 = y-1
|
Before Width: | Height: | Size: 161 B |
Before Width: | Height: | Size: 161 B |
Before Width: | Height: | Size: 209 B |
Before Width: | Height: | Size: 168 B |
Before Width: | Height: | Size: 170 B |
Before Width: | Height: | Size: 203 B |
@ -2,7 +2,7 @@
|
||||
-- Basically a switch that can be attached to a wall
|
||||
-- Powers the block 2 nodes behind (using a receiver)
|
||||
mesecon.register_node("mesecons_walllever:wall_lever", {
|
||||
description="Lever",
|
||||
description = "Lever",
|
||||
drawtype = "nodebox",
|
||||
inventory_image = "jeija_wall_lever.png",
|
||||
wield_image = "jeija_wall_lever.png",
|
||||
|
@ -77,7 +77,7 @@ local filters = {
|
||||
return def.groups.stairs
|
||||
end,
|
||||
["bluestone"] = function(name)
|
||||
return name:find("mese") or found_in_list(name, {"^tnt:", "^doors:"})
|
||||
return name:find("mese") or found_in_list(name, {"^bluestone_torch:", "^tnt:", "^doors:"})
|
||||
end,
|
||||
["rail"] = function(name, _, groups)
|
||||
return found_in_list(name, {"^boats:", "^carts:"}) or groups.rail
|
||||
|
@ -1,10 +1,15 @@
|
||||
MultiCraft Game: default
|
||||
========================
|
||||
See license.txt for license information.
|
||||
|
||||
License of source code:
|
||||
-----------------------
|
||||
Copyright (C) 2014-2015 MoNTE48, Maksim D. Gamarnik <MoNTE48@mail.ua>
|
||||
Authors of source code
|
||||
----------------------
|
||||
Originally by celeron55, Perttu Ahola <celeron55@gmail.com> (LGPLv3.0+)
|
||||
Various Minetest developers and contributors (LGPLv3.0+)
|
||||
MoNTE48, Maksim D. Gamarnik <MoNTE48@mail.ua> (LGPLv3.0+)
|
||||
|
||||
The torch code was derived by sofar from the 'torches' mod by
|
||||
BlockMen (LGPLv3.0+)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
@ -13,15 +18,11 @@ the Free Software Foundation; either version 3.0 of the License, or
|
||||
|
||||
http://www.gnu.org/licenses/lgpl-3.0.html
|
||||
|
||||
License of media (sounds)
|
||||
--------------------------------------
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
Authors of media files
|
||||
-----------------------
|
||||
MirceaKitsune (WTFPL):
|
||||
character.x
|
||||
Authors of media (textures, sounds, models and schematics)
|
||||
----------------------------------------------------------
|
||||
Everything not listed in here:
|
||||
celeron55, Perttu Ahola <celeron55@gmail.com> (CC BY-SA 3.0)
|
||||
|
||||
------
|
||||
Glass breaking sounds (CC BY 3.0):
|
||||
@ -116,6 +117,14 @@ wool_coat_movement.ogg from freeSFX.co.uk and has a Creative Commons license
|
||||
sonictechtonic (CC BY 3.0):
|
||||
https://www.freesound.org/people/sonictechtonic/sounds/241872/
|
||||
player_damage.2.ogg
|
||||
|
||||
|
||||
Models
|
||||
------
|
||||
sofar (CC BY-SA 3.0):
|
||||
torch_ceiling.obj
|
||||
torch_floor.obj
|
||||
torch_wall.obj
|
||||
|
||||
Schematics
|
||||
----------
|
||||
|
Before Width: | Height: | Size: 223 B After Width: | Height: | Size: 223 B |
@ -1,119 +1,101 @@
|
||||
local function on_flood(pos, oldnode, newnode)
|
||||
minetest.add_item(pos, ItemStack("default:torch 1"))
|
||||
-- Play flame-extinguish sound if liquid is not an 'igniter'
|
||||
local nodedef = minetest.registered_items[newnode.name]
|
||||
if not (nodedef and nodedef.groups and
|
||||
nodedef.groups.igniter and nodedef.groups.igniter > 0) then
|
||||
minetest.sound_play(
|
||||
"default_cool_lava",
|
||||
{pos = pos, max_hear_distance = 16, gain = 0.1}
|
||||
)
|
||||
end
|
||||
-- Remove the torch node
|
||||
return false
|
||||
end
|
||||
function default.register_torch(name, def)
|
||||
local torch = {
|
||||
description = def.description,
|
||||
drawtype = "mesh",
|
||||
tiles = def.tiles,
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
liquids_pointable = false,
|
||||
light_source = def.light_source,
|
||||
groups = def.groups,
|
||||
drop = name,
|
||||
sounds = def.sounds,
|
||||
floodable = true,
|
||||
mesecons = def.mesecons,
|
||||
on_blast = def.on_blast,
|
||||
on_flood = function(pos, oldnode, newnode)
|
||||
local torch = (oldnode.name:gsub("_wall", "") or oldnode.name:gsub("_celling", "")) or oldnode.name
|
||||
minetest.add_item(pos, ItemStack(torch))
|
||||
-- Play flame-extinguish sound if liquid is not an 'igniter'
|
||||
local nodedef = minetest.registered_items[newnode.name]
|
||||
if not (nodedef and nodedef.groups and
|
||||
nodedef.groups.igniter and nodedef.groups.igniter > 0) then
|
||||
minetest.sound_play(
|
||||
"default_cool_lava",
|
||||
{pos = pos, max_hear_distance = 16, gain = 0.1}
|
||||
)
|
||||
end
|
||||
-- Remove the torch node
|
||||
return false
|
||||
end,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local under = pointed_thing.under
|
||||
local node = minetest.get_node(under)
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
if def and def.on_rightclick and
|
||||
not (placer and placer:is_player() and
|
||||
placer:get_player_control().sneak) then
|
||||
return def.on_rightclick(under, node, placer, itemstack,
|
||||
pointed_thing) or itemstack
|
||||
end
|
||||
local above = pointed_thing.above
|
||||
local wdir = minetest.dir_to_wallmounted(vector.subtract(under, above))
|
||||
local fakestack = itemstack
|
||||
if wdir == 0 then
|
||||
fakestack:set_name(name .. "_ceiling")
|
||||
elseif wdir == 1 then
|
||||
fakestack:set_name(name)
|
||||
else
|
||||
fakestack:set_name(name .. "_wall")
|
||||
end
|
||||
itemstack = minetest.item_place(fakestack, placer, pointed_thing, wdir)
|
||||
itemstack:set_name(name)
|
||||
return itemstack
|
||||
end
|
||||
}
|
||||
|
||||
minetest.register_node("default:torch", {
|
||||
description = "Torch",
|
||||
drawtype = "mesh",
|
||||
mesh = "torch_floor.obj",
|
||||
inventory_image = "default_torch_on_floor.png",
|
||||
wield_image = "default_torch_on_floor.png",
|
||||
tiles = {{
|
||||
name = "default_torch_on_floor.png",
|
||||
-- name = "default_torch_on_floor_animated.png",
|
||||
-- animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
|
||||
}},
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
liquids_pointable = false,
|
||||
light_source = 12,
|
||||
groups = {choppy = 2, dig_immediate = 3, flammable = 1, attached_node = 1, torch = 1},
|
||||
drop = "default:torch",
|
||||
selection_box = {
|
||||
local torch_floor = table.copy(torch)
|
||||
torch_floor.mesh = "torch_floor.obj"
|
||||
torch_floor.inventory_image = def.inventory_image
|
||||
torch_floor.wield_image = def.wield_image
|
||||
torch_floor.selection_box = {
|
||||
type = "wallmounted",
|
||||
wall_bottom = {-1/8, -1/2, -1/8, 1/8, 2/16, 1/8},
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local under = pointed_thing.under
|
||||
local node = minetest.get_node(under)
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
if def and def.on_rightclick and
|
||||
not (placer and placer:is_player() and
|
||||
placer:get_player_control().sneak) then
|
||||
return def.on_rightclick(under, node, placer, itemstack,
|
||||
pointed_thing) or itemstack
|
||||
end
|
||||
}
|
||||
|
||||
local above = pointed_thing.above
|
||||
local wdir = minetest.dir_to_wallmounted(vector.subtract(under, above))
|
||||
local fakestack = itemstack
|
||||
if wdir == 0 then
|
||||
fakestack:set_name("default:torch_ceiling")
|
||||
elseif wdir == 1 then
|
||||
fakestack:set_name("default:torch")
|
||||
else
|
||||
fakestack:set_name("default:torch_wall")
|
||||
end
|
||||
|
||||
itemstack = minetest.item_place(fakestack, placer, pointed_thing, wdir)
|
||||
itemstack:set_name("default:torch")
|
||||
|
||||
return itemstack
|
||||
end,
|
||||
floodable = true,
|
||||
on_flood = on_flood,
|
||||
})
|
||||
|
||||
local groups = {choppy = 2, dig_immediate = 3, flammable = 1, attached_node = 1, torch = 1, not_in_creative_inventory = 1}
|
||||
|
||||
minetest.register_node("default:torch_wall", {
|
||||
drawtype = "mesh",
|
||||
mesh = "torch_wall.obj",
|
||||
tiles = {{
|
||||
name = "default_torch_on_floor.png",
|
||||
-- name = "default_torch_on_floor_animated.png",
|
||||
-- animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
|
||||
}},
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
light_source = 12,
|
||||
groups = groups,
|
||||
drop = "default:torch",
|
||||
selection_box = {
|
||||
local torch_wall = table.copy(torch)
|
||||
torch_wall.mesh = "torch_wall.obj"
|
||||
torch_wall.selection_box = {
|
||||
type = "wallmounted",
|
||||
wall_side = {-1/2, -1/2, -1/8, -1/8, 1/8, 1/8},
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
floodable = true,
|
||||
on_flood = on_flood,
|
||||
})
|
||||
}
|
||||
torch_wall.groups.not_in_creative_inventory = 1
|
||||
|
||||
minetest.register_node("default:torch_ceiling", {
|
||||
drawtype = "mesh",
|
||||
mesh = "torch_ceiling.obj",
|
||||
tiles = {{
|
||||
name = "default_torch_on_floor.png",
|
||||
-- name = "default_torch_on_floor_animated.png",
|
||||
-- animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
|
||||
}},
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
light_source = 12,
|
||||
groups = groups,
|
||||
drop = "default:torch",
|
||||
selection_box = {
|
||||
local torch_ceiling = table.copy(torch)
|
||||
torch_ceiling.mesh = "torch_ceiling.obj"
|
||||
torch_ceiling.selection_box = {
|
||||
type = "wallmounted",
|
||||
wall_top = {-1/8, -1/16, -5/16, 1/8, 1/2, 1/8},
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
floodable = true,
|
||||
on_flood = on_flood,
|
||||
}
|
||||
torch_ceiling.groups.not_in_creative_inventory = 1
|
||||
|
||||
minetest.register_node(":" .. name, torch_floor)
|
||||
minetest.register_node(":" .. name .. "_wall", torch_wall)
|
||||
minetest.register_node(":" .. name .. "_ceiling", torch_ceiling)
|
||||
end
|
||||
|
||||
default.register_torch("default:torch", {
|
||||
description = "Torch",
|
||||
tiles = {{
|
||||
name = "default_torch.png",
|
||||
-- name = "default_torch_animated.png",
|
||||
-- animation = {type = "vertical_frames", aspect_w = 32, aspect_h = 32, length = 3.3}
|
||||
}},
|
||||
inventory_image = "default_torch.png",
|
||||
wield_image = "default_torch.png",
|
||||
light_source = 12,
|
||||
groups = {choppy = 2, dig_immediate = 3, flammable = 1, attached_node = 1, torch = 1},
|
||||
sounds = default.node_sound_wood_defaults()
|
||||
})
|
||||
|