forked from mtcontrib/factions
Added banners support
This commit is contained in:
parent
4568785238
commit
3445066913
@ -453,6 +453,7 @@ factions.register_command("help", {
|
|||||||
infaction = false,
|
infaction = false,
|
||||||
on_success = function(player, faction, pos, chunkpos, args)
|
on_success = function(player, faction, pos, chunkpos, args)
|
||||||
factions_chat.show_help(player)
|
factions_chat.show_help(player)
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -464,10 +465,33 @@ factions.register_command("spawn", {
|
|||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(player, "Your faction has no spawn set.")
|
minetest.chat_send_player(player, "Your faction has no spawn set.")
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
factions.register_command("power", {
|
||||||
|
description = "Display your faction's power",
|
||||||
|
on_success = function(player, faction, pos, chunkpos, args)
|
||||||
|
minetest.chat_send_player(player, "Power: "..faction.power)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
factions.register_command("setbanner", {
|
||||||
|
description = "Sets the banner you're on as the faction's banner.",
|
||||||
|
faction_permissions = {"banner"},
|
||||||
|
on_success = function(player, faction, pos, chunkpos, args)
|
||||||
|
local meta = minetest.get_meta({x = pos.x, y = pos.y - 1, z = pos.z})
|
||||||
|
local banner = meta:get_string("banner")
|
||||||
|
if not banner then
|
||||||
|
minetest.chat_send_player(player, "No banner found.")
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
faction:set_banner(banner)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
factions.register_command("convert", {
|
factions.register_command("convert", {
|
||||||
description = "Load factions in the old format",
|
description = "Load factions in the old format",
|
||||||
infaction = false,
|
infaction = false,
|
||||||
|
12
factions.lua
12
factions.lua
@ -28,7 +28,7 @@ factions.players = {}
|
|||||||
factions.factions = {}
|
factions.factions = {}
|
||||||
--- settings
|
--- settings
|
||||||
factions.lower_laimable_height = -512
|
factions.lower_laimable_height = -512
|
||||||
factions.power_per_chunk = 0.
|
factions.power_per_chunk = .5
|
||||||
|
|
||||||
---------------------
|
---------------------
|
||||||
--! @brief returns whether a faction can be created or not (allows for implementation of blacklists and the like)
|
--! @brief returns whether a faction can be created or not (allows for implementation of blacklists and the like)
|
||||||
@ -50,7 +50,7 @@ function factions.Faction:new(faction)
|
|||||||
faction = {
|
faction = {
|
||||||
power = 0.,
|
power = 0.,
|
||||||
players = {},
|
players = {},
|
||||||
ranks = {["leader"] = {"disband", "claim", "playerslist", "build", "description", "ranks", "spawn"},
|
ranks = {["leader"] = {"disband", "claim", "playerslist", "build", "description", "ranks", "spawn", "banner"},
|
||||||
["moderator"] = {"claim", "playerslist", "build", "spawn"},
|
["moderator"] = {"claim", "playerslist", "build", "spawn"},
|
||||||
["member"] = {"build"}
|
["member"] = {"build"}
|
||||||
},
|
},
|
||||||
@ -228,6 +228,11 @@ function factions.Faction.delete_rank(self, rank, newrank)
|
|||||||
factions.save()
|
factions.save()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function factions.Faction.set_banner(self, newbanner)
|
||||||
|
self.banner = newbanner
|
||||||
|
self:on_new_banner()
|
||||||
|
end
|
||||||
|
|
||||||
--------------------------
|
--------------------------
|
||||||
-- callbacks for events --
|
-- callbacks for events --
|
||||||
function factions.Faction.on_create(self) --! @brief called when the faction is added to the global faction list
|
function factions.Faction.on_create(self) --! @brief called when the faction is added to the global faction list
|
||||||
@ -275,6 +280,9 @@ end
|
|||||||
function factions.Faction.on_delete_rank(self, rank, newrank)
|
function factions.Faction.on_delete_rank(self, rank, newrank)
|
||||||
--TODO: implement
|
--TODO: implement
|
||||||
end
|
end
|
||||||
|
function factions.Faction.on_new_banner(self)
|
||||||
|
--TODO: implement
|
||||||
|
end
|
||||||
|
|
||||||
--??????????????
|
--??????????????
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user