Handle Create button event
parent
b07be44c6d
commit
c8f3eae964
|
@ -33,11 +33,7 @@ get_factions_ui = function(faction_id)
|
|||
fname = list[faction_id];
|
||||
local faction = factions.get_faction(fname)
|
||||
power = faction.power..'/'..faction.maxpower
|
||||
|
||||
|
||||
-- members = #faction.players
|
||||
members = fac_player_count(faction)
|
||||
|
||||
leader = faction.leader or faction.players[0] or "---"
|
||||
if faction.join_free then
|
||||
iotext = "false"
|
||||
|
@ -55,7 +51,7 @@ get_factions_ui = function(faction_id)
|
|||
label[0,1;Invite-only :] label[2,1;]]..iotext..[[]
|
||||
textlist[0,2;7,4;faclist;]]..facnames..[[]
|
||||
field[5,1;2,1;name;Nouvelle faction :;newFaction]
|
||||
button[7,1;2,1;name;Créer]
|
||||
button[5,3;2,1;name;Créer]
|
||||
]]
|
||||
return formspec
|
||||
end
|
||||
|
@ -75,9 +71,12 @@ sfinv.register_page("sfinv:factions_ui", {
|
|||
on_player_receive_fields = function(self, player, context, fields)
|
||||
local event = minetest.explode_textlist_event(fields.faclist)
|
||||
if event.type == "CHG" then
|
||||
-- We're selecting a new faction name
|
||||
context.faction_idx= event.index
|
||||
sfinv.set_player_inventory_formspec(player, context)
|
||||
|
||||
elseif event.type == "INV" then
|
||||
-- We clicked the Create button
|
||||
print("Creating new faction")
|
||||
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue