Add hard_reset_map(..) function (split it from the resett_map change introduced with previous commits) (keep reading)
Editor: dialog asking for confirmation when trying to edit/remove the region of an arena with an associated schematic (closes #274) Remove the associated schematic of an arena when overriding its region
This commit is contained in:
parent
fcae217e29
commit
fb5fbf2e4b
13
DOCS.md
13
DOCS.md
@ -368,7 +368,8 @@ There are also some other functions which might turn useful. They are:
|
||||
* `arena_lib.is_arena_in_edit_mode(arena_name)`: returns whether the arena is in edit mode or not, as a boolean
|
||||
* `arena_lib.is_player_in_edit_mode(p_name)`: returns whether a player is editing an arena, as a boolean
|
||||
* `arena_lib.is_player_in_region(arena, p_name)`: returns whether a player is inside the region of `arena`, if declared
|
||||
* `arena_lib.reset_map(mod, arena, <hard_reset>)`: regenerates the map of the arena, if a region is declared. `hard_reset` is a boolean, `false` by default. Check [Map regeneration](#2231-map-regeneration) to learn about the difference between a soft and a hard reset.
|
||||
* `arena_lib.reset_map(mod, arena)`: soft-regenerates the map of the arena. Check [Map regeneration](#2231-map-regeneration) to learn about how it works and the difference between a soft and a hard reset
|
||||
* `arena_lib.hard_reset_map(sender, mod, arena_name)`: hard-regenerates the map of the arena by pasting its schematic, if any. Check [Map regeneration](#2231-map-regeneration) to know more about it
|
||||
|
||||
### 1.8 Getters
|
||||
* `arena_lib.get_arena_by_name(mod, arena_name)`: returns the ID and the whole arena. Contrary to the duo `get_arena_by_player` and `get_arenaID_by_player`, this is not split in two as these two variables are often needed together inside arena_lib
|
||||
@ -615,18 +616,18 @@ By default, the arena's lighting settings reflect the lighting settings of the p
|
||||
An arena region is an optional cuboid wrapping the arena (there can be only one per arena), that can be used for several purposes. An example is to save and then restore the arena map once the match is over, or eliminate any player that goes outside it. By default, from arena_lib 7.0 they're used to regenerate the map (`regenerate_map = true`).
|
||||
When a region is declared, be sure that every existing spawn point is placed inside the region, or it won't be possible to enable the arena.
|
||||
|
||||
Util functions that come with it are `arena_lib.is_player_in_region(..)`, `arena_lib.get_arena_by_pos(..)` and `arena_lib.reset_map(..)`.
|
||||
Util functions that come with it are `arena_lib.is_player_in_region(..)`, `arena_lib.get_arena_by_pos(..)`, `arena_lib.reset_map(..)` and `arena_lib.hard_reset_map(..)`.
|
||||
|
||||
##### 2.2.3.1 Map regeneration
|
||||
Due to current Minetest limitations in both performance and design, and after several experiments, arena_lib's default map regeneration system balances server performance (no lag) with usability (not everything can be reset, so keep reading). Nonetheless, the mod also comes with a hard reset system, which is prone to cause lag but is able to reset every kind of node, except for inventory nodes.
|
||||
In order for these systems to work, an arena region must be set and no regeneration shall be in progress (`is_resetting` different from `true`).
|
||||
In order for these systems to work, an arena region must be set.
|
||||
|
||||
In case you want to regenerate a map manually (e.g. during a game), you can use `arena_lib.reset_map(..)`.
|
||||
In case you want to regenerate a map manually (e.g. during a game), you can use `arena_lib.reset_map(..)`/`hard_reset_map(..)`.
|
||||
|
||||
If you want to use inventory nodes, since they can't be restored anyway, the suggested approach is to place such nodes during the loading phase (e.g. by previously storing the coordinates of where those inventories should be, as an arena property).
|
||||
|
||||
###### 2.2.3.1.1 Soft reset
|
||||
Soft reset requires `regenerate_map` ingredient to be `true` and the arena to be enabled. When `regenerate_map` is `true`, arenas can't be edited when they're enabled and no match is in progress, so if you want to change their aspect you need to disable them first.
|
||||
Soft reset requires `regenerate_map` ingredient to be `true`, the arena to be enabled and no regeneration to be in progress (`is_resetting = false`). When `regenerate_map` is `true`, arenas can't be edited if they're enabled and no match is in progress, so if you want to change their aspect you need to disable them first.
|
||||
Arenas' maps are soft restored by default when the match ends or, in case of a crash, when the server restarts. Whatever the reason, arenas' `is_resetting` becomes `true` until the map finishes regenerating.
|
||||
|
||||
Due to the aforementioned Minetest limitations, not every node can be restored. For this reason, **do not** use the following approaches to alter the map or arena_lib won't be able to track the change:
|
||||
@ -635,7 +636,7 @@ Due to the aforementioned Minetest limitations, not every node can be restored.
|
||||
* inventory nodes
|
||||
|
||||
###### 2.2.3.1.2 Hard reset
|
||||
Hard resets are not called by default. However, this system is useful both for backups and for restoring every kind of node (except inventories).
|
||||
Hard resets are not called by default. However, this system is useful both for backups and for restoring every kind of node (except for inventories).
|
||||
Hard resets need an arena schematic, that can be saved either from the editor (where it can also be pasted back) or through `save_map_schematic(..)`. Keep in mind that:
|
||||
1. the bigger the map, the higher the chance to cause a lag spike, so avoid doing such operation with players online as it might interfere with their gameplay
|
||||
2. schematics on Minetest are cached when loaded. Meaning that, if the schematic changes, the server needs to be rebooted in order to paste the new version
|
||||
|
@ -7,6 +7,10 @@ Countdown ticks=Countdownticks
|
||||
Someone joins=Jemand tritt bei
|
||||
Someone leaves=Jemand geht
|
||||
|
||||
##[ src/_load.lua ]##
|
||||
##[ src/api/core.lua ]##
|
||||
-- missing description --=-- fehlende Beschreibung --
|
||||
|
||||
##[ src/admin_tools/entrances.lua ]##
|
||||
Entrance type - @1=Eingangstyp – @1
|
||||
Pressing 'overwrite' will try to disable the arena first=Mit dem Drücken von „Überschreiben“ wird versucht, die Arena zuerst zu deaktivieren
|
||||
@ -88,7 +92,6 @@ Lighting of arena @1 successfully overwritten=Licht von Arena @1 erfolgreich üb
|
||||
(@1) Celestial vault of arena @2 successfully overwritten=(@1) Himmelsgewölbe von Arena @2 erfolgreich überschrieben
|
||||
Weather condition of arena @1 successfully overwritten=Wetter für Arena @1 erfolgreich überschrieben
|
||||
parameter `@1` is mandatory!=Parameter `@1` ist verpflichtend!
|
||||
-- missing description --=-- fehlende Beschreibung --
|
||||
Background music of arena @1 successfully overwritten=Hintergrundmusik für Arena @1 erfolgreich überschrieben
|
||||
Timers are not enabled in this mod!=Timer sind in dieser Mod nicht aktiviert!
|
||||
Arena @1's timer is now @2 seconds=Der Timer für Arena @1 ist jetzt @2 Sekunden
|
||||
@ -100,6 +103,7 @@ The arena is already disabled!=Die Arena ist bereits deaktiviert!
|
||||
You can't disable an arena during an ongoing game!=Sie können eine Arena nicht während eines Spiels deaktivieren!
|
||||
The arena you were queueing for has been disabled... :(=Die Arena, auf die Sie gewartet haben, wurde deaktiviert … :(
|
||||
Arena @1 successfully disabled=Arena @1 erfolgreich deaktiviert
|
||||
Schematic of arena @1 deleted=
|
||||
An arena with that name exists already!=Es gibt bereits eine Arena mit diesen Namen!
|
||||
The name contains unsupported characters!=Der Name enthält nicht unterstützte Zeichen!
|
||||
|
||||
@ -122,6 +126,7 @@ File not found!=Datei nicht gefunden!
|
||||
Parameters don't seem right!=Die Parameter scheinen nicht korrekt zu sein!
|
||||
|
||||
##[ src/api/core.lua ]##
|
||||
##[ src/map_reset/map_reset.lua ]##
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
Region not declared!=Region ist nicht deklariert!
|
||||
|
||||
@ -141,6 +146,7 @@ The arena has been forcibly terminated by @1=Die Arena wurde von @1 zwangsweise
|
||||
@1 has been kicked=@1 wurde gekickt
|
||||
|
||||
##[ src/api/in_game.lua ]##
|
||||
##[ src/map_reset/map_reset.lua ]##
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
##[ src/utils/debug.lua ]##
|
||||
##[ src/utils/macros.lua ]##
|
||||
@ -313,8 +319,8 @@ Strength=Stärke
|
||||
Arena region (LMB pos1, RMB pos2, Q removes)=Arenaregion (LMT: pos1, RMT: pos2, Q entfernt)
|
||||
Save a schematic of the map=Ein Schematic der Karte speichern
|
||||
Load and paste the map schematic=Das Karten-Schematic laden und einfügen
|
||||
Schematic loaded!=Schematic geladen!
|
||||
Are you sure you want to delete the region of the arena?=Sind Sie sich sicher, dass Sie die Region der Arena löschen wollen?
|
||||
Are you sure you want to edit the region? The associated schematic will be deleted=
|
||||
Are you sure you want to delete the region of the arena? It'll also delete the associated schematic, if any=
|
||||
|
||||
##[ src/editor/tools_map.lua ]##
|
||||
##[ src/editor/tools_settings.lua ]##
|
||||
@ -357,8 +363,12 @@ Delete all spawners of the team=Alle Spawner des Teams löschen
|
||||
Return point (custom)=Rückkehrpunkt (eigener)
|
||||
Return point=Rückkehrpunkt
|
||||
|
||||
##[ src/map_reset/map_reset.lua ]##
|
||||
There is no schematic to paste!=
|
||||
Schematic of arena @1 successfully pasted=
|
||||
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
Schematic successfully saved for the arena @1 (pos1 and pos2 have been automatically sorted)=Schematic erfolgreich für die Arena @1 gespeichert (pos1 und pos2 wurden automatisch sortiert)
|
||||
Schematic of arena @1 successfully saved (pos1 and pos2 have been automatically sorted)=
|
||||
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
##[ src/utils/macros.lua ]##
|
||||
@ -475,3 +485,10 @@ The arena is already full!=Die Arena ist schon voll!
|
||||
##[ src/utils/utils.lua ]##
|
||||
[!] @1=[!] @1
|
||||
You've joined team @1=Sie sind Team @1 beigetreten
|
||||
|
||||
|
||||
##### not used anymore #####
|
||||
|
||||
Schematic loaded!=Schematic geladen!
|
||||
Are you sure you want to delete the region of the arena?=Sind Sie sich sicher, dass Sie die Region der Arena löschen wollen?
|
||||
Schematic successfully saved for the arena @1 (pos1 and pos2 have been automatically sorted)=Schematic erfolgreich für die Arena @1 gespeichert (pos1 und pos2 wurden automatisch sortiert)
|
||||
|
@ -7,6 +7,10 @@ Countdown ticks=
|
||||
Someone joins=
|
||||
Someone leaves=
|
||||
|
||||
##[ src/_load.lua ]##
|
||||
##[ src/api/core.lua ]##
|
||||
-- missing description --=
|
||||
|
||||
##[ src/admin_tools/entrances.lua ]##
|
||||
Entrance type - @1=Tipo de entrada - @1
|
||||
Pressing 'overwrite' will try to disable the arena first=Pulsar 'sobrescribir' ententerá primero dishabilitar la arena
|
||||
@ -88,7 +92,6 @@ Lighting of arena @1 successfully overwritten=Iluminación de la arena @1 sobres
|
||||
(@1) Celestial vault of arena @2 successfully overwritten=(@1) Bóveda celeste de la arena @2 sobrescrita con éxito
|
||||
Weather condition of arena @1 successfully overwritten=Condiciones metereológicas de la arena @1 sobrescribidas con éxito
|
||||
parameter `@1` is mandatory!=
|
||||
-- missing description --=
|
||||
Background music of arena @1 successfully overwritten=Música de fondo de la arena @1 sobrescribida con éxito
|
||||
Timers are not enabled in this mod!=¡Los temporizadores no están habilitados en este mod!
|
||||
Arena @1's timer is now @2 seconds=El temporizador de la arena @1 ahora es @2 segundos
|
||||
@ -100,6 +103,7 @@ The arena is already disabled!=¡La arena ya está deshabilitada!
|
||||
You can't disable an arena during an ongoing game!=¡No puedes deshabilitar una arena durante una partida en curso!
|
||||
The arena you were queueing for has been disabled... :(=La arena por la que estabas en cola ha sido deshabilitada... :(
|
||||
Arena @1 successfully disabled=Arena @1 deshabilitada con éxito
|
||||
Schematic of arena @1 deleted=
|
||||
An arena with that name exists already!=¡Ya existe una arena con ese nombre!
|
||||
The name contains unsupported characters!=¡El nombre contiene caracteres no admitidos!
|
||||
|
||||
@ -122,6 +126,7 @@ File not found!=¡Archivo no encontrado!
|
||||
Parameters don't seem right!=¡Los parámetros no parecen ser correctos!
|
||||
|
||||
##[ src/api/core.lua ]##
|
||||
##[ src/map_reset/map_reset.lua ]##
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
Region not declared!=
|
||||
|
||||
@ -141,6 +146,7 @@ The arena has been forcibly terminated by @1=La partida ha sido forzada a termin
|
||||
@1 has been kicked=@1 ha sido expulsado
|
||||
|
||||
##[ src/api/in_game.lua ]##
|
||||
##[ src/map_reset/map_reset.lua ]##
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
##[ src/utils/debug.lua ]##
|
||||
##[ src/utils/macros.lua ]##
|
||||
@ -313,8 +319,8 @@ Strength=Intesidad
|
||||
Arena region (LMB pos1, RMB pos2, Q removes)=Región de la arena (clic izdo pos1, dcho pos2, Q eliminar)
|
||||
Save a schematic of the map=
|
||||
Load and paste the map schematic=
|
||||
Schematic loaded!=
|
||||
Are you sure you want to delete the region of the arena?=¿Estás seguro que quieres borrar la región de la arena?
|
||||
Are you sure you want to edit the region? The associated schematic will be deleted=
|
||||
Are you sure you want to delete the region of the arena? It'll also delete the associated schematic, if any=
|
||||
|
||||
##[ src/editor/tools_map.lua ]##
|
||||
##[ src/editor/tools_settings.lua ]##
|
||||
@ -357,8 +363,12 @@ Delete all spawners of the team=Eliminar todos los generadores del equipo
|
||||
Return point (custom)=Punto de regreso (personalizado)
|
||||
Return point=Punto de regreso
|
||||
|
||||
##[ src/map_reset/map_reset.lua ]##
|
||||
There is no schematic to paste!=
|
||||
Schematic of arena @1 successfully pasted=
|
||||
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
Schematic successfully saved for the arena @1 (pos1 and pos2 have been automatically sorted)=
|
||||
Schematic of arena @1 successfully saved (pos1 and pos2 have been automatically sorted)=
|
||||
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
##[ src/utils/macros.lua ]##
|
||||
@ -479,6 +489,7 @@ You've joined team @1=Te has unido al equipo @1
|
||||
|
||||
##### not used anymore #####
|
||||
|
||||
Are you sure you want to delete the region of the arena?=¿Estás seguro que quieres borrar la región de la arena?
|
||||
Spectators inside: =Espectadores actuales:
|
||||
current: =actual:
|
||||
name: =nombre:
|
||||
|
@ -7,6 +7,10 @@ Countdown ticks=
|
||||
Someone joins=
|
||||
Someone leaves=
|
||||
|
||||
##[ src/_load.lua ]##
|
||||
##[ src/api/core.lua ]##
|
||||
-- missing description --=
|
||||
|
||||
##[ src/admin_tools/entrances.lua ]##
|
||||
Entrance type - @1=Bejárat tipusa - @1
|
||||
Pressing 'overwrite' will try to disable the arena first=A "felülírás" megnyomásával először az arénát próbálja letiltani
|
||||
@ -88,7 +92,6 @@ Lighting of arena @1 successfully overwritten=Az aréna @1 fénye sikeresen fel
|
||||
(@1) Celestial vault of arena @2 successfully overwritten=(@1) Az aréna @2 égi boltozata sikeresen felülírva
|
||||
Weather condition of arena @1 successfully overwritten=
|
||||
parameter `@1` is mandatory!=
|
||||
-- missing description --=
|
||||
Background music of arena @1 successfully overwritten=A @1 aréna háttérzenéje sikeresen felülírva
|
||||
Timers are not enabled in this mod!=Az időzítők nincsenek engedélyezve ebben a modban!
|
||||
Arena @1's timer is now @2 seconds=Az aréna @1 időzítője most @2 másodperc
|
||||
@ -100,6 +103,7 @@ The arena is already disabled!=Az aréna már le van tiltva!
|
||||
You can't disable an arena during an ongoing game!=Nem lehet letiltani az arénát folyamatban lévő játék közben!
|
||||
The arena you were queueing for has been disabled... :(=Az aréna ahhol várakozol ki lett kapcsolva … :(
|
||||
Arena @1 successfully disabled=Aréna @1 sikeresen leálítódott
|
||||
Schematic of arena @1 deleted=
|
||||
An arena with that name exists already!=Egy aréna már létezik ezzel a névval!
|
||||
The name contains unsupported characters!=A név tartalmaz nem támogatott karaktereket!
|
||||
|
||||
@ -122,6 +126,7 @@ File not found!=A fájl nem található!
|
||||
Parameters don't seem right!=A parmeterek nem tűnnek jónak!
|
||||
|
||||
##[ src/api/core.lua ]##
|
||||
##[ src/map_reset/map_reset.lua ]##
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
Region not declared!=
|
||||
|
||||
@ -141,6 +146,7 @@ The arena has been forcibly terminated by @1=Az aréna azonnal leáll @1 által
|
||||
@1 has been kicked=@1 ki lett rugva
|
||||
|
||||
##[ src/api/in_game.lua ]##
|
||||
##[ src/map_reset/map_reset.lua ]##
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
##[ src/utils/debug.lua ]##
|
||||
##[ src/utils/macros.lua ]##
|
||||
@ -313,8 +319,8 @@ Strength=
|
||||
Arena region (LMB pos1, RMB pos2, Q removes)=Aréna régió (LMB pos1, RMB pos2, Q eltávolít)
|
||||
Save a schematic of the map=
|
||||
Load and paste the map schematic=
|
||||
Schematic loaded!=
|
||||
Are you sure you want to delete the region of the arena?=Biztos hogy törölni szeretnéd az aréna körzetét?
|
||||
Are you sure you want to edit the region? The associated schematic will be deleted=
|
||||
Are you sure you want to delete the region of the arena? It'll also delete the associated schematic, if any=
|
||||
|
||||
##[ src/editor/tools_map.lua ]##
|
||||
##[ src/editor/tools_settings.lua ]##
|
||||
@ -357,8 +363,12 @@ Delete all spawners of the team=Töröld az öszes indulási pontot
|
||||
Return point (custom)=Viszatérési pont (egyedi)
|
||||
Return point=Viszatérési pont
|
||||
|
||||
##[ src/map_reset/map_reset.lua ]##
|
||||
There is no schematic to paste!=
|
||||
Schematic of arena @1 successfully pasted=
|
||||
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
Schematic successfully saved for the arena @1 (pos1 and pos2 have been automatically sorted)=
|
||||
Schematic of arena @1 successfully saved (pos1 and pos2 have been automatically sorted)=
|
||||
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
##[ src/utils/macros.lua ]##
|
||||
@ -479,6 +489,7 @@ You've joined team @1=Csatlakoztál a csapat @1-hez
|
||||
|
||||
##### not used anymore #####
|
||||
|
||||
Are you sure you want to delete the region of the arena?=Biztos hogy törölni szeretnéd az aréna körzetét?
|
||||
Spectators inside: =Bent lévő nézők:
|
||||
current: =Most:
|
||||
name: =Név:
|
||||
|
@ -7,6 +7,10 @@ Countdown ticks=Colpo di conto alla rovescia
|
||||
Someone joins=Qualcunə entra
|
||||
Someone leaves=Qualcunə abbandona
|
||||
|
||||
##[ src/_load.lua ]##
|
||||
##[ src/api/core.lua ]##
|
||||
-- missing description --=-- descrizione mancante --
|
||||
|
||||
##[ src/admin_tools/entrances.lua ]##
|
||||
Entrance type - @1=Tipo d'entrata - @1
|
||||
Pressing 'overwrite' will try to disable the arena first=Premere 'sovrascrivi' proverà prima a disabilitare l'arena
|
||||
@ -88,7 +92,6 @@ Lighting of arena @1 successfully overwritten=Illuminazione dell'arena @1 sovras
|
||||
(@1) Celestial vault of arena @2 successfully overwritten=(@1) Volta celeste dell'arena @2 sovrascritta con successo
|
||||
Weather condition of arena @1 successfully overwritten=Condizione meteo dell'arena @1 sovrascritta con successo
|
||||
parameter `@1` is mandatory!=Il parametro `@1` è obbligatorio!
|
||||
-- missing description --=-- descrizione mancante --
|
||||
Background music of arena @1 successfully overwritten=Musica di sottofondo dell'arena @1 sovrascritta con successo
|
||||
Timers are not enabled in this mod!=I timer non sono abilitati in questa mod!
|
||||
Arena @1's timer is now @2 seconds=Il timer dell'arena @1 è ora @2 secondi
|
||||
@ -100,6 +103,7 @@ The arena is already disabled!=L'arena è già disabilitata!
|
||||
You can't disable an arena during an ongoing game!=Non puoi disabilitare un'arena mentre una partita è in corso!
|
||||
The arena you were queueing for has been disabled... :(=L'arena per la quale eri in coda è stata disabilitata... :(
|
||||
Arena @1 successfully disabled=Arena @1 disabilitata con successo
|
||||
Schematic of arena @1 deleted=Schematica dell'arena @1 cancellata
|
||||
An arena with that name exists already!=Esiste già un'arena con quel nome!
|
||||
The name contains unsupported characters!=Il nome contiene caratteri non supportati!
|
||||
|
||||
@ -122,6 +126,7 @@ File not found!=File non trovato!
|
||||
Parameters don't seem right!=I parametri hanno qualcosa che non va!
|
||||
|
||||
##[ src/api/core.lua ]##
|
||||
##[ src/map_reset/map_reset.lua ]##
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
Region not declared!=Regione non dichiarata!
|
||||
|
||||
@ -141,6 +146,7 @@ The arena has been forcibly terminated by @1=La conclusione della partita è sta
|
||||
@1 has been kicked=@1 è stato cacciatə
|
||||
|
||||
##[ src/api/in_game.lua ]##
|
||||
##[ src/map_reset/map_reset.lua ]##
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
##[ src/utils/debug.lua ]##
|
||||
##[ src/utils/macros.lua ]##
|
||||
@ -313,8 +319,8 @@ Strength=Intensità
|
||||
Arena region (LMB pos1, RMB pos2, Q removes)=Regione dell'arena (sx pos1, dx pos2, Q rimuovi)
|
||||
Save a schematic of the map=Salva una schematica della mappa
|
||||
Load and paste the map schematic=Carica e incolla la schematica della mappa
|
||||
Schematic loaded!=Schematica caricata!
|
||||
Are you sure you want to delete the region of the arena?=Sei sicurə di voler eliminare la regione dell'arena?
|
||||
Are you sure you want to edit the region? The associated schematic will be deleted=Sei sicurə di voler modificare la regione dell'arena? La schematica associata verrà rimossa
|
||||
Are you sure you want to delete the region of the arena? It'll also delete the associated schematic, if any=Sei sicurə di voler eliminare la regione dell'arena? La schematica associata verrà rimossa, se ne esiste una
|
||||
|
||||
##[ src/editor/tools_map.lua ]##
|
||||
##[ src/editor/tools_settings.lua ]##
|
||||
@ -357,8 +363,12 @@ Delete all spawners of the team=Cancella tutti i punti di rinascita della squadr
|
||||
Return point (custom)=Punto di ritorno (personalizzato)
|
||||
Return point=Punto di ritorno
|
||||
|
||||
##[ src/map_reset/map_reset.lua ]##
|
||||
There is no schematic to paste!=Non c'è nessuna schematica da incollare!
|
||||
Schematic of arena @1 successfully pasted=Schematica dell'arena @1 incollata con successo
|
||||
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
Schematic successfully saved for the arena @1 (pos1 and pos2 have been automatically sorted)=Schematica dell'arena @1 salvata con successo (pos1 e pos2 sono state ordinate automaticamente)
|
||||
Schematic of arena @1 successfully saved (pos1 and pos2 have been automatically sorted)=Schematica dell'arena @1 salvata con successo (pos1 e pos2 sono state ordinate automaticamente)
|
||||
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
##[ src/utils/macros.lua ]##
|
||||
|
@ -7,6 +7,10 @@ Countdown ticks=Odliczanie tyknięć
|
||||
Someone joins=Ktoś dołącza
|
||||
Someone leaves=Ktoś wychodzi
|
||||
|
||||
##[ src/_load.lua ]##
|
||||
##[ src/api/core.lua ]##
|
||||
-- missing description --=
|
||||
|
||||
##[ src/admin_tools/entrances.lua ]##
|
||||
Entrance type - @1=Rodzaj wejścia - @1
|
||||
Pressing 'overwrite' will try to disable the arena first=Wciśnięcie 'nadpisz' spróbuje najpierw wyłączyć arenę
|
||||
@ -88,7 +92,6 @@ Lighting of arena @1 successfully overwritten=Pomyślnie nadpisano oświetlenie
|
||||
(@1) Celestial vault of arena @2 successfully overwritten=(@1) Pomyślnie nadpisano niebiański skarbiec z areny @2
|
||||
Weather condition of arena @1 successfully overwritten=Pomyślnie nadpisano warunki pogodowe areny @1
|
||||
parameter `@1` is mandatory!=
|
||||
-- missing description --=
|
||||
Background music of arena @1 successfully overwritten=Pomyślnie nadpisano muzykę dla areny @1
|
||||
Timers are not enabled in this mod!=W tym modzie nie są włączone timery!
|
||||
Arena @1's timer is now @2 seconds=Timer areny @1 to obecnie @2 sekundy
|
||||
@ -100,6 +103,7 @@ The arena is already disabled!=Arena jest już wyłączona!
|
||||
You can't disable an arena during an ongoing game!=Nie można wyłączyć areny w trakcie trwającej rozgrywki!
|
||||
The arena you were queueing for has been disabled... :(=Arena, na którą się zapisałeś/aś została wyłączona... :(
|
||||
Arena @1 successfully disabled=Pomyślnie wyłączono arenę @1
|
||||
Schematic of arena @1 deleted=
|
||||
An arena with that name exists already!=Arena o tej nazwie już istnieje!
|
||||
The name contains unsupported characters!=Nazwa zawiera niedozwolone znaki!
|
||||
|
||||
@ -122,6 +126,7 @@ File not found!=Nie znaleziono pliku!
|
||||
Parameters don't seem right!=Parametery wyglądają na niepoprawne!
|
||||
|
||||
##[ src/api/core.lua ]##
|
||||
##[ src/map_reset/map_reset.lua ]##
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
Region not declared!=
|
||||
|
||||
@ -141,6 +146,7 @@ The arena has been forcibly terminated by @1=@1 wymusił wyłączenie areny
|
||||
@1 has been kicked=@1 został(a) wykopany/a
|
||||
|
||||
##[ src/api/in_game.lua ]##
|
||||
##[ src/map_reset/map_reset.lua ]##
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
##[ src/utils/debug.lua ]##
|
||||
##[ src/utils/macros.lua ]##
|
||||
@ -313,8 +319,8 @@ Strength=Nasilenie
|
||||
Arena region (LMB pos1, RMB pos2, Q removes)=Region areny (lewy przycisk myszy pos1, prawy przycisk myszy pos2, Q usuwa)
|
||||
Save a schematic of the map=
|
||||
Load and paste the map schematic=
|
||||
Schematic loaded!=
|
||||
Are you sure you want to delete the region of the arena?=Czy na pewno chcesz usunąć region areny?
|
||||
Are you sure you want to edit the region? The associated schematic will be deleted=
|
||||
Are you sure you want to delete the region of the arena? It'll also delete the associated schematic, if any=
|
||||
|
||||
##[ src/editor/tools_map.lua ]##
|
||||
##[ src/editor/tools_settings.lua ]##
|
||||
@ -357,8 +363,12 @@ Delete all spawners of the team=Usuń wszystkie spawnery drużyny
|
||||
Return point (custom)=Punkt powrotu (własny)
|
||||
Return point=Punkt powrotu
|
||||
|
||||
##[ src/map_reset/map_reset.lua ]##
|
||||
There is no schematic to paste!=
|
||||
Schematic of arena @1 successfully pasted=
|
||||
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
Schematic successfully saved for the arena @1 (pos1 and pos2 have been automatically sorted)=
|
||||
Schematic of arena @1 successfully saved (pos1 and pos2 have been automatically sorted)=
|
||||
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
##[ src/utils/macros.lua ]##
|
||||
@ -479,6 +489,7 @@ You've joined team @1=Dołączono do drużyny @1
|
||||
|
||||
##### not used anymore #####
|
||||
|
||||
Are you sure you want to delete the region of the arena?=Czy na pewno chcesz usunąć region areny?
|
||||
arena name=nazwa areny
|
||||
All=Wszystkie
|
||||
on_timeout callback must be declared to properly use a decreasing timer!=Należy wywołać on_timeout żeby poprawnie ustawić malejący timer!
|
||||
|
@ -7,6 +7,10 @@ Countdown ticks=
|
||||
Someone joins=
|
||||
Someone leaves=
|
||||
|
||||
##[ src/_load.lua ]##
|
||||
##[ src/api/core.lua ]##
|
||||
-- missing description --=
|
||||
|
||||
##[ src/admin_tools/entrances.lua ]##
|
||||
Entrance type - @1=Тип входа - @1
|
||||
Pressing 'overwrite' will try to disable the arena first=Нажатие на «Перезаписать» попробует сначала отключить арену
|
||||
@ -88,7 +92,6 @@ Lighting of arena @1 successfully overwritten=Освещение арены @1
|
||||
(@1) Celestial vault of arena @2 successfully overwritten=(@1) Небесный свод арены @2 успешно перезаписан
|
||||
Weather condition of arena @1 successfully overwritten=Погодные условия арны @1 успешно перезаписаны
|
||||
parameter `@1` is mandatory!=
|
||||
-- missing description --=
|
||||
Background music of arena @1 successfully overwritten=Фоновая музыка арены @1 успешно перезаписана
|
||||
Timers are not enabled in this mod!=Таймеры не доступны в этом режиме!
|
||||
Arena @1's timer is now @2 seconds=Таймер арены @1 установлен на @2 с
|
||||
@ -100,6 +103,7 @@ The arena is already disabled!=Арена уже отключена!
|
||||
You can't disable an arena during an ongoing game!=Вы не можете отключить арену во время игры!
|
||||
The arena you were queueing for has been disabled... :(=Арена, в очереди которой вы стояли, была отключена... :(
|
||||
Arena @1 successfully disabled=Арена @1 успешно отключена
|
||||
Schematic of arena @1 deleted=
|
||||
An arena with that name exists already!=Арена с таким именем уже существует!
|
||||
The name contains unsupported characters!=Имя содержит неподдерживаемые символы!
|
||||
|
||||
@ -122,6 +126,7 @@ File not found!=Файл не найден!
|
||||
Parameters don't seem right!=Параметры не выглядят верными!
|
||||
|
||||
##[ src/api/core.lua ]##
|
||||
##[ src/map_reset/map_reset.lua ]##
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
Region not declared!=
|
||||
|
||||
@ -141,6 +146,7 @@ The arena has been forcibly terminated by @1=@1 принудительно ос
|
||||
@1 has been kicked=@1 был выгнан
|
||||
|
||||
##[ src/api/in_game.lua ]##
|
||||
##[ src/map_reset/map_reset.lua ]##
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
##[ src/utils/debug.lua ]##
|
||||
##[ src/utils/macros.lua ]##
|
||||
@ -313,8 +319,8 @@ Strength=Сила
|
||||
Arena region (LMB pos1, RMB pos2, Q removes)=Область арены (ЛКМ поз1, ПКМ поз2, Q удаляет)
|
||||
Save a schematic of the map=
|
||||
Load and paste the map schematic=
|
||||
Schematic loaded!=
|
||||
Are you sure you want to delete the region of the arena?=Уверены ли вы, что хотите удалить область арены?
|
||||
Are you sure you want to edit the region? The associated schematic will be deleted=
|
||||
Are you sure you want to delete the region of the arena? It'll also delete the associated schematic, if any=
|
||||
|
||||
##[ src/editor/tools_map.lua ]##
|
||||
##[ src/editor/tools_settings.lua ]##
|
||||
@ -357,8 +363,12 @@ Delete all spawners of the team=Удалить все спавнеры кома
|
||||
Return point (custom)=Точка возврата (произвольная)
|
||||
Return point=Точка возврата
|
||||
|
||||
##[ src/map_reset/map_reset.lua ]##
|
||||
There is no schematic to paste!=
|
||||
Schematic of arena @1 successfully pasted=
|
||||
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
Schematic successfully saved for the arena @1 (pos1 and pos2 have been automatically sorted)=
|
||||
Schematic of arena @1 successfully saved (pos1 and pos2 have been automatically sorted)=
|
||||
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
##[ src/utils/macros.lua ]##
|
||||
@ -480,6 +490,7 @@ You've joined team @1=Вы присоединились к команде @1
|
||||
|
||||
##### not used anymore #####
|
||||
|
||||
Are you sure you want to delete the region of the arena?=Уверены ли вы, что хотите удалить область арены?
|
||||
Spectators inside: =Наблюдатели внутри:
|
||||
current: =текущее:
|
||||
name: =имя:
|
||||
|
@ -7,6 +7,10 @@ Countdown ticks=
|
||||
Someone joins=
|
||||
Someone leaves=
|
||||
|
||||
##[ src/_load.lua ]##
|
||||
##[ src/api/core.lua ]##
|
||||
-- missing description --=
|
||||
|
||||
##[ src/admin_tools/entrances.lua ]##
|
||||
Entrance type - @1=
|
||||
Pressing 'overwrite' will try to disable the arena first=
|
||||
@ -88,7 +92,6 @@ Lighting of arena @1 successfully overwritten=
|
||||
(@1) Celestial vault of arena @2 successfully overwritten=
|
||||
Weather condition of arena @1 successfully overwritten=
|
||||
parameter `@1` is mandatory!=
|
||||
-- missing description --=
|
||||
Background music of arena @1 successfully overwritten=
|
||||
Timers are not enabled in this mod!=
|
||||
Arena @1's timer is now @2 seconds=
|
||||
@ -100,6 +103,7 @@ The arena is already disabled!=
|
||||
You can't disable an arena during an ongoing game!=
|
||||
The arena you were queueing for has been disabled... :(=
|
||||
Arena @1 successfully disabled=
|
||||
Schematic of arena @1 deleted=
|
||||
An arena with that name exists already!=
|
||||
The name contains unsupported characters!=
|
||||
|
||||
@ -122,6 +126,7 @@ File not found!=
|
||||
Parameters don't seem right!=
|
||||
|
||||
##[ src/api/core.lua ]##
|
||||
##[ src/map_reset/map_reset.lua ]##
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
Region not declared!=
|
||||
|
||||
@ -141,6 +146,7 @@ The arena has been forcibly terminated by @1=
|
||||
@1 has been kicked=
|
||||
|
||||
##[ src/api/in_game.lua ]##
|
||||
##[ src/map_reset/map_reset.lua ]##
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
##[ src/utils/debug.lua ]##
|
||||
##[ src/utils/macros.lua ]##
|
||||
@ -313,8 +319,8 @@ Strength=
|
||||
Arena region (LMB pos1, RMB pos2, Q removes)=
|
||||
Save a schematic of the map=
|
||||
Load and paste the map schematic=
|
||||
Schematic loaded!=
|
||||
Are you sure you want to delete the region of the arena?=
|
||||
Are you sure you want to edit the region? The associated schematic will be deleted=
|
||||
Are you sure you want to delete the region of the arena? It'll also delete the associated schematic, if any=
|
||||
|
||||
##[ src/editor/tools_map.lua ]##
|
||||
##[ src/editor/tools_settings.lua ]##
|
||||
@ -357,8 +363,12 @@ Delete all spawners of the team=
|
||||
Return point (custom)=
|
||||
Return point=
|
||||
|
||||
##[ src/map_reset/map_reset.lua ]##
|
||||
There is no schematic to paste!=
|
||||
Schematic of arena @1 successfully pasted=
|
||||
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
Schematic successfully saved for the arena @1 (pos1 and pos2 have been automatically sorted)=
|
||||
Schematic of arena @1 successfully saved (pos1 and pos2 have been automatically sorted)=
|
||||
|
||||
##[ src/map_reset/map_saving.lua ]##
|
||||
##[ src/utils/macros.lua ]##
|
||||
|
@ -11,6 +11,7 @@ local function deprecated_spawner_ID_param() end
|
||||
local function deprecated_sound_table_entry_exists() end
|
||||
local function check_for_properties() end
|
||||
local function next_available_ID() end
|
||||
local function delete_schematic_if_exists() end
|
||||
local function is_arena_name_allowed() end
|
||||
local function initialise_map_storage() end
|
||||
|
||||
@ -588,14 +589,7 @@ function arena_lib.remove_arena(sender, mod, arena_name, in_editor)
|
||||
arena_lib.entrances[arena.entrance_type].remove(mod, arena)
|
||||
end
|
||||
|
||||
local schem_path = minetest.get_worldpath() .. ("/arena_lib/Schematics/%s_%d.mts"):format(mod, id)
|
||||
local schem = io.open(schem_path, "r")
|
||||
|
||||
-- rimozione eventuale schematica
|
||||
if schem then
|
||||
schem:close()
|
||||
minetest.rmdir(schem_path, true)
|
||||
end
|
||||
delete_schematic_if_exists(sender, mod, id)
|
||||
|
||||
local mod_ref = arena_lib.mods[mod]
|
||||
|
||||
@ -1178,6 +1172,7 @@ function arena_lib.set_region(sender, mod, arena_name, pos1, pos2, in_editor)
|
||||
end
|
||||
|
||||
arena_lib.update_waypoints(sender, mod, arena)
|
||||
delete_schematic_if_exists(sender, mod, id)
|
||||
update_storage(false, mod, id, arena)
|
||||
arena_lib.print_info(sender, arena_lib.mods[mod].prefix .. S("Region of arena @1 successfully overwritten", arena_name))
|
||||
end
|
||||
@ -1903,6 +1898,22 @@ end
|
||||
|
||||
|
||||
|
||||
function delete_schematic_if_exists(sender, mod, id)
|
||||
local schem_path = minetest.get_worldpath() .. ("/arena_lib/Schematics/%s_%d.mts"):format(mod, id)
|
||||
local schem = io.open(schem_path, "r")
|
||||
|
||||
if schem then
|
||||
local mod_ref = arena_lib.mods[mod]
|
||||
local arena_name = mod_ref.arenas[id].name
|
||||
|
||||
schem:close()
|
||||
minetest.rmdir(schem_path, true)
|
||||
arena_lib.print_info(sender, mod_ref.prefix .. S("Schematic of arena @1 deleted", arena_name))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function is_arena_name_allowed(sender, mod, arena_name)
|
||||
-- se esiste già un'arena con quel nome, annullo
|
||||
if arena_lib.get_arena_by_name(mod, arena_name) then
|
||||
|
@ -1,6 +1,7 @@
|
||||
local S = minetest.get_translator("arena_lib")
|
||||
|
||||
local function get_region_formspec() end
|
||||
local function get_edit_warning_formspec() end
|
||||
local function get_deletion_warning_formspec() end
|
||||
|
||||
local map_tools = {
|
||||
"arena_lib:map_region",
|
||||
@ -24,39 +25,65 @@ minetest.register_tool("arena_lib:map_region", {
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
|
||||
on_drop = function(itemstack, dropper, pos)
|
||||
local arena_name = dropper:get_meta():get_string("arena_lib_editor.arena")
|
||||
minetest.show_formspec(dropper:get_player_name(), "arena_lib:settings_region", get_region_formspec(arena_name))
|
||||
minetest.show_formspec(dropper:get_player_name(), "arena_lib:settings_region", get_deletion_warning_formspec())
|
||||
end,
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
local mod = user:get_meta():get_string("arena_lib_editor.mod")
|
||||
local arena_name = user:get_meta():get_string("arena_lib_editor.arena")
|
||||
local _, arena = arena_lib.get_arena_by_name(mod, arena_name)
|
||||
local id, arena = arena_lib.get_arena_by_name(mod, arena_name)
|
||||
local p_name = user:get_player_name()
|
||||
local p_pos = user:get_pos()
|
||||
local pos2 = arena.pos2 or p_pos
|
||||
|
||||
-- copio perché arena.pos2 non è creato da vector.*, fallendo vector.check() in arena_lib.set_region()
|
||||
arena_lib.set_region(user:get_player_name(), mod, arena_name, p_pos, vector.copy(pos2), true)
|
||||
local schem_path = minetest.get_worldpath() .. ("/arena_lib/Schematics/%s_%d.mts"):format(mod, id)
|
||||
local schem = io.open(schem_path, "r")
|
||||
|
||||
if schem then
|
||||
schem:close()
|
||||
minetest.show_formspec(p_name, "arena_lib:region_edit_warning", get_edit_warning_formspec(1))
|
||||
else
|
||||
-- copio perché arena.pos2 non è creato da vector.*, fallendo vector.check() in arena_lib.set_region()
|
||||
arena_lib.set_region(p_name, mod, arena_name, p_pos, vector.copy(pos2), true)
|
||||
end
|
||||
end,
|
||||
|
||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
||||
local mod = user:get_meta():get_string("arena_lib_editor.mod")
|
||||
local arena_name = user:get_meta():get_string("arena_lib_editor.arena")
|
||||
local _, arena = arena_lib.get_arena_by_name(mod, arena_name)
|
||||
local id, arena = arena_lib.get_arena_by_name(mod, arena_name)
|
||||
local p_name = user:get_player_name()
|
||||
local p_pos = user:get_pos()
|
||||
local pos1 = arena.pos1 or p_pos
|
||||
|
||||
arena_lib.set_region(user:get_player_name(), mod, arena_name, vector.copy(pos1), p_pos, true)
|
||||
local schem_path = minetest.get_worldpath() .. ("/arena_lib/Schematics/%s_%d.mts"):format(mod, id)
|
||||
local schem = io.open(schem_path, "r")
|
||||
|
||||
if schem then
|
||||
schem:close()
|
||||
minetest.show_formspec(p_name, "arena_lib:region_edit_warning", get_edit_warning_formspec(2))
|
||||
else
|
||||
arena_lib.set_region(p_name, mod, arena_name, vector.copy(pos1), p_pos, true)
|
||||
end
|
||||
end,
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local mod = placer:get_meta():get_string("arena_lib_editor.mod")
|
||||
local arena_name = placer:get_meta():get_string("arena_lib_editor.arena")
|
||||
local _, arena = arena_lib.get_arena_by_name(mod, arena_name)
|
||||
local id, arena = arena_lib.get_arena_by_name(mod, arena_name)
|
||||
local p_name = placer:get_player_name()
|
||||
local p_pos = placer:get_pos()
|
||||
local pos1 = arena.pos1 or p_pos
|
||||
|
||||
arena_lib.set_region(placer:get_player_name(), mod, arena_name, vector.copy(pos1), p_pos, true)
|
||||
local schem_path = minetest.get_worldpath() .. ("/arena_lib/Schematics/%s_%d.mts"):format(mod, id)
|
||||
local schem = io.open(schem_path, "r")
|
||||
|
||||
if schem then
|
||||
schem:close()
|
||||
minetest.show_formspec(p_name, "arena_lib:region_edit_warning", get_edit_warning_formspec(2))
|
||||
else
|
||||
arena_lib.set_region(p_name, mod, arena_name, vector.copy(pos1), p_pos, true)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
@ -87,16 +114,15 @@ minetest.register_tool("arena_lib:map_hard_reset", {
|
||||
on_use = function (itemstack, player)
|
||||
local mod = player:get_meta():get_string("arena_lib_editor.mod")
|
||||
local arena_name = player:get_meta():get_string("arena_lib_editor.arena")
|
||||
local _, arena = arena_lib.get_arena_by_name(mod, arena_name)
|
||||
local p_name = player:get_player_name()
|
||||
|
||||
arena_lib.reset_map(mod, arena, true)
|
||||
arena_lib.print_info(player:get_player_name(), arena_lib.mods[mod].prefix .. S("Schematic loaded!"))
|
||||
arena_lib.hard_reset_map(player:get_player_name(), mod, arena_name)
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
|
||||
function arena_lib.give_map_tools(inv, mod)
|
||||
function arena_lib.give_map_tools(inv)
|
||||
inv:set_list("main", map_tools)
|
||||
end
|
||||
|
||||
@ -108,13 +134,29 @@ end
|
||||
---------------FUNZIONI LOCALI----------------
|
||||
----------------------------------------------
|
||||
|
||||
function get_region_formspec(arena_name)
|
||||
function get_edit_warning_formspec(pos_n)
|
||||
local formspec = {
|
||||
"size[5,1.3]",
|
||||
"size[5,2]",
|
||||
"style[region_edit_confirm;bgcolor=red]",
|
||||
"hypertext[0.25,-0.1;5,1.7;delete_msg;<global halign=center>" .. S("Are you sure you want to edit the region? The associated schematic will be deleted") .. "]",
|
||||
"button[3,1.5;1.5,0.5;region_edit_confirm;" .. S("Yes") .. "]",
|
||||
"button[0.5,1.5;1.5,0.5;region_edit_cancel;" .. S("Cancel") .. "]",
|
||||
"field[0,0;0,0;pos_n;;" .. pos_n .. "]",
|
||||
"field_close_on_enter[;false]"
|
||||
}
|
||||
|
||||
return table.concat(formspec, "")
|
||||
end
|
||||
|
||||
|
||||
|
||||
function get_deletion_warning_formspec()
|
||||
local formspec = {
|
||||
"size[5,2]",
|
||||
"style[region_delete_confirm;bgcolor=red]",
|
||||
"hypertext[0.25,-0.1;5,1;delete_msg;<global halign=center>" .. S("Are you sure you want to delete the region of the arena?") .. "]",
|
||||
"button[3,0.7;1.5,0.5;region_delete_confirm;" .. S("Yes") .. "]",
|
||||
"button[0.5,0.7;1.5,0.5;region_delete_cancel;" .. S("Cancel") .. "]",
|
||||
"hypertext[0.25,-0.1;5,1.7;delete_msg;<global halign=center>" .. S("Are you sure you want to delete the region of the arena? It'll also delete the associated schematic, if any") .. "]",
|
||||
"button[3,1.5;1.5,0.5;region_delete_confirm;" .. S("Yes") .. "]",
|
||||
"button[0.5,1.5;1.5,0.5;region_delete_cancel;" .. S("Cancel") .. "]",
|
||||
"field_close_on_enter[;false]"
|
||||
}
|
||||
|
||||
@ -130,17 +172,36 @@ end
|
||||
----------------------------------------------
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "arena_lib:settings_region" then return end
|
||||
if formname ~= "arena_lib:settings_region" and formname ~= "arena_lib:region_edit_warning" then return end
|
||||
|
||||
local p_name = player:get_player_name()
|
||||
local mod = player:get_meta():get_string("arena_lib_editor.mod")
|
||||
local arena_name = player:get_meta():get_string("arena_lib_editor.arena")
|
||||
local p_name = player:get_player_name()
|
||||
local mod = player:get_meta():get_string("arena_lib_editor.mod")
|
||||
local arena_name = player:get_meta():get_string("arena_lib_editor.arena")
|
||||
|
||||
-- deletion formspec
|
||||
if fields.region_delete_confirm then
|
||||
arena_lib.set_region(p_name, mod, arena_name, nil, nil, true)
|
||||
minetest.close_formspec(p_name, formname)
|
||||
|
||||
arena_lib.set_region(p_name, mod, arena_name, nil, nil, true)
|
||||
elseif fields.region_delete_cancel then
|
||||
-- edit formspec
|
||||
elseif fields.region_edit_confirm then
|
||||
local _, arena = arena_lib.get_arena_by_name(mod, arena_name)
|
||||
local pos_n = tonumber(fields.pos_n)
|
||||
local pos1, pos2
|
||||
|
||||
if pos_n == 1 then
|
||||
pos1 = player:get_pos()
|
||||
pos2 = arena.pos2 or pos1
|
||||
else
|
||||
pos2 = player:get_pos()
|
||||
pos1 = arena.pos1 or pos2
|
||||
end
|
||||
|
||||
-- arena.pos non sono fatti da vector.*
|
||||
arena_lib.set_region(p_name, mod, arena_name, vector.copy(pos1), vector.copy(pos2), true)
|
||||
minetest.close_formspec(p_name, formname)
|
||||
|
||||
elseif fields.region_delete_cancel or fields.region_edit_cancel then
|
||||
minetest.close_formspec(p_name, formname)
|
||||
end
|
||||
end)
|
||||
|
@ -1,3 +1,5 @@
|
||||
local S = minetest.get_translator("arena_lib")
|
||||
|
||||
local function async_reset_map() end
|
||||
local function reset_node_inventory() end
|
||||
|
||||
@ -29,25 +31,49 @@ end)
|
||||
|
||||
|
||||
|
||||
function arena_lib.reset_map(mod, arena, hard_reset)
|
||||
function arena_lib.reset_map(mod, arena)
|
||||
if not arena.pos1 or arena.is_resetting then return end
|
||||
|
||||
if not hard_reset then
|
||||
if not arena_lib.mods[mod].regenerate_map or not arena.enabled then return end
|
||||
async_reset_map(mod, arena)
|
||||
if not arena_lib.mods[mod].regenerate_map or not arena.enabled then return end
|
||||
async_reset_map(mod, arena)
|
||||
end
|
||||
|
||||
else
|
||||
local ID = arena_lib.get_arena_by_name(mod, arena.name)
|
||||
arena.pos1, arena.pos2 = vector.sort(arena.pos1, arena.pos2)
|
||||
|
||||
minetest.place_schematic(
|
||||
arena.pos1,
|
||||
("%s/arena_lib/Schematics/%s_%d.mts"):format(minetest.get_worldpath(), mod, ID),
|
||||
"0",
|
||||
nil,
|
||||
true
|
||||
)
|
||||
end
|
||||
|
||||
function arena_lib.hard_reset_map(sender, mod, arena_name)
|
||||
local id, arena = arena_lib.get_arena_by_name(mod, arena_name)
|
||||
|
||||
-- se l'arena non esiste
|
||||
if not arena then
|
||||
arena_lib.print_error(sender, S("This arena doesn't exist!"))
|
||||
return end
|
||||
|
||||
local schem_path = minetest.get_worldpath() .. ("/arena_lib/Schematics/%s_%d.mts"):format(mod, id)
|
||||
local schem = io.open(schem_path, "r")
|
||||
|
||||
-- se la schematica non esiste
|
||||
if not schem then
|
||||
arena_lib.print_error(sender, S("There is no schematic to paste!"))
|
||||
return end
|
||||
|
||||
schem:close()
|
||||
|
||||
-- se l'area non esiste
|
||||
if not arena.pos1 then
|
||||
arena_lib.print_error(sender, S("Region not declared!"))
|
||||
return end
|
||||
|
||||
arena.pos1, arena.pos2 = vector.sort(arena.pos1, arena.pos2)
|
||||
|
||||
minetest.place_schematic(
|
||||
arena.pos1,
|
||||
("%s/arena_lib/Schematics/%s_%d.mts"):format(minetest.get_worldpath(), mod, id),
|
||||
"0",
|
||||
nil,
|
||||
true
|
||||
)
|
||||
|
||||
arena_lib.print_info(sender, arena_lib.mods[mod].prefix .. S("Schematic of arena @1 successfully pasted"))
|
||||
end
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ function arena_lib.save_map_schematic(sender, mod, arena_name)
|
||||
|
||||
arena_lib.update_waypoints(sender, mod, arena)
|
||||
minetest.create_schematic(p1, p2, nil, ("%s/arena_lib/Schematics/%s_%d.mts"):format(minetest.get_worldpath(), mod, id))
|
||||
arena_lib.print_info(sender, arena_lib.mods[mod].prefix .. S("Schematic successfully saved for the arena @1 (pos1 and pos2 have been automatically sorted)", arena.name))
|
||||
arena_lib.print_info(sender, arena_lib.mods[mod].prefix .. S("Schematic of arena @1 successfully saved (pos1 and pos2 have been automatically sorted)", arena.name))
|
||||
end
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user