Map-specific locale bundles system (#9199)

* Fix text setting in marker control

* Fix marker and bridge calculation game crashes, minor marker instruction code fixes

* Add privileged desynced client constant global variables

* Remove broken attempt to not initialize client vars on server

* Make @clientLocale variable non-constant, make @server and @client privileged

* WIP Implementation of map-specific locale bundles

* Progress on map locale bundles: add locale data to saves, make objectives use map locales if possible

* Add print formatting and map locale printing to world processors

* 🗿

* Minor map locales dialog ui changes

* Make map locale bundles load when joining multiplayer server

* Remove static declaration of current locale in MapLocales to fix tests failing

* Unify name of localeprint instruction, minor instruction description change, fix map locales incorrectly loading from clipboard

* Fix locale bundles not saving in game state, add  global var, make objective markers use map locale bundles and .mobile properties on mobile devices

* Even more map locales dialog improvements

* Fix english locale picking (when property isn't presented in current locale but english version has it) not working

* Add icon pasting to map locales dialog, minor ui changes

* Fix inconsistent game crash with null text in objectives, define player.locale on game loading (for clientLocale var)

* Change format instruction placeholders to backslash, fix map locales system incorrectly handling default locale

* understood
This commit is contained in:
ApsZoldat
2023-12-02 05:14:10 +03:00
committed by GitHub
parent 2d6e1cdf65
commit 862d3153d9
15 changed files with 1070 additions and 12 deletions

View File

@@ -444,6 +444,7 @@ editor.waves = Waves
editor.rules = Rules
editor.generation = Generation
editor.objectives = Objectives
editor.locales = Locale Bundles
editor.ingame = Edit In-Game
editor.playtest = Playtest
editor.publish.workshop = Publish On Workshop
@@ -511,6 +512,7 @@ editor.errorlegacy = This map is too old, and uses a legacy map format that is n
editor.errornot = This is not a map file.
editor.errorheader = This map file is either not valid or corrupt.
editor.errorname = Map has no name defined. Are you trying to load a save file?
editor.errorlocales = Error reading invalid locale bundles.
editor.update = Update
editor.randomize = Randomize
editor.moveup = Move Up
@@ -522,6 +524,7 @@ editor.sectorgenerate = Sector Generate
editor.resize = Resize
editor.loadmap = Load Map
editor.savemap = Save Map
editor.savechanges = [scarlet]You have unsaved changes!\n\n[]Do you want to save them?
editor.saved = Saved!
editor.save.noname = Your map does not have a name! Set one in the 'map info' menu.
editor.save.overwrite = Your map overwrites a built-in map! Pick a different name in the 'map info' menu.
@@ -610,6 +613,24 @@ filter.option.threshold2 = Secondary Threshold
filter.option.radius = Radius
filter.option.percentile = Percentile
locales.info = Here, you can add locale bundles for specific languages to your map. In locale bundles, each property has a name and a value. These properties can be used by world processors and objectives using their names. They support text formatting (replacing placeholders with actual values).\n\n[cyan]Example property:\n[]name: [accent]timer[]\nvalue: [accent]Example timer, time left: @[]\n\n[cyan]Usage:\n[]Set it as objective's text: [accent]@timer\n\n[]Print it in a world processor:\n[accent]localeprint "timer"\nformat time\n[gray](where time is a separately calculated variable)
locales.deletelocale = Are you sure you want to delete this locale bundle?
locales.applytoall = Apply Changes To All Locales
locales.addtoother = Add To Other Locales
locales.rollback = Rollback to last applied
locales.filter = Property filter
locales.searchname = Search name...
locales.searchvalue = Search value...
locales.searchlocale = Search locale...
locales.byname = By name
locales.byvalue = By value
locales.showcorrect = Show properties that are present in all locales and have unique values everywhere
locales.showmissing = Show properties that are missing in some locales
locales.showsame = Show properties that have same values in different locales
locales.viewproperty = View in all locales
locales.viewing = Viewing property "{0}"
locales.addicon = Add Icon
width = Width:
height = Height:
menu = Menu
@@ -2267,6 +2288,7 @@ unit.emanate.description = Builds structures to defend the Acropolis core. Repai
lst.read = Read a number from a linked memory cell.
lst.write = Write a number to a linked memory cell.
lst.print = Add text to the print buffer.\nDoes not display anything until [accent]Print Flush[] is used.
lst.format = Replace next placeholder ("[accent]@[]") in text buffer with a value.\nExample:\n[accent]print "test @"\nformat "example"
lst.draw = Add an operation to the drawing buffer.\nDoes not display anything until [accent]Draw Flush[] is used.
lst.drawflush = Flush queued [accent]Draw[] operations to a display.
lst.printflush = Flush queued [accent]Print[] operations to a message block.
@@ -2304,6 +2326,7 @@ lst.effect = Create a particle effect.
lst.sync = Sync a variable across the network.\nLimited to 20 times a second per variable.
lst.makemarker = Create a new logic marker in the world.\nAn ID to identify this marker must be provided.\nMarkers currently limited to 20,000 per world.
lst.setmarker = Set a property for a marker.\nThe ID used must be the same as in the Make Marker instruction.
lst.localeprint = Add map locale property value to the text buffer.\nTo set map locale bundles in map editor, check [accent]Map Info > Locale Bundles[].\nIf client is a mobile device, tries to print a property ending in ".mobile" first.
logic.nounitbuild = [red]Unit building logic is not allowed here.