Make team chests the color of the team
|
@ -10,10 +10,17 @@ 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"}
|
||||||
|
for _, color in pairs(colors) do
|
||||||
|
minetest.register_node("ctf_team_chest:chest_" .. color, {
|
||||||
description = "Chest",
|
description = "Chest",
|
||||||
tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
|
tiles = {
|
||||||
"default_chest_side.png", "default_chest_side.png", "default_chest_front.png"},
|
"default_chest_top_" .. color .. ".png",
|
||||||
|
"default_chest_top_" .. color .. ".png",
|
||||||
|
"default_chest_side_" .. color .. ".png",
|
||||||
|
"default_chest_side_" .. color .. ".png",
|
||||||
|
"default_chest_side_" .. color .. ".png",
|
||||||
|
"default_chest_front_" .. color .. ".png"},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {choppy = 2, oddly_breakable_by_hand = 2},
|
groups = {choppy = 2, oddly_breakable_by_hand = 2},
|
||||||
legacy_facedir_simple = true,
|
legacy_facedir_simple = true,
|
||||||
|
@ -42,8 +49,8 @@ minetest.register_node("ctf_team_chest:chest", {
|
||||||
minetest.log("action", player:get_player_name() ..
|
minetest.log("action", player:get_player_name() ..
|
||||||
" takes stuff from chest at " .. minetest.pos_to_string(pos))
|
" takes stuff from chest at " .. minetest.pos_to_string(pos))
|
||||||
end
|
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 |