Commit Graph

6893 Commits

Author SHA1 Message Date
hacker
8ce3ea5f2c Log chat messages on the server 2025-11-02 03:05:19 +00:00
Gustas
b4f3d8ae02 Increase perf for parsing remote maps 2025-03-30 18:21:18 +01:00
Gustas
d70c30763b Add a backup for unloaded bots 2025-03-30 18:17:26 +01:00
Gustas
dd74d3572a Fix utility commands losing data 2025-02-01 20:23:00 +00:00
Matthias Mailänder
f316d4c757 Update dependency model to fix CVE warnings. 2024-12-02 21:31:01 +02:00
RoosterDragon
d6dba3e545 Fix Animation shadow to account for height.
If a unit is above the terrain, the shadow shouldn't display directly underneath the unit, it should take the height into account and display further down. This fix uses the same adjustment as applied by the WithShadow trait.
2024-11-30 14:45:40 +02:00
RoosterDragon
bf7f81b7fe Improve some String.Split calls. 2024-11-15 22:28:18 +02:00
RoosterDragon
cf7f57252e Fix CA2265 2024-11-15 22:28:18 +02:00
RoosterDragon
e2296ad2d1 Fix CA2263 2024-11-15 22:28:18 +02:00
Paul Chote
8b11b499ed Rename Translations yaml keys to FluentMessages. 2024-11-03 16:52:47 +02:00
Paul Chote
c09d7cbdea Remove magic ftl file naming. 2024-11-03 16:52:47 +02:00
Paul Chote
5a0c8439fc Add map support for inline base64 fluent messages.
This enables the RC to parse and share custom messages
as part of the map's custom rules without any additional
API changes.
2024-11-03 16:52:47 +02:00
Paul Chote
43219e16da Reorganize FluentBundle ctors to allow inline text. 2024-11-03 16:52:47 +02:00
Paul Chote
e4539e9cb5 Use nameof() when reflecting over Map field names. 2024-11-03 16:52:47 +02:00
Paul Chote
67254e0b39 Rename Fluent *GetString methods to GetMessage. 2024-11-03 16:52:47 +02:00
Paul Chote
09063d23da Determine pixel-to-texel ratio for each sprite individually.
This fixes rendering artifacts when sprites are scaled > 1.
2024-11-03 16:38:32 +02:00
RoosterDragon
6bd64677ec Use short context names in hotkey yaml, generate translation key at runtime. 2024-10-17 15:10:59 +03:00
RoosterDragon
6f6fb5b393 Expose hotkeys to localisation.
Allows the Settings > Hotkeys screen to be localised, including hotkey decriptions, groups and contexts.

The hotkey names are exposed to localisation via KeycodeExts. Hotkey modifiers are similarly exposed via ModifersExts.

The Settings > Input screen has a Zoom Modifier dropdown, which shows the localised modifier name.

