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,
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
factions_chat.show_help(player)
|
||||
return true
|
||||
end
|
||||
})
|
||||
|
||||
@ -464,10 +465,33 @@ factions.register_command("spawn", {
|
||||
return true
|
||||
else
|
||||
minetest.chat_send_player(player, "Your faction has no spawn set.")
|
||||
return false
|
||||
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", {
|
||||
description = "Load factions in the old format",
|
||||
infaction = false,
|
||||
|
12
factions.lua
12
factions.lua
@ -28,7 +28,7 @@ factions.players = {}
|
||||
factions.factions = {}
|
||||
--- settings
|
||||
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)
|
||||
@ -50,7 +50,7 @@ function factions.Faction:new(faction)
|
||||
faction = {
|
||||
power = 0.,
|
||||
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"},
|
||||
["member"] = {"build"}
|
||||
},
|
||||
@ -228,6 +228,11 @@ function factions.Faction.delete_rank(self, rank, newrank)
|
||||
factions.save()
|
||||
end
|
||||
|
||||
function factions.Faction.set_banner(self, newbanner)
|
||||
self.banner = newbanner
|
||||
self:on_new_banner()
|
||||
end
|
||||
|
||||
--------------------------
|
||||
-- callbacks for events --
|
||||
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)
|
||||
--TODO: implement
|
||||
end
|
||||
function factions.Faction.on_new_banner(self)
|
||||
--TODO: implement
|
||||
end
|
||||
|
||||
--??????????????
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user