Add set_message_of_the_day command

This commit is contained in:
Coder12a
2018-10-25 00:21:42 -05:00
parent 9f8db0615c
commit 932645b5a0
3 changed files with 38 additions and 3 deletions

View File

@ -80,6 +80,8 @@ function factions.Faction:new(faction)
default_leader_rank = "leader",
--! @brief faction's description string
description = "Default faction description.",
--! @brief faction's message of the day.
message_of_the_day = "",
--! @brief list of players currently invited (can join with /f join)
invited_players = {},
--! @brief table of claimed parcels (keys are parcelpos strings)
@ -394,6 +396,11 @@ function factions.Faction.set_leader(self, player)
factions.save()
end
function factions.Faction.set_message_of_the_day(self,text)
self.message_of_the_day = text
factions.save()
end
--! @brief check permissions for a given player
--! @return boolean indicating permissions. Players not in faction always receive false
function factions.Faction.has_permission(self, player, permission)
@ -977,6 +984,9 @@ function(player)
if faction:has_permission(name, "diplomacy") then
for _ in pairs(faction.request_inbox) do minetest.chat_send_player(name,"You have diplomatic requests in the inbox.") break end
end
if faction.message_of_the_day ~= "" or faction.message_of_the_day ~= " " then
minetest.chat_send_player(name,faction.message_of_the_day)
end
end
end
)