The --check-yaml utility command is taught to recognise all hotkey translation, so it can validate their usage.
2024-10-17 15:10:59 +03:00
Paul Chote
10856ccfd0 Fix weather overlay viewport size for spectators. 2024-10-17 14:27:31 +03:00
Gregor Kališnik
6dd076b27f Improve NAT logging (#21611) 2024-10-07 21:00:07 +02:00
Ivaylo Draganov
79ae71a517 Rename *_RIGHT to *_WIDTH and *_BOTTOM to *_HEIGHT in integer expressions for widgets
The terms "width" and "height" are clearer and they match what the values actually represent (window or parent width/height). The YAML changes are generated with the update rule.
2024-10-07 12:59:25 +03:00
RoosterDragon
bb17cfa179 Expose mod.yaml content to localisation.
Mod metadata, load screens and mod content is all now sourced from ftl files, allowing these items to be translated.

Translations are now initialized as part of ModData creation, as currently they are made available too late for the usage we need here.

The "modcontent" mod learns a new parameter for "Content.TranslationFile" - this allows a mod to provide the path of a translation file to the mod which it can load. This allows mods such as ra, cnc, d2k, ts to own the translations for their ModContent, yet still make them accessible to the modcontent mod.

CheckFluentReference learns to validate all these new fields to ensure translations have been set.
2024-10-07 12:38:40 +03:00
RoosterDragon
d010157611 Improve performance of FrozenActorLayer.Tick
By adding a UpdateVisibilityNextTick flag against every FrozenActor to track when a visibility update is required, we can remove the dirtyFrozenActorIds set in FrozenActorLayer. In the Tick method we can now avoid a set lookup.

Also, don't create the frozenActorsToRemove list until we need one to avoid an allocation.
2024-10-05 21:17:59 +02:00
Paul Chote
464e0dc7d2 Rename Localized to Fluent. 2024-10-04 15:11:27 +03:00
Paul Chote
d6285affec Remove FluentBundle.Arguments helper method. 2024-10-04 15:11:27 +03:00
Paul Chote
b29b685058 Rename Fluent-related code to be more precise. 2024-10-04 15:11:27 +03:00
Ivaylo Draganov
771b9ddfda Remove key handling from ContainerWidget
It has no business handling key input. This was used only for opening the ingame chat and replacing it with a `LogicKeyListener` was trivial.
2024-10-04 14:32:21 +03:00
Ivaylo Draganov
a69ea79d83 Remove PARENT_TOP and PARENT_LEFT from integer expressions for widgets
PARENT_TOP and PARENT_LEFT should be 0 so they are not very useful substitutions. They are replaced with 0 or removed if that was the whole value for a field.
2024-10-03 18:37:13 +03:00
Paul Chote
720b925fd5 Move file system mounting into mod code. 2024-10-02 18:37:46 +03:00
Paul Chote
b60b1e369a Extract ObjectCreator.GetLoader for single objects. 2024-10-02 18:37:46 +03:00
Paul Chote
014cbc0cbd Remove FileSystem.ResolveAssemblyPath 2024-10-02 18:37:46 +03:00
Ivaylo Draganov
806f0fd270 Fix being able to click through some areas of the production palette in RA
The production palette in RA is assembled from a foreground and a background. The foreground provides most of the visible graphics (such as the metallic chrome) but it has to let clicks go through to the production icons. The background is the one that has to stop the clicks then but it was not wide enough (because the art is only for the background behind production icons and not the whole chrome). Trying to fix that by wrapping the image in wider container that has `ClickThrough` set to `false` revealed that there is a bug with the cloning logic for `ContainerWidget`. It simply did not copy the `ClickThrough` field and it was always `true` for cloned widgets. So the value in YAML was lost when the template was cloned.
2024-10-02 11:44:03 +03:00
RoosterDragon
b4882a8b03 Avoid some allocations in MiniYaml.Merge.
During the merge operation, it is quite common to be dealing with a node that has no child nodes. When there are no such nodes, we can return early from some functions to avoid allocating new collections that will not be used.

In the MergePartial operation, reuse a dictionary as scratch space when checking for conflicts. We introduce a IntoDictionaryWithConflictLog helper to allow this. This avoids allocating a new dictionary for the conflict log that gets thrown away at each check.
2024-09-23 16:18:00 +02:00
Matthias Mailänder
327c1ba23b Adapt to upcoming environment special folder change. 2024-09-17 23:11:27 +02:00
Matthias Mailänder
2aa37d9392 Adapt to upcoming environment special folder change. 2024-09-16 19:50:06 +03:00
RoosterDragon
7775b42b59 Change constructOrderCache to an array. 2024-09-15 22:02:14 +03:00
RoosterDragon
dd9aca83dd Expose the default font and cursor sheet size settings to mod.yaml 2024-08-27 19:25:07 +03:00
RoosterDragon
32bc99a11a Restored missing IDisposable to CursorManager. 2024-08-27 19:25:07 +03:00
RoosterDragon
1218ca09ae Use a smaller sheet in CursorManager.
Provide an explicit size of 512, smaller than the default 2048. The cursors for all mods still pack onto this single sheet, so we avoid wasting memory on larger sheets.

Sorting the cursors also helps pack them onto the sheets more efficiently.
2024-08-27 19:25:07 +03:00
RoosterDragon
8101c70c91 Allow sheet buffers to be reused in SheetBuilder.
Sheets can be buffered - where a copy of their data is kept in RAM. This allows for modifications to the sheet to be batched in the RAM buffer, before later being committed to VRAM in a single operation. The SheetBuilder class allows for sprites to be allocated onto one or more sheets. Each time a sheet is filled, it will allocate a new sheet. Sheets allocated by the sheet builder will typically use the buffering mechanism.

Previously each time the builder allocated a new sheet, the buffer would get thrown away, and the next sheet would allocate a fresh buffer. These buffers can be large and may accumulate before the GC cleans them up. So although only one buffer will be live at a time, they can cause a spike in memory used by the process during loading.

We can avoid this issue by allowing the buffer from the previous sheet to be reused by the next sheet. This is possible because the sheet builder only has one live sheet for modifications at a time, and they are all the same type and size. By allocating only one buffer per builder instead of one per sheet, we reduce the peak memory required during loading.
2024-08-19 14:08:04 +03:00
RoosterDragon
7f05227e56 Remove some unrequired Sheet.CreateBuffer or Sheet.ReleaseBuffer calls.
- In CursorManager, we can release the buffer on the final sheet after loading cursors. We don't need to release the buffer on every sheet in the builder, as the builder will handle that.
- In SpriteCache, we don't need to call CreateBuffer explicitly, as the builder will do that for us.
- In RadarWidget, we don't need to call CreateBuffer explicitly, as GetData will do that for us.
2024-08-19 14:08:04 +03:00
Matthias Mailänder
2d0b5f5fea Avoid possibly incompatible ZIP extra data. 2024-08-10 20:46:16 +03:00
Matthias Mailänder
9761a68cd4 Don't disallow players chosing bot names. 2024-08-05 12:55:59 +03:00
Matthias Mailänder
4e5556dccc Expose player names to localization. 2024-08-05 12:55:59 +03:00
Paul Chote
50d4936e51 Add SpriteCache.LoadFramesUncached.
This allows users (currently TDHD) to load ISpriteFrames
directly, without them being stored in the cache.
2024-08-05 12:30:33 +03:00
Paul Chote
8c5a286574 Call AdjustFrame with frame index and total. 2024-08-05 12:30:33 +03:00
Gustas
014163d7d3 Add a more helpful crash 2024-08-04 20:17:26 +02:00
RoosterDragon
b313f47660 Implement Stream.Read(Span<byte>) overloads.
The default Stream implementation of this method has to rent an array so it can call the overload that accepts an array, and then copy the output over. This is because the array overload is required and the span overload was only added more recently.

We can avoid the overhead of this by implementing the span overload and working with the destination span directly. Do so for all classes we have that derive from Stream, and redirect their array overload to the span overload for code reuse.
2024-08-04 10:40:43 +01:00
RoosterDragon
ab28e6a75a Improve Lua type documentation and bindings.
The ExtractEmmyLuaAPI utility command, invoked with `--emmy-lua-api`, produces a documentation file that is used by the [OpenRA Lua Language Extension](https://marketplace.visualstudio.com/items?itemName=openra.vscode-openra-lua) to provide documentation and type information is VSCode and VSCode compatible editors when editing the Lua scripts.

We improve the documentation and types produced by this utility in a few ways:
- Require descriptions to be provided for all items.
- Fix the type definitions of the base engine types (cpos, wpos, wangle, wdist, wvec, cvec) to match with the actual bindings on the C# side. Add some extra bindings for these types to increase their utility.
- Introduce ScriptEmmyTypeOverrideAttribute to allow the C# side of the bindings to provide a more specific type. The utility command now requires this to be used to avoid accidentally exporting poor type information.
- Fix a handful of scripts where the new type information revealed warnings.

The ability to ScriptEmmyTypeOverrideAttribute allows parameters and return types to provide a more specific type compared to the previous, weak, type definition. For example LuaValue mapped to `any`, LuaTable mapped to `table`, and LuaFunction mapped to `function`. These types are all non-specific. `any` can be anything, `table` is a table without known types for its keys or values, `function` is a function with an unknown signature.

Now, we can provide specific types. , e.g. instead of `table`, ReinforcementsGlobal.ReinforceWithTransport is able to specify `{ [1]: actor, [2]: actor[] }` - a table with keys 1 and 2, whose values are an actor, and a table of actors respectively. The callback functions in MapGlobal now have signatures, e.g. instead of `function` we have `fun(a: actor):boolean`. In UtilsGlobal, we also make use of generic types. These work in a similar fashion to generics in C#. These methods operate on collections, we can introduce a generic parameter named `T` for the type of the items in those collections. Now the return type and callback parameters can also use that generic type. This means the return type or callback functions operate on the same type as whatever type is in the collection you pass in. e.g. Utils.Do accepts a collection typed as `T[]` with a callback function invoked on each item typed as `fun(item: T)`. If you pass in actors, the callback operates on an actor. If you pass in strings, the callback operates on a string, etc.

Overall, these changes should result in an improved user experience for those editing OpenRA Lua scripts in a compatible IDE.
2024-08-03 19:12:51 +03:00
Matthias Mailänder
ebaed9966b Update Linguini. 2024-08-03 12:00:16 +03:00