Close formspec when faction is added
parent
fa79477146
commit
7d8c07c7e6
13
ROADMAP
13
ROADMAP
|
@ -254,6 +254,7 @@ It's really fast. May be used on a website, to show the actual map.
|
|||
Maybe used with https://github.com/octacian/spawnpoint
|
||||
**** TODO [feature_FactionUI] Try to add a factions UI
|
||||
:LOGBOOK:
|
||||
CLOCK: [2020-03-18 mer. 22:26]--[2020-03-18 mer. 22:41] => 0:15
|
||||
CLOCK: [2020-03-10 mar. 13:15]--[2020-03-10 mar. 13:33] => 0:18
|
||||
CLOCK: [2020-02-07 ven. 08:59]--[2020-02-07 ven. 09:12] => 0:13
|
||||
CLOCK: [2019-12-03 mar. 12:04]--[2019-12-03 mar. 12:42] => 0:38
|
||||
|
@ -292,13 +293,17 @@ It's really fast. May be used on a website, to show the actual map.
|
|||
- [X] Just add a create button with a name textedit
|
||||
xpro/sfinv.lua calls a register_page function
|
||||
- [X] Must correctly place 'Créer' button
|
||||
- [-] Handle new faction button event
|
||||
- [X] Handle new faction button event
|
||||
- [X] Must get the faction name from lineedit
|
||||
- [-] Finally create the faction
|
||||
- [X] Finally create the faction
|
||||
- [X] We first need player name
|
||||
- [ ] then copy faction creation from factions
|
||||
- [ ] Then, close the dialog
|
||||
- [X] then copy faction creation from factions
|
||||
- [X] Still an error
|
||||
- [X] Now using create_faction_from_UI() function
|
||||
- [X] Then, close the dialog or update the list
|
||||
see https://github.com/minetest/minetest/issues/1679
|
||||
- [ ] Add this to the news text file
|
||||
- [ ] Close and merge this branch
|
||||
**** DONE Trying to install mintest on the raspberry
|
||||
CLOCK: [2019-06-25 mar. 23:07]--[2019-06-25 mar. 23:53] => 0:46
|
||||
CLOCK: [2019-06-25 mar. 04:10]--[2019-06-25 mar. 06:15] => 2:05
|
||||
|
|
2
TODO
2
TODO
|
@ -11,4 +11,4 @@ minetest-solebull - LGPL-2.1 - A PVP/faction game for minetest based on Cobalt.
|
|||
|
||||
|
||||
* v0.0.2-8 (10 Mar. 2020 - ???) CLOC ???,???
|
||||
|
||||
- (1) Close formspec when faction is added
|
||||
|
|
|
@ -60,13 +60,14 @@ get_factions_ui = function(faction_id)
|
|||
return formspec
|
||||
end
|
||||
|
||||
create_faction_from_UI = function(name)
|
||||
-- Creates the new faction
|
||||
create_faction_from_UI = function(name, player)
|
||||
if faction then
|
||||
send_error(player, "You are already in a faction.")
|
||||
return false
|
||||
end
|
||||
if factions.can_create_faction(factionname) then
|
||||
new_faction = factions.new_faction(factionname, nil)
|
||||
if factions.can_create_faction(name) then
|
||||
new_faction = factions.new_faction(name, nil)
|
||||
new_faction:add_player(player, new_faction.default_leader_rank)
|
||||
|
||||
-- Manual fix ?
|
||||
|
@ -104,24 +105,8 @@ sfinv.register_page("sfinv:factions_ui", {
|
|||
local factionName = fields.name
|
||||
local pn = player:get_player_name()
|
||||
local leader = player
|
||||
print("Creating new faction " .. factionName ..
|
||||
" by player " .. pn)
|
||||
|
||||
if factions.can_create_faction(factionName) then
|
||||
new_faction = factions.new_faction(factionName, nil)
|
||||
new_faction:add_player(pn, new_faction.default_leader_rank)
|
||||
|
||||
-- Manual fix ?
|
||||
new_faction.leader = pn
|
||||
new_faction.players[pn] = pn
|
||||
factions.save()
|
||||
|
||||
return true
|
||||
else
|
||||
send_error(pn, "Faction cannot be created.")
|
||||
return false
|
||||
end
|
||||
|
||||
create_faction_from_UI(factionName, pn)
|
||||
minetest.show_formspec(pn, "", "") -- close the formspec
|
||||
end
|
||||
end
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue