Finished news system

This commit is contained in:
Billy S 2019-04-21 18:33:42 -04:00
parent ffbde14977
commit fee92c0cc7
4 changed files with 6 additions and 2 deletions

View File

@ -5,7 +5,7 @@ function kingdoms.get_gui(pname, tab)
if tab == nil or tab == "news" then
fs = fs .. "textlist[0,1;7.8,8;newslist;Server News:,"
-- Get news and break it into lines
local ntable = kingdoms.get_news(20)
local ntable = kingdoms.get_news(30)
local nidx = 1
local lidx
local lines

View File

@ -10,7 +10,7 @@ dofile(mp .. "/helpers.lua")
-- Config
kingdoms.marker_radius = 100
kingdoms.marker_capture_time = 300 -- Seconds
kingdoms.marker_capture_time = 10 -- Seconds
kingdoms.marker_capture_range = 5
-- Generated based on config

View File

@ -97,6 +97,7 @@ function kingdoms.add_kingdom(name, king)
}
-- Add owner
kingdoms.add_player_to_kingdom(name, king, "king")
kingdoms.add_news("Kingdom " .. name .. " was created")
-- Save
kingdoms.helpers.save()
return true, "Added kingdom " .. name
@ -126,6 +127,7 @@ function kingdoms.remove_kingdom(name)
end
-- Remove kingdom
kingdoms.kingdoms[name] = nil
kingdoms.add_news("Kingdom " .. name .. " was disbanded")
-- Save
kingdoms.helpers.save()
return true, "Removed kingdom " .. name

View File

@ -15,6 +15,7 @@ local function cancel_attack(meta, dname, aname)
meta:set_string("infotext", get_infotext(dname))
minetest.chat_send_all("Kingdom " .. dname ..
" warded off the attack of kingdom " .. aname .. "!")
kingdoms.add_news("Kingdom " .. aname .. " attacked a territory of kingdom " .. dname .. " but failed to capture it")
end
local function finish_attack(pos, hpos, meta, dname, aname)
@ -23,6 +24,7 @@ local function finish_attack(pos, hpos, meta, dname, aname)
meta:set_string("infotext", get_infotext(aname))
minetest.swap_node(pos, {name = "kingdoms:marker_" .. string.lower(kingdoms.kingdoms[aname].color)})
minetest.chat_send_all("Kingdom " .. aname .. " conquered a territory of kingdom " .. dname)
kingdoms.add_news("Kingdom " .. aname .. " captured a territory from kingdom " .. dname)
kingdoms.helpers.save()
end