factions_ui get some selected faction details

master
Solebull 2019-06-10 02:33:35 +02:00
parent a6f8c87bf6
commit 7f84316e68
3 changed files with 27 additions and 19 deletions

View File

@ -244,6 +244,8 @@ It's really fast. May be used on a website, to show the actual map.
[mg_villages] ERROR: Did not find a suitable replacement for cottages:barrel_lying (suggested but inexistant: cottages:barrel_lying). Building: chateau_without_garden.
[mg_villages] ERROR: Did not find a suitable replacement for cottages:barrel (suggested but inexistant: cottages:barrel). Building: chateau_without_garden.
**** TODO [feature_FactionUI] Try to add a factions UI
CLOCK: [2019-06-10 lun. 02:17]--[2019-06-10 lun. 02:33] => 0:16
CLOCK: [2019-06-10 lun. 01:56]--[2019-06-10 lun. 02:17] => 0:21
CLOCK: [2019-06-09 dim. 22:28]--[2019-06-10 lun. 00:13] => 1:45
CLOCK: [2019-06-06 jeu. 19:28]--[2019-06-06 jeu. 19:55] => 0:27
CLOCK: [2019-06-06 jeu. 19:22]--[2019-06-06 jeu. 19:25] => 0:03
@ -252,9 +254,11 @@ It's really fast. May be used on a website, to show the actual map.
- [X] create factions_ui/ mod
- [X] The game doesn't run anymore
- [X] Should register new inventory formspec
- [-] First list actual factions
- [X] There's still the inventory
- [X] First list actual factions
- [X] Updating actual formspec will be hard
- [ ] Feed label content with factions infos
- [X] Feed label content with factions infos
- [ ] Members and leader still at nil
- [ ] Just add a create button with a name textedit
xpro/sfinv.lua calls a register_page function
**** DONE [feature_Minetest0.5] Must test this with Minetest 0.5.0

3
TODO
View File

@ -11,7 +11,8 @@ minetest-solebull - LGPL-2.1 - A PVP/faction game for minetest based on Cobalt.
* v0.0.2-6 (11 Mar. 2019 - ???) CLOC ???,???
- (6) Update factions formspec in real time
- (7) factions_ui get some selected faction details
- Update factions formspec in real time
- Shows the factions_ui inventory page
- Start the factions_ui mod
- Finally closes #2 updating 3d_armor models

View File

@ -10,24 +10,29 @@ get_factions_ui = function(faction_id)
end
local facnames = table.concat(t, ",")
local fname = "";
local fname = ""
local power = ""
local members = ""
local leader = ""
if faction_id > 0 then
local faction = list[0]
fname = faction.name;
fname = list[faction_id];
local faction = factions.get_faction(fname)
power = faction.power..'/'..faction.maxpower
members = #factions.players
leader = faction.leader or factions.players[0] or "---"
end
return [[
label[0,0;Nom :]
label[3,0;]]..fname..[[]
textlist[0,1;7,3;faclist;]]..facnames..[[]
image[3,4.75;1,1;gui_hb_bg.png]
image[4,4.75;1,1;gui_hb_bg.png]
image[5,4.75;1,1;gui_hb_bg.png]
image[6,4.75;1,1;gui_hb_bg.png]
image[7,4.75;1,1;gui_hb_bg.png]
local formspec = [[
label[0,0;Nom :] label[2,0;]]..fname..[[]
label[0,0.25;Leader :] label[2,0.25;]]..leader..[[]
label[0,0.5;Puissance :] label[2,0.5;]]..power..[[]
label[0,0.75;Membres :] label[2,0.75;]]..members..[[]
textlist[0,2;7,4;faclist;]]..facnames..[[]
]]
minetest.log("error", formspec)
return formspec
end
sfinv.register_page("sfinv:factions_ui", {
@ -36,11 +41,9 @@ sfinv.register_page("sfinv:factions_ui", {
context.faction_idx = 0
end,
get = function(self, player, context)
minetest.log("error", "Listing faction :")
return sfinv.make_formspec(player, context,
get_factions_ui(context.faction_idx),
true)
false)
end,