Fixes + half the war are done

This commit is contained in:
shamoanjac 2016-08-15 18:29:47 +02:00
parent e4dc4965f5
commit a457da2b98

View File

@ -37,6 +37,12 @@ minetest.register_craftitem("banners:death_sheet", {
inventory_image = "death_sheet.png" inventory_image = "death_sheet.png"
}) })
minetest.register_craftitem("banners:death_base", {
groups = {},
description = "Death base",
inventory_image = "death_base.png"
})
-- crafts -- crafts
@ -51,6 +57,16 @@ minetest.register_craft( -- silver flag pole
} }
) )
minetest.register_craft( -- death flag pole
{
output = "banners:death_pole 1",
recipe = {
{"", "", "default:diamond"},
{"", "default:obsidian", ""},
{"default:obsidian", "", ""}
}
}
)
minetest.register_craft( -- golden finial minetest.register_craft( -- golden finial
{ {
@ -82,6 +98,25 @@ minetest.register_craft( -- golden sheet
} }
) )
minetest.register_craft( -- death sheet
{
output = "banners:death_sheet 1",
type = "shapeless",
recipe = { "default:obsidian", "banners:banner_sheet"}
}
)
minetest.register_craft( -- death sheet
{
output = "banners:death_base 1",
recipe = {
{"", "", ""},
{"", "banners:steel_base", ""},
{"default:obsidian", "default:obsidian", "default:obsidian"}
}
}
)
minetest.register_craft( -- power banner minetest.register_craft( -- power banner
{ {
output = "banners:power_banner", output = "banners:power_banner",
@ -93,6 +128,18 @@ minetest.register_craft( -- power banner
} }
) )
minetest.register_craft( -- death banner
{
output = "banners:death_banner",
recipe = {
{"", "banners:death_sheet", ""},
{"", "banners:death_pole", ""},
{"", "banners:death_base", ""}
}
}
)
-- nodes -- nodes
minetest.register_node("banners:power_banner", { minetest.register_node("banners:power_banner", {
drawtype = "mesh", drawtype = "mesh",
@ -111,7 +158,7 @@ minetest.register_node("banners:power_banner", {
banners.banner_on_destruct(pos) banners.banner_on_destruct(pos)
end, end,
on_dig = function(pos, n, p) on_dig = function(pos, n, p)
if minetest.is_protected(pos, p) then if minetest.is_protected(pos, p:get_player_name()) then
return return
end end
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
@ -126,6 +173,39 @@ minetest.register_node("banners:power_banner", {
end, end,
}) })
minetest.register_node("banners:death_banner", {
drawtype = "mesh",
mesh = "banner_support.x",
tiles = {"death_uv.png"},
description = "Death Banner",
groups = {cracky=3},
diggable = true,
stack_max = 1,
paramtype = "light",
paramtype2 = "facedir",
after_place_node = function (pos, player, itemstack, pointed_thing)
banners.after_deathbanner_placed(pos, player, itemstack, pointed_thing)
end,
on_destruct = function(pos)
banners.banner_on_destruct(pos)
end,
on_dig = function(pos, n, p)
if minetest.is_protected(pos, p:get_player_name()) then
return
end
local meta = minetest.get_meta(pos)
local defending_facname = meta:get_string("faction")
local parcelpos = factions.get_parcel_pos(pos)
if defending_facname then
local faction = factions.factions[defending_facname]
if faction then
faction:stop_attack(chunkpos)
end
end
banners.banner_on_dig(pos, n, p)
end,
})
banners.after_powerbanner_placed = function(pos, player, itemstack, pointed_thing) banners.after_powerbanner_placed = function(pos, player, itemstack, pointed_thing)
minetest.get_node(pos).param2 = banners.determine_flag_direction(pos, pointed_thing) minetest.get_node(pos).param2 = banners.determine_flag_direction(pos, pointed_thing)
local faction = factions.players[player:get_player_name()] local faction = factions.players[player:get_player_name()]
@ -140,4 +220,16 @@ banners.after_powerbanner_placed = function(pos, player, itemstack, pointed_thin
minetest.add_entity(pos, "banners:banner_ent") minetest.add_entity(pos, "banners:banner_ent")
end end
banners.after_deathbanner_placed = function(pos, player, itemstack, pointed_thing)
minetest.get_node(pos).param2 = banners.determine_flag_direction(pos, pointed_thing)
local attacking_faction = factions.players[player:get_player_name()]
if attacking_faction then
local parcelpos = factions.get_parcel_pos(pos)
attacking_faction = factions.factions[attacking_faction]
attacking_faction:attack_parcel(parcelpos)
minetest.get_meta(pos):set_string("faction", faction)
end
minetest.get_meta(pos):set_string("banner", "death_uv.png")
minetest.add_entity(pos, "banners:banner_ent")
end