Make team chests the color of the team

This commit is contained in:
rubenwardy 2015-12-01 00:38:30 +00:00
parent 3c9581bcf0
commit 2a07b2d18f
12 changed files with 44 additions and 39 deletions

View file

@ -10,10 +10,17 @@ local chest_formspec =
"listring[current_player;main]" ..
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",
tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
"default_chest_side.png", "default_chest_side.png", "default_chest_front.png"},
tiles = {
"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",
groups = {choppy = 2, oddly_breakable_by_hand = 2},
legacy_facedir_simple = true,
@ -42,8 +49,8 @@ minetest.register_node("ctf_team_chest:chest", {
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)
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.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
if flag.z < 0 then
dz = -2

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 614 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 469 B

View file

@ -39,11 +39,9 @@ minetest.register_node("tsm_chests:chest", {
sounds = default.node_sound_wood_defaults(),
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
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
else
--minetest.chat_send_all("Error! Non player putting things in chests")
return -1
end
end,
on_construct = function(pos)

View file

Before

Width:  |  Height:  |  Size: 423 B

After

Width:  |  Height:  |  Size: 423 B

View file

Before

Width:  |  Height:  |  Size: 375 B

After

Width:  |  Height:  |  Size: 375 B

View file

Before

Width:  |  Height:  |  Size: 422 B

After

Width:  |  Height:  |  Size: 422 B