Commit Graph

3842 Commits

Author SHA1 Message Date
Paul Chote
23b7b56c28 Combine IMapGenerator interfaces.
This removes the need to instantiate a dummy
trait instance and is more idiomatic.
2025-03-04 09:05:59 +02:00
RoosterDragon
0338258b45 Fix IDE0200 2025-02-22 14:56:25 +02:00
RoosterDragon
ce3ad6fbb3 Some improvements for SpatiallyPartitioned.
- Tweak the Update and Remove methods to reduce the number of dictionary lookups required.
- Change the Update method to an indexer, this allows simplifying callers who wanted to AddOrUpdate a value.
- Implement IDictionary<T, Rectangle>, since the class already implements these semantics by providing a backing store of the bounds for each item.
- Clean up some naming to use the generic `item` instead of `actor`.
- Make the MutateBins action methods static.
2025-02-22 14:50:15 +02:00
RoosterDragon
1b2c119b58 Fix RCS1257, RCS1258, RCS1261, RCS1262, RCS1265, RCS1266, RCS1267 2025-02-22 14:35:57 +02:00
RoosterDragon
96de59f75a Run spell check over solution. 2025-02-16 12:45:19 +01:00
RoosterDragon
639dc7c288 Fix a bad comparison against Target.Invalid.
Target.Invalid acts like a NaN, and will not compare equal with itself. Compare against the TargetType instead, which performs the intended comparison.
2025-02-15 13:22:23 +00:00
Ashley Newson
98fe3c98ab Refine civilian building placement and multibrushes 2025-02-11 12:57:04 +02:00
Ashley Newson
cc632660eb Add decorative civilian buildings to random maps
Allows the random map generator to optionally place civilian buildings
around the map for extra decoration. Buildings are placed last with
lowest priority to avoid competing for play area and resources.

Depends on #21738
2025-02-11 12:57:04 +02:00
Gustas
09259be796 Match the check inside .CenterPosition 2025-02-01 20:31:07 +00:00
Gustas
56109b0ca1 Fix bot harvesters crashing 2025-02-01 17:39:40 +02:00
Ashley Newson
1fda679b9f Refine map generator spawn placement rules
Spawn generation generally tries to place spawns:

- In spacious areas
- Away from the center (true center or mirror lines)
- Away from a symmetry-projected spawn
- Away from previously placed spawns

This commit introduces the following adjustments:

- The spacing between sequentially placed spawns is relaxed.
- Fix spawn mines contributing too much to the space reservation.
- Factor rotations into anti-center biasing calculation.
- Preserve spacing information in center space fallback decisions.
- Use a linear (instead of binary) falloff for anti-center biasing.
- Enforce that spawns have a minimum buildable area around them.
- Enforce that symmetry-projected spawns have as much separation as
  sequentially placed spawns would.
- Allow spawns on or near roads.
2025-01-31 13:58:20 +02:00
Ashley Newson
cdbcfb9e20 Fix illegal ore rings popping up around spawns in generated maps
Reorders and groups selective clearing of the resource placement plan to
-int.MaxValue to avoid subsequent code from inappropriately trying to
use it in arithmetic, which may just underflow to some completely wrong
value and lead to resources in illegal places.
2025-01-29 13:34:49 +02:00
Ashley Newson
037326024b Remove floating points from map generation
Removes all use of floating point from the RaMapGenerator map generator
and its dependencies.

Floating point behavior is potentially non-portable across client
hardware. Removing them should make the map generation logic
consistent even across clients with different floating point hardware
or compiler behavior. This may be useful for sync-safe multiplayer map
generation where clients independently generate the map from settings.

Most previously fractional public-facing settings are now represented
as numbers out of 1000, with some exceptions using 1000000. Most
internal logic which relies on fixed-point concepts now uses 1024ths,
though some floating point mechanisms have been replaced with
alternative discrete approximations (e.g. gaussian to binomial).
2025-01-27 20:42:38 +02:00
Ashley Newson
2126f3c5a2 Add CnC map generator support
Adds map generator support for CnC (all tilesets), largely on par with
RA.

Most tilesets do not have a complete set of beach templates and
therefore do not support terrain settings involving water. DESERT is the
only tileset supporting water. Unlike in RA, water is not playable space
in CnC (no naval units), so only terrain settings with small bodies of
water are available.

Most changes are configuration (tileset and map generator config), with
just a small number of code changes.
2025-01-20 12:55:36 +02:00
Ashley Newson
9d77ca2bf8 Generate more elaborate roads
Updates the random map generator to produce more elaborate roads:

- Roads extend beyond map bounds.
- Shorter, unviable roads are pruned and merged to create longer roads.
- Roads can loop.
2025-01-18 13:32:56 +02:00
Dan Stoian
e903baf680 Implement auto-save 2025-01-17 18:01:20 +02:00
Ashley Newson
dc4c596fa0 Fix an out-of-bounds CellLayer access in RaMapGenerator
Adds a bounds check for the water obstruction code, where a rotation
projection can be outside of the map area (on rotations other than
1, 2, or 4.)
2025-01-16 12:56:44 +02:00
Ashley Newson
417f787294 Add experimental RA procedural map generator
Add an experimental procedural map generator for the Red Alert mod,
along with supporting code that may assist in the development of map
generators for other mods.

