Make team chests the color of the team
|
@ -10,40 +10,47 @@ local chest_formspec =
|
||||||
"listring[current_player;main]" ..
|
"listring[current_player;main]" ..
|
||||||
default.get_hotbar_bg(0,4.85)
|
default.get_hotbar_bg(0,4.85)
|
||||||
|
|
||||||
minetest.register_node("ctf_team_chest:chest", {
|
local colors = {"red", "blue"}
|
||||||
description = "Chest",
|
for _, color in pairs(colors) do
|
||||||
tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
|
minetest.register_node("ctf_team_chest:chest_" .. color, {
|
||||||
"default_chest_side.png", "default_chest_side.png", "default_chest_front.png"},
|
description = "Chest",
|
||||||
paramtype2 = "facedir",
|
tiles = {
|
||||||
groups = {choppy = 2, oddly_breakable_by_hand = 2},
|
"default_chest_top_" .. color .. ".png",
|
||||||
legacy_facedir_simple = true,
|
"default_chest_top_" .. color .. ".png",
|
||||||
is_ground_content = false,
|
"default_chest_side_" .. color .. ".png",
|
||||||
sounds = default.node_sound_wood_defaults(),
|
"default_chest_side_" .. color .. ".png",
|
||||||
on_construct = function(pos)
|
"default_chest_side_" .. color .. ".png",
|
||||||
local meta = minetest.get_meta(pos)
|
"default_chest_front_" .. color .. ".png"},
|
||||||
meta:set_string("formspec", chest_formspec)
|
paramtype2 = "facedir",
|
||||||
meta:set_string("infotext", "Chest")
|
groups = {choppy = 2, oddly_breakable_by_hand = 2},
|
||||||
local inv = meta:get_inventory()
|
legacy_facedir_simple = true,
|
||||||
inv:set_size("main", 8*4)
|
is_ground_content = false,
|
||||||
end,
|
sounds = default.node_sound_wood_defaults(),
|
||||||
can_dig = function(pos,player)
|
on_construct = function(pos)
|
||||||
return false
|
local meta = minetest.get_meta(pos)
|
||||||
end,
|
meta:set_string("formspec", chest_formspec)
|
||||||
on_metadata_inventory_move = function(pos, from_list, from_index,
|
meta:set_string("infotext", "Chest")
|
||||||
to_list, to_index, count, player)
|
local inv = meta:get_inventory()
|
||||||
minetest.log("action", player:get_player_name() ..
|
inv:set_size("main", 8*4)
|
||||||
" moves stuff in chest at " .. minetest.pos_to_string(pos))
|
end,
|
||||||
end,
|
can_dig = function(pos,player)
|
||||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
return false
|
||||||
minetest.log("action", player:get_player_name() ..
|
end,
|
||||||
" moves stuff to chest at " .. minetest.pos_to_string(pos))
|
on_metadata_inventory_move = function(pos, from_list, from_index,
|
||||||
end,
|
to_list, to_index, count, player)
|
||||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
minetest.log("action", player:get_player_name() ..
|
||||||
minetest.log("action", player:get_player_name() ..
|
" moves stuff in chest at " .. minetest.pos_to_string(pos))
|
||||||
" takes stuff from chest at " .. minetest.pos_to_string(pos))
|
end,
|
||||||
end
|
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
})
|
minetest.log("action", player:get_player_name() ..
|
||||||
|
" moves stuff to chest at " .. minetest.pos_to_string(pos))
|
||||||
|
end,
|
||||||
|
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
|
minetest.log("action", player:get_player_name() ..
|
||||||
|
" takes stuff from chest at " .. minetest.pos_to_string(pos))
|
||||||
|
end
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_on_generated(function(minp, maxp, seed)
|
minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
for tname, team in pairs(ctf.teams) do
|
for tname, team in pairs(ctf.teams) do
|
||||||
|
@ -52,7 +59,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
minp.y <= flag.y and maxp.y >= flag.y and
|
minp.y <= flag.y and maxp.y >= flag.y and
|
||||||
minp.z <= flag.z and maxp.z >= flag.z then
|
minp.z <= flag.z and maxp.z >= flag.z then
|
||||||
|
|
||||||
local chest = {name = "ctf_team_chest:chest"}
|
local chest = {name = "ctf_team_chest:chest_" .. team.data.color}
|
||||||
local dz = 2
|
local dz = 2
|
||||||
if flag.z < 0 then
|
if flag.z < 0 then
|
||||||
dz = -2
|
dz = -2
|
||||||
|
|
BIN
mods/ctf_team_chest/textures/default_chest_front_blue.png
Normal file
After Width: | Height: | Size: 625 B |
BIN
mods/ctf_team_chest/textures/default_chest_front_red.png
Normal file
After Width: | Height: | Size: 614 B |
BIN
mods/ctf_team_chest/textures/default_chest_side_blue.png
Normal file
After Width: | Height: | Size: 564 B |
BIN
mods/ctf_team_chest/textures/default_chest_side_red.png
Normal file
After Width: | Height: | Size: 556 B |
BIN
mods/ctf_team_chest/textures/default_chest_top_blue.png
Normal file
After Width: | Height: | Size: 593 B |
BIN
mods/ctf_team_chest/textures/default_chest_top_red.png
Normal file
After Width: | Height: | Size: 587 B |
Before Width: | Height: | Size: 469 B |
|
@ -39,11 +39,9 @@ minetest.register_node("tsm_chests:chest", {
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
if player then
|
if player then
|
||||||
minetest.chat_send_player(player:get_player_name(), "You're not allowed to put things in chests!")
|
minetest.chat_send_player(player:get_player_name(),
|
||||||
|
"You're not allowed to put things in treasure chests!")
|
||||||
return 0
|
return 0
|
||||||
else
|
|
||||||
--minetest.chat_send_all("Error! Non player putting things in chests")
|
|
||||||
return -1
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
|
|
Before Width: | Height: | Size: 423 B After Width: | Height: | Size: 423 B |
Before Width: | Height: | Size: 375 B After Width: | Height: | Size: 375 B |
Before Width: | Height: | Size: 422 B After Width: | Height: | Size: 422 B |