mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-19 17:05:20 +08:00
fix(CheatEnabler): initialize shield after instant build
This commit is contained in:
1 parent
0e09c17ea0
commit
f611f2f9b3
3 files changed
+12
No files matched your search
@@ -147,6 +147,8 @@ The sync is implemented as an inline PowerShell `Exec` step inside the `ZipMod`
|
||||
- **Internationalization:** `UXAssist/Common/I18N.cs` provides bilingual (EN + ZH) string lookup used across UXAssist and CheatEnabler. Localization keys are declared as `public const string` in per-project registration classes (`UXAssist/Common/I18NKeys.cs`, `CheatEnabler/Localization.cs`, `UniverseGenTweaks/Localization.cs`) and registered through a single `Register()` call from each mod's `Awake()`. Do not pass Chinese string literals to `.Translate()` at call sites.
|
||||
- **Centralized game constants:** Hard-coded item IDs, tech IDs, logistics capacities, and Dyson sphere geometry defaults live in `UXAssist/Common/GameConstants` (`ItemIds`, `TechIds`, `LogisticsConstants`, `DysonSphereConstants`). Prefer these constants over inline literals in UXAssist patches.
|
||||
- **Game source facts:** In the original DSP `Assembly-CSharp.dll`, `PlanetFactory.prebuildCount` is computed as `prebuildCursor - prebuildRecycleCursor - 1`, and normal prebuild add/remove paths maintain those cursors. If Auto Construct UI reports zero while visible construction ghosts exist, first suspect the wrong planet/factory, non-prebuild preview state, or a missed UI refresh path before replacing this property with a pool scan.
|
||||
- **Immediate-build shield initialization:** `PlanetATField.physicsArgs` starts as `null` and is allocated by the first physics-shape recalculation. If CheatEnabler completes the first Planetary Shield Generator synchronously from a build-tool callback, `UIPlanetShieldDetail` can observe `fieldGenerators.count > 0` before that recalculation and dereference the null array. `CargoTrafficPatch.EndBatchBuilding` restores the invariant once per batch by calling `planetATField.UpdatePhysicsShape(true)` when field generators exist but `physicsArgs` is still null.
|
||||
- **Immediate-build beacon timing:** Signal Towers do not share the Planetary Shield initialization race. `DataPool<BeaconComponent>.Add()` resets the value-type component, `NewBeaconComponent` synchronously assigns its entity and already-created power-node IDs, and no UI opens from `beacons.count` or reads tick-created resources. Holo Beacons use `MarkerComponent`; `NewMarkerComponent` also initializes and registers their UI-visible state synchronously.
|
||||
- **Illegal Dyson shell generation:** Estimated triangle vertex counts mirror the original `DysonShell.GenerateGeometry` rasterization as closely as possible, but can still differ from the final frame-generated shell polygon at numerical boundaries. Max-output generation must treat `QuickAddDysonShell` failure as a candidate rejection and try the next candidate rather than assuming the estimate is exact.
|
||||
- **Fail-soft patch application:** `PatchImpl<T>.Enable(true)` applies Harmony patches inside a try/catch. Runtime patching can fail through no fault of ours (Harmony re-runs other mods' transpilers on shared target methods), and an escaping exception would abort the calling `ConfigEntry.SettingChanged` delegate chain, desyncing config UI from config values. On failure it logs a `LogError` with the feature type name, rolls back via `UnpatchSelf()`, and leaves `_patch` null so a later `Enable(true)` can retry.
|
||||
- **Convergent in-game UI state:** In-game overlay widgets whose visibility depends on game state (e.g. `AutoConstructUI`) must not rely solely on one-shot event-driven refreshes (`SettingChanged` handlers, patch `OnEnable`/`OnDisable`), because a thrown exception earlier in a delegate chain or a failed patch application silently drops the refresh. `AutoConstructUI.OnUpdate()` reconciles button visibility and the pending-construction count with actual game state every 30 frames (also effective while paused); the `AutoConstructPatch` postfix on `PlayerAction_Rts.GameTick` only implements the fly-to-target behavior, and `AutoConstructPatch.OnEnable` logs its visibility predicate inputs once per enable as a remote-diagnosis aid.
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* 2.4.5
|
||||
* New button `Generate illegal dyson shells for all layers without nodes and shells`, which is used to extend dyson layers.
|
||||
* You must enable `IllegalDysonShellFunctionsEnabled` of `DysonSphere` section in config to see it.
|
||||
* `Finish build immediately`: Fix a crash when pasting a blueprint containing the first Planetary Shield Generator on a planet.
|
||||
* 2.4.4
|
||||
* `Finish build immediately`: Fix a possible crash.
|
||||
* 2.4.3
|
||||
@@ -193,6 +194,7 @@
|
||||
* 2.4.5
|
||||
* 新按钮 `为所有没有节点和壳的层级生成仙术戴森壳`,用于扩展新戴森壳层面的时候。
|
||||
* 你必须在设置文件里开启`DysonSphere`分类的`IllegalDysonShellFunctionsEnabled`才能看到它。
|
||||
* `立即完成建造`:修复在行星上粘贴包含首座行星护盾发生器的蓝图时可能崩溃的问题。
|
||||
* 2.4.4
|
||||
* `立即完成建造`: 修复一个可能的崩溃问题。
|
||||
* 2.4.3
|
||||
|
||||
@@ -59,6 +59,14 @@ internal class CargoTrafficPatch : PatchImpl<CargoTrafficPatch>
|
||||
_anyBelt = false;
|
||||
factory.planet.physics?.raycastLogic?.NotifyBatchObjectRemove();
|
||||
factory.planet.audio?.SetPlanetAudioDirty();
|
||||
|
||||
var atField = factory.planetATField;
|
||||
var defenseSystem = factory.defenseSystem;
|
||||
if (atField != null && defenseSystem != null &&
|
||||
defenseSystem.fieldGenerators.count > 0 && atField.physicsArgs == null)
|
||||
{
|
||||
atField.UpdatePhysicsShape(updateGeneratorMatrix: true);
|
||||
}
|
||||
}
|
||||
|
||||
public static void TryEndBatchBuilding(PlanetFactory factory)
|
||||
|
||||
Reference in new issue
Block a user