Map generation may be accessed as a tool in the Map Editor. This change
does not presently introduce direct lobby options for generated maps.

Features:

- Terrain with land, water, beaches, cliffs, roads, debris, and trees.
- Placement of mpspawns, neutral buildings, and resources.
- Rotational and mirror symmetry options.
- Various configurable parameters with presets.
- Deterministic with configurable seed.
- Performant.
2025-01-09 16:47:10 +02:00
louxia
0536c58b78 Avoid units continuing to follow the unattackable targets 2025-01-08 21:45:44 +02:00
michaeldgg2
c7cc9a68fd Eradicate ☠ Mono ☠
Co-Authored-By: Gustas <37534529+punkpun@users.noreply.github.com>
2025-01-07 18:07:13 +02:00
Paul Chote
5450572e0a Allow maps to override the player viewport size. 2025-01-06 23:57:08 +02:00
Gustas
8b4478260e Raname GrantConditionOnDeployWithCharge to GrantChargedConditionOnToggle
Also allow deploying without cancelling current activity, and make saboteurs use it
2024-12-27 16:37:49 +02:00
Gustas
1904012604 Fix harvesters refusing to queue dock orders whenn empty 2024-12-27 16:30:38 +02:00
RoosterDragon
0051d6fd63 Fix BaseBuilderBotModule.LocomotorsForProducibles.
Account for per-actor production (e.g. ProductionQueue) and per-player production (e.g. ClassicProductionQueue). This requires resolving the Production and ProductionQueue traits on both the producing actor, and the owning player actor.

When setting rally points, check the actor didn't die first.
2024-12-19 19:36:28 +02:00
Mustafa Alperen Seki
087aebe058 Fix broken condition support for InstantlyRepairable. 2024-12-12 00:30:01 +02:00
RoosterDragon
ed90322a0b Fix IDE0032 2024-11-15 22:28:18 +02:00
Paul Chote
feef5be143 Allow mods to override Encyclopedia preview owners. 2024-11-03 17:19:30 +02:00
Paul Chote
f805d67741 Allow mods to display Encyclopedia production info. 2024-11-03 17:19:30 +02:00
Paul Chote
eff4c66410 Allow Encyclopedia entries to scale the actor preview. 2024-11-03 17:19:30 +02:00
abcdefg30
78e47ea70a Support using player palettes as effect palette for SpawnActorPower 2024-11-03 17:02:00 +02:00
Paul Chote
67254e0b39 Rename Fluent *GetString methods to GetMessage. 2024-11-03 16:52:47 +02:00
Gustas
67855f2adf Don't crash if 2 DockHosts overlap 2024-10-13 14:35:59 +01:00
Gustas
f06d7d29ef Add support for not displaying target lines 2024-10-13 14:35:59 +01:00
Gustas
b72d4ab7c6 Fix clients acquiring hosts on order creations 2024-10-13 14:35:59 +01:00
Gustas
d22bdbe944 Only allow docking to allied refineries if directly ordered 2024-10-13 14:35:59 +01:00
Gustas
d24533d561 Simplify IDockHost interface 2024-10-13 14:35:59 +01:00
Gustas
1334575ba9 Add RequireForceMoveCondition to DockClientManager 2024-10-13 14:35:59 +01:00
Gustas
5048a50403 Fix refineries not uncloaking on dock 2024-10-13 14:35:59 +01:00
RoosterDragon
86b9227577 In RemoveCellsFromPlayerShroud, don't call RemoveSource unless required.
Since AddCellsToPlayerShroud only adds for players with a valid relationship, we can skip a dictionary lookup in RemoveSource by only attempting the remove if the relationship check passes as well.
2024-10-07 12:14:45 +03:00
MHecker-code
6794b2dc40 Update OrderEffects.cs
Pass order name to OrderEffects
2024-10-05 10:06:33 +01: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
michaeldgg2
9524db20fe RenderMouseBounds: debug trait for tweaking mouse bounds of Interactable/Selectable trait 2024-09-20 23:38:26 +02:00
michaeldgg2
96235654f1 Interactable: allow specifying arbitrary 2D polygon for mouse interaction. 2024-09-20 23:38:26 +02:00
michaeldgg2
073ce4a718 Editor: ActorEditLogic: support for dynamic generation of items in dropdown 2024-09-20 15:03:06 +03:00
tjk-ws
b5b16df9e0 Fix parallel queues not pausing production when more than one item is queued 2024-09-19 18:07:02 +02:00
Gustas
9c60ac23a3 Rename ThrowsShrapnel to FireProjectilesOnDeath 2024-09-19 17:53:43 +02:00
Gustas
c050b211eb Rename Explodes to FireWarheadsOnDeath 2024-09-19 17:53:43 +02:00
Gustas
29c4aebe19 Add missing descriptions to AirstrikePower and ParatroopersPower 2024-09-19 17:53:43 +02:00