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

@ -27,10 +27,18 @@ Maybe expand on diplomacy.
Write the forum topic better.
Add command to set the faction message of the day.
Code clean up and optimization.
Add short worded commands.
Parcels should show up at a more accurate position just like in mc factions.
Allow faction chest to become big when you place two chests by each other like in mc.
mc style tnt.
lag-free fire(if thats possible).
# COMPLETED BUT NEEDS TESTING LIST
None.
@ -47,4 +55,6 @@ Make claim's depth not go to high or low. Or make it act like a protection block
Add a show claim command (show small entity boxes like in protection mod).
Remove banner code.
Remove banner code.
Add command to set the faction message of the day.

View File

@ -421,6 +421,21 @@ factions.register_command("rank_privileges", {
end
},false)
factions.register_command("set_message_of_the_day", {
format = {"string"},
faction_permissions = {"playerslist"},
description = "Sets the message that shows up every time a faction member logs-in.",
global_privileges = {"faction_user"},
on_success = function(player, faction, pos, parcelpos, args)
local s = ""
for i,l in pairs(args.strings) do
s = s .. l .. " "
end
faction:set_message_of_the_day("Message of the day: " .. s)
return true
end
},true)
if factions_config.faction_diplomacy then
factions.register_command("send_alliance", {
description = "Send an alliance request to another faction.",

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
)