Add set_message_of_the_day command
This commit is contained in:
parent
9f8db0615c
commit
932645b5a0
14
README.md
14
README.md
@ -27,10 +27,18 @@ Maybe expand on diplomacy.
|
|||||||
|
|
||||||
Write the forum topic better.
|
Write the forum topic better.
|
||||||
|
|
||||||
Add command to set the faction message of the day.
|
|
||||||
|
|
||||||
Code clean up and optimization.
|
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
|
# COMPLETED BUT NEEDS TESTING LIST
|
||||||
|
|
||||||
None.
|
None.
|
||||||
@ -48,3 +56,5 @@ 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).
|
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.
|
@ -421,6 +421,21 @@ factions.register_command("rank_privileges", {
|
|||||||
end
|
end
|
||||||
},false)
|
},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
|
if factions_config.faction_diplomacy then
|
||||||
factions.register_command("send_alliance", {
|
factions.register_command("send_alliance", {
|
||||||
description = "Send an alliance request to another faction.",
|
description = "Send an alliance request to another faction.",
|
||||||
|
10
factions.lua
10
factions.lua
@ -80,6 +80,8 @@ function factions.Faction:new(faction)
|
|||||||
default_leader_rank = "leader",
|
default_leader_rank = "leader",
|
||||||
--! @brief faction's description string
|
--! @brief faction's description string
|
||||||
description = "Default faction description.",
|
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)
|
--! @brief list of players currently invited (can join with /f join)
|
||||||
invited_players = {},
|
invited_players = {},
|
||||||
--! @brief table of claimed parcels (keys are parcelpos strings)
|
--! @brief table of claimed parcels (keys are parcelpos strings)
|
||||||
@ -394,6 +396,11 @@ function factions.Faction.set_leader(self, player)
|
|||||||
factions.save()
|
factions.save()
|
||||||
end
|
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
|
--! @brief check permissions for a given player
|
||||||
--! @return boolean indicating permissions. Players not in faction always receive false
|
--! @return boolean indicating permissions. Players not in faction always receive false
|
||||||
function factions.Faction.has_permission(self, player, permission)
|
function factions.Faction.has_permission(self, player, permission)
|
||||||
@ -977,6 +984,9 @@ function(player)
|
|||||||
if faction:has_permission(name, "diplomacy") then
|
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
|
for _ in pairs(faction.request_inbox) do minetest.chat_send_player(name,"You have diplomatic requests in the inbox.") break end
|
||||||
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
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user