Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
cf33e39
WIP Techno Attachment logic
Metadorius Nov 11, 2021
774bfa5
Restrict commandability of attached technos
Metadorius Nov 12, 2021
b64eb0b
Implement InheritsCommands pt. 1
Metadorius Nov 12, 2021
01dd1cd
Fix command inheritance crashing in waypoint mode
Metadorius Nov 15, 2021
58c7c0a
Filter movement commands
Metadorius Nov 15, 2021
facba8c
Proper implementation of command inheritance
Metadorius Nov 20, 2021
9d6ca0d
Merge branch 'develop' into feature/techno-attachment
Metadorius Apr 21, 2022
2754e67
Merge branch 'develop' into feature/techno-attachment
Metadorius Apr 21, 2022
d736a5e
Merge branch 'develop' into feature/techno-attachment
Metadorius Apr 21, 2022
ac910db
Init docs
Metadorius Apr 22, 2022
43b679f
Stop command handling
Metadorius Apr 22, 2022
2ebec58
Merge branch 'develop'
Metadorius Jul 10, 2022
645820a
Fix YRpp
Metadorius Jul 10, 2022
c703dff
Another pass at techno attachment
Metadorius Jul 12, 2022
580d9c8
Fix scatter hook incompatibility with Ares; handle IsLocomotor
Metadorius Jul 12, 2022
1796b3f
Merge branch 'develop' into feature/techno-attachment
Metadorius Jul 12, 2022
cec6eab
Fixed stuff
Metadorius Jul 13, 2022
39158ba
Add sanity check
Metadorius Jul 13, 2022
db9f830
Fix re(tard)factoring
Metadorius Jul 13, 2022
81f52da
Merge branch 'develop' into feature/techno-attachment
Metadorius Jul 14, 2022
7ddae7e
Add failsafe check
Metadorius Jul 19, 2022
5b44a9f
Add ShipLoco support
Metadorius Jul 19, 2022
7e74eb4
Attempt to fix lag
Metadorius Sep 17, 2022
b85f751
Update YRpp
Metadorius Sep 19, 2022
f240be5
BROKEN attempt at rendering from parent's origin
Metadorius Sep 24, 2022
fa93012
Fix partially
Metadorius Sep 25, 2022
799ed8c
Use multiplication, adjust post draw rect calculation
Metadorius Oct 1, 2022
289618e
forgot MakeIdentity
Metadorius Oct 1, 2022
13b6516
it WORKS!
Metadorius Oct 21, 2022
3f7501b
Move the lasertrail's type-convertion aftermath into TechnoClass_AI
chaserli Oct 22, 2022
6d9a0e4
Add YSort handling, fix warnings
Starkku Oct 22, 2022
1c8cc13
Fix shadow drawing, support AircraftClass drawing
Metadorius Oct 22, 2022
b95048e
Merge branch 'develop' into feature/techno-attachment
Metadorius Oct 22, 2022
5502999
Fit to develop changes
Metadorius Oct 22, 2022
61e29be
Fix debug attach task not working
Metadorius Oct 22, 2022
786f279
Merge branch 'develop' into feature/techno-attachment
Metadorius Oct 22, 2022
8ae84db
Revert random ass edit of LaserTrail stuff
Metadorius Oct 22, 2022
5616076
Shut up EditorConfig
Metadorius Oct 22, 2022
60c8321
Handle TunnelLoco
Metadorius Oct 22, 2022
c83d293
Calculate physical location the same way as visual
Metadorius Oct 22, 2022
81495a6
Fix wrong transform being used for location
Metadorius Oct 22, 2022
94d5b67
Fix wrong selectable coords
Metadorius Oct 23, 2022
1ced9ca
Revert to the original function
Metadorius Oct 23, 2022
c9abb2f
use AttachChild in CreateChild
Metadorius Oct 23, 2022
4bc4470
Fix a potential problem with cell passability hook causing unbreaking…
Starkku Oct 23, 2022
c412bfd
I am stupid
Metadorius Oct 23, 2022
d38ca17
Add voxel visual offset code
Metadorius Mar 25, 2023
3cc53f9
Disable prototype jitterless drawing
Metadorius May 23, 2023
0e56afe
Merge develop
Metadorius May 23, 2023
a03299b
Fix stop command crash with Kratos
Metadorius May 24, 2023
0be061c
Merge branch 'develop' into feature/techno-attachment
Metadorius Jun 15, 2023
d5e31a7
Implement custom attachment locomotion
Metadorius Jun 18, 2023
dce5b85
Disable layer checking that prevented picking up objects that changed…
Metadorius Jun 24, 2023
2493840
Handle layer changes in loco
Metadorius Jun 24, 2023
d94c3c4
Make InheritDestruction actually kill the object, not vanish
Metadorius Jun 24, 2023
88ecf1f
Adjust enabled tags & fix docs
Metadorius Jun 24, 2023
6f7d8c4
Fix Kill call signature
Metadorius Jun 24, 2023
f58077f
Merge remote-tracking branch 'origin/develop' into feature/techno-att…
Metadorius Jun 24, 2023
c6d05fe
Mention loco in the doc
Metadorius Jun 24, 2023
81c5bc4
Fix destruction crashing bugs
Metadorius Jun 25, 2023
48702a3
Tentative fix for waypoint mode command inheritance
Starkku Jun 25, 2023
bd185a0
Fix turret drawing & shadow height
Metadorius Jun 26, 2023
efce95c
Revert to draw shadows as for individual units
Metadorius Jun 26, 2023
42411aa
Merge remote-tracking branch 'origin/develop' into feature/techno-att…
Metadorius Jun 26, 2023
2436e2a
Handle airborne attachments
Metadorius Jun 26, 2023
fc749fe
Fix AttachmentLoco destruction crash
Metadorius Jun 27, 2023
e9dbd24
Improve death handling for children, fix Crashable=yes death issues
Metadorius Jun 27, 2023
a063723
Minor fix for crashable units which don't have correct source set
Metadorius Jun 27, 2023
7178452
Allow negative DirType in parsing
Metadorius Jun 27, 2023
e33bb19
Implement RotationAdjust
Metadorius Jun 27, 2023
2a402fe
Improve syncing
Metadorius Jun 28, 2023
e80572a
WIP OccupiesCell impl. + built techno shouldn't occupy bib with child…
Metadorius Jul 6, 2023
c2cb8a4
OccupiesCell pt. 2
Metadorius Jul 6, 2023
c885934
Finished initial OccupiesCell implementation
Metadorius Jul 7, 2023
40e0022
Merge remote-tracking branch 'origin/develop' into feature/techno-att…
Metadorius Jul 7, 2023
28fc477
Merge remote-tracking branch 'origin/develop' into feature/techno-att…
Metadorius Jul 8, 2023
fa16ca2
Clean up a bit, add InheritLayerStatus and custom layer calculation, …
Metadorius Jul 9, 2023
f8d096b
Merge branch 'develop' into feature/techno-attachment
Metadorius Jul 9, 2023
10d929f
Fixed waypointing with InheritCommands, temp. disable actions override
Metadorius Jul 14, 2023
64711e7
Merge remote-tracking branch 'origin/develop' into feature/techno-att…
Metadorius Jul 14, 2023
33327f7
que?
Metadorius Jul 14, 2023
3b1a8e7
Merge remote-tracking branch 'origin/develop' into feature/techno-att…
Metadorius Jul 15, 2023
451a083
Attempt to fix crashes
Metadorius Jul 19, 2023
8f224e5
Implement RespawnTimer and TransparentToMouse, re-enable RespawnAtCre…
Metadorius Jul 19, 2023
a4c9bb6
Merge remote-tracking branch 'origin/develop' into feature/techno-att…
Metadorius Jul 19, 2023
6a793b4
Added missed doc edit for TransparentToMouse
Metadorius Jul 20, 2023
c02f8f9
Try to fix AircraftTracker crash one more time
Metadorius Jul 20, 2023
85e3ea9
Fix TransparentToMouse undesired behavior
Metadorius Jul 20, 2023
eb4439b
(hope)Fully fix pathfinding
Metadorius Aug 5, 2023
57483ae
Remove experimental/commented out stuff
Metadorius Aug 5, 2023
2391209
Minor cleanups
Metadorius Aug 5, 2023
014b4df
Merge remote-tracking branch 'origin/develop' into feature/techno-att…
Metadorius Aug 5, 2023
ff5e9c9
Sensors for attachment loco
Metadorius Sep 7, 2023
2a3d473
(Hacky?) sight for attachment loco
Metadorius Sep 7, 2023
00b221c
Handle CellClass::Incoming properly
Metadorius Sep 7, 2023
39d46d4
Merge remote-tracking branch 'origin/develop' into feature/techno-att…
Metadorius Sep 8, 2023
85025e9
Fix *Layer tags type
Metadorius Sep 8, 2023
1def3aa
Implement building upgrades support
Metadorius Sep 9, 2023
a3b084a
Fix AreRelatives
Metadorius Sep 9, 2023
6f25f1d
Fix passenger loading for multiple technos on cell
Metadorius Apr 17, 2024
76f7bcd
Merge remote-tracking branch 'origin/develop' into feature/techno-att…
Metadorius Apr 17, 2024
64e3fbe
Post-merge fix
Metadorius Apr 17, 2024
d903654
Merge remote-tracking branch 'origin/develop' into feature/techno-att…
Metadorius May 5, 2024
fd7197a
Post-merge fix
Metadorius May 5, 2024
250b4c3
Fix transports not working properly when there's multiple technos on …
Metadorius May 5, 2024
22299b2
Merge branch 'develop' into feature/techno-attachment
Metadorius Sep 19, 2024
6448ac3
InheritCommands.DeployCommand & StopCommand as separate key
Metadorius Sep 19, 2024
4242a29
WIP rewrite of occupancy handling, CellExt crashes
Metadorius Jan 30, 2025
b9cf6a3
cellext working, collisions? still no
Metadorius Feb 1, 2025
32c90bd
")"
DeathFishAtEase Feb 2, 2025
62a7f42
COLLISIONS ARE BACK
Metadorius Feb 2, 2025
446cd5e
Merge remote-tracking branch 'origin/develop' into feature/techno-att…
Metadorius Feb 4, 2025
51da83c
Post-merge fixes
Metadorius Feb 4, 2025
8b0ccdc
Delete an unnecessary ',' & changed "TechnoTypeClass" to "TechnoType"
DeathFishAtEase Feb 22, 2025
44a6a1c
Fix another hook forcing an attachment's facing
ZivDero Mar 7, 2025
e38b338
Fix incorrect usage of std::optional
ZivDero Mar 7, 2025
102a1ec
Merge branch 'develop' into feature/techno-attachment
ZivDero Mar 7, 2025
9b72053
Update YRpp
ZivDero Mar 7, 2025
4f1e9e6
Fix merge error
ZivDero Mar 7, 2025
60edd0d
Revert YRpp
ZivDero Mar 7, 2025
f06ee53
Fix inf. entry on cells with multiple units
Metadorius Mar 9, 2025
928cd71
Merge remote-tracking branch 'origin/develop' into feature/techno-att…
Metadorius Mar 9, 2025
359b083
Switch to new function replacement macro
Metadorius Mar 9, 2025
8ad63c1
forgor to uncomment CheckMovingInto for inf
Metadorius Mar 10, 2025
5568d7a
Fix stop/deploy command inheritance mixing up commands when enabled
Metadorius Mar 10, 2025
03337d9
Merge latest develop
Metadorius Jul 25, 2025
8ee88c8
remove discard_t as unrelated to branch
Metadorius Jul 25, 2025
b9621f8
fix table in docs
Metadorius Jul 25, 2025
4121f3a
Fix compilation; remove more unneeded changes
Metadorius Jul 25, 2025
bece7a8
Fix parsed DirType beign rotated by 1 if negative
Metadorius Jul 25, 2025
959c88b
Re-add Hooks.AI.cpp to compilation
Metadorius Jul 26, 2025
0799bed
Fix unit stuck in factory bug
ayylmaoRotE Jul 26, 2025
ffadbf1
Merge branch 'develop' into feature/techno-attachment
Metadorius Dec 3, 2025
bf49892
Revert to vanilla behavior for CargoClass::Attach, re-patch the usage…
Metadorius Dec 3, 2025
8a05b92
init incoming unit fields with default values (nullptr)
Metadorius Dec 3, 2025
91c8ed0
Split techno functions to another file for TA
Metadorius Dec 4, 2025
f71219c
AttachmentUnit improvement - Selection and Flash (#1992)
DeathFishAtEase Dec 9, 2025
23e0f17
Merge remote-tracking branch 'origin/develop' into feature/techno-att…
Metadorius Mar 1, 2026
b50a295
type conversion support (untested)
Metadorius Mar 2, 2026
dfc5243
Merge branch 'develop' into feature/techno-attachment
Metadorius Mar 3, 2026
41d49ec
feat: attachment conversion on deploy unit <-> build
Metadorius Mar 16, 2026
6d90711
fix: bunch of issues with attachment conversion; works as needed now
Metadorius Mar 22, 2026
3bb21a9
Merge remote-tracking branch 'origin/develop' into feature/techno-att…
Metadorius Mar 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ This page lists all the individual contributions to the project by their author.
- Recursive transport killer fix
- Custom locomotors example implementation and piggybacking test warheads
- Initial jumpjet facing fix
- Techno Attachment logic
- Migration utility
- GitHub Actions setup
- Official docs
Expand Down
13 changes: 11 additions & 2 deletions Phobos.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Ext\Cell\Hooks.cpp" />
<ClCompile Include="src\Ext\Event\Body.cpp" />
<ClCompile Include="src\Ext\Infantry\Hooks.cpp" />
<ClCompile Include="src\Ext\Infantry\Hooks.Firing.cpp" />
Expand All @@ -35,6 +34,7 @@
<ClCompile Include="src\Blowfish\blowfish.cpp" />
<ClCompile Include="src\Blowfish\Hooks.Blowfish.cpp" />
<ClCompile Include="src\Ext\Cell\Body.cpp" />
<ClCompile Include="src\Ext\Cell\Hooks.cpp" />
<ClCompile Include="src\Ext\House\Hooks.ForceEnemy.cpp" />
<ClCompile Include="src\Commands\ToggleSWSidebar.cpp" />
<ClCompile Include="src\Ext\Sidebar\SWSidebar\SWColumnClass.cpp" />
Expand Down Expand Up @@ -95,6 +95,7 @@
<ClCompile Include="src\Ext\Unit\Hooks.Crushing.cpp" />
<ClCompile Include="src\Ext\Unit\Hooks.Harvester.cpp" />
<ClCompile Include="src\Locomotion\TestLocomotionClass.cpp" />
<ClCompile Include="src\Locomotion\AttachmentLocomotionClass.cpp"/>
<ClCompile Include="src\Misc\Hooks.Gamespeed.cpp" />
<ClCompile Include="src\Misc\Hooks.Ares.cpp" />
<ClCompile Include="src\Misc\Hooks.Crates.cpp" />
Expand All @@ -115,7 +116,9 @@
<ClCompile Include="src\New\Type\LaserTrailTypeClass.cpp" />
<ClCompile Include="src\New\Type\Affiliated\InterceptorTypeClass.cpp" />
<ClCompile Include="src\New\Type\Affiliated\PassengerDeletionTypeClass.cpp" />
<ClCompile Include="src\New\Type\AttachmentTypeClass.cpp" />
<ClCompile Include="src\New\Entity\LaserTrailClass.cpp" />
<ClCompile Include="src\New\Entity\AttachmentClass.cpp" />
<ClCompile Include="src\Ext\Aircraft\Body.cpp" />
<ClCompile Include="src\Ext\Aircraft\Hooks.cpp" />
<ClCompile Include="src\Ext\AnimType\Body.cpp" />
Expand Down Expand Up @@ -154,6 +157,7 @@
<ClCompile Include="src\Ext\Techno\Body.cpp" />
<ClCompile Include="src\Ext\Techno\Body.Internal.cpp" />
<ClCompile Include="src\Ext\Techno\Body.Update.cpp" />
<ClCompile Include="src\Ext\Techno\Body.TechnoAttachment.cpp" />
<ClCompile Include="src\Ext\Techno\WeaponHelpers.cpp" />
<ClCompile Include="src\Ext\Techno\Hooks.cpp" />
<ClCompile Include="src\Ext\Techno\Hooks.Cloak.cpp" />
Expand All @@ -162,6 +166,7 @@
<ClCompile Include="src\Ext\Techno\Hooks.ReceiveDamage.cpp" />
<ClCompile Include="src\Ext\Techno\Hooks.TargetEvaluation.cpp" />
<ClCompile Include="src\Ext\Techno\Hooks.Transport.cpp" />
<ClCompile Include="src\Ext\Techno\Hooks.TechnoAttachment.cpp" />
<ClCompile Include="src\Ext\TerrainType\Body.cpp" />
<ClCompile Include="src\Ext\TerrainType\Hooks.cpp" />
<ClCompile Include="src\Ext\TerrainType\Hooks.Passable.cpp" />
Expand All @@ -182,6 +187,7 @@
<ClCompile Include="src\Ext\WeaponType\Hooks.cpp" />
<ClCompile Include="src\Ext\WeaponType\Hooks.DiskLaserRadius.cpp" />
<ClCompile Include="src\Misc\BlittersFix.cpp" />
<ClCompile Include="src\Misc\Hooks.AI.cpp" />
<ClCompile Include="src\Misc\Selection.cpp" />
<ClCompile Include="src\Utilities\Anchor.cpp" />
<ClCompile Include="src\Utilities\Debug.cpp" />
Expand Down Expand Up @@ -260,7 +266,8 @@
<ClInclude Include="src\Ext\TAction\Body.h" />
<ClInclude Include="src\Ext\Team\Body.h" />
<ClInclude Include="src\Ext\TEvent\Body.h" />
<ClInclude Include="src\Locomotion\TestLocomotionClass.h" />
<ClInclude Include="src\Locomotion\TestLocomotionClass.h"/>
<ClInclude Include="src\Locomotion\AttachmentLocomotionClass.h"/>
<ClInclude Include="src\Misc\BlittersFix.h" />
<ClInclude Include="src\Ext\CaptureManager\Body.h" />
<ClInclude Include="src\Misc\FlyingStrings.h" />
Expand All @@ -278,8 +285,10 @@
<ClInclude Include="src\New\Type\LaserTrailTypeClass.h" />
<ClInclude Include="src\New\Type\Affiliated\InterceptorTypeClass.h" />
<ClInclude Include="src\New\Type\Affiliated\PassengerDeletionTypeClass.h" />
<ClInclude Include="src\New\Type\AttachmentTypeClass.h" />
<ClInclude Include="src\New\Entity\LaserTrailClass.h" />
<ClInclude Include="src\New\Entity\ShieldClass.h" />
<ClInclude Include="src\New\Entity\AttachmentClass.h" />
<ClInclude Include="src\Utilities\Anchor.h" />
<ClInclude Include="src\Utilities\Enumerable.h" />
<ClInclude Include="src\Ext\Aircraft\Body.h" />
Expand Down
2 changes: 1 addition & 1 deletion YRpp
Submodule YRpp updated 2 files
+2 −0 BuildingClass.h
+3 −0 TechnoClass.h
30 changes: 16 additions & 14 deletions docs/Miscellanous.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,22 @@ SaveVariablesOnScenarioEnd=false ; boolean
### Semantic locomotor aliases

- It's now possible to write locomotor aliases instead of their CLSIDs in the `Locomotor` tag value. Use the table below to find the needed alias for a locomotor.

| *Alias* | *CLSID* |
|--------:|:----------------------------------------:|
|Drive | `{4A582741-9839-11d1-B709-00A024DDAFD1}` |
|Hover | `{4A582742-9839-11d1-B709-00A024DDAFD1}` |
|Tunnel | `{4A582743-9839-11d1-B709-00A024DDAFD1}` |
|Walk | `{4A582744-9839-11d1-B709-00A024DDAFD1}` |
|DropPod | `{4A582745-9839-11d1-B709-00A024DDAFD1}` |
|Fly | `{4A582746-9839-11d1-B709-00A024DDAFD1}` |
|Teleport | `{4A582747-9839-11d1-B709-00A024DDAFD1}` |
|Mech | `{55D141B8-DB94-11d1-AC98-006008055BB5}` |
|Ship | `{2BEA74E1-7CCA-11d3-BE14-00104B62A16C}` |
|Jumpjet | `{92612C46-F71F-11d1-AC9F-006008055BB5}` |
|Rocket | `{B7B49766-E576-11d3-9BD9-00104B972FE8}` |
- The feature is also supported for Phobos locomotors.

| *Alias* | *CLSID* |
|----------:|:----------------------------------------:|
|Drive | `{4A582741-9839-11d1-B709-00A024DDAFD1}` |
|Hover | `{4A582742-9839-11d1-B709-00A024DDAFD1}` |
|Tunnel | `{4A582743-9839-11d1-B709-00A024DDAFD1}` |
|Walk | `{4A582744-9839-11d1-B709-00A024DDAFD1}` |
|DropPod | `{4A582745-9839-11d1-B709-00A024DDAFD1}` |
|Fly | `{4A582746-9839-11d1-B709-00A024DDAFD1}` |
|Teleport | `{4A582747-9839-11d1-B709-00A024DDAFD1}` |
|Mech | `{55D141B8-DB94-11d1-AC98-006008055BB5}` |
|Ship | `{2BEA74E1-7CCA-11d3-BE14-00104B62A16C}` |
|Jumpjet | `{92612C46-F71F-11d1-AC9F-006008055BB5}` |
|Rocket | `{B7B49766-E576-11d3-9BD9-00104B972FE8}` |
|Attachment | `{C5D54B98-8C98-4275-8CE4-EF75CB0CBE3E}` |

```{note}
`Chrono` is not a standard Alias, but since the default behavior of using `Teleport` will be triggered when the value of `Locomotor` is incorrect, the result of the operation will appear as if `Chrono` has taken effect.
Expand Down
63 changes: 63 additions & 0 deletions docs/New-or-Enhanced-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,69 @@ SuppressReflectDamage.Types= ; List of AttachEffectTypes
SuppressReflectDamage.Groups= ; comma-separated list of strings (group IDs)
```

### Attachments

![Unit Attachment](your image here)
*Attachments used in [mod name](link)*

```{warning}
This feature is not final and is under development.
```

- Technos now can be attached one to another in a tree like way. The attached units won't process any locomotion code and act like a part of a parent unit in a configurable.
- Currently the attached techno may only be a vehicle.
- When attached, the special `Attachment` (`{C5D54B98-8C98-4275-8CE4-EF75CB0CBE3E}`) locomotor is automatically casted on a unit. You may also specify it in the child unit types manually if the unit is not intended to move without a parent (f. ex. a turret).
- Attachment slots can now be assigned an `AttachmentX.ID` string. This enables child techno preservation across type conversions (e.g. Ares `UpdateType`) and deploys between building and unit. Each TechnoType owns its own set of attachment slots, and the following happens when a techno is type-converted:
1. The current type's slots (and any children inside them) are placed in a per-type dormant storage.
2. The new type's slots are set up - restored from dormant storage if the unit previously had this type, or created fresh otherwise.
3. For each new slot that has an `AttachmentX.ID`, the old type's dormant slots are searched for a matching ID. If found, the child and its attachment state (e.g. the respawn timer, scaled proportionally to the new slot's `RespawnDelay`) are transferred into the new slot.
- If the new slot specifies an `AttachmentX.TechnoType` that differs from the child's current type, the child is automatically converted to the new slot's TechnoType.
- If the new slot has no `AttachmentX.TechnoType`, or if the old slot had `AttachmentX.TechnoType` set and the child's type does not match it, the child is transferred as-is regardless of its type.
- Slots without an `AttachmentX.ID` are never matched and their children are not transferred.
4. Unmatched old dormant slots have their children placed in limbo. New slots that ended up empty are unlimboed (unless the parent is currently in limbo).

In `rulesmd.ini`:
```ini
[AttachmentTypes]
0=MNT ; (example)

[MNT]
RespawnAtCreation=true ; boolean
RespawnDelay=-1 ; integer, non-negative values enable the respawn timer
InheritOwner=true ; boolean, whether the child inherits owner of the parent while it's attached
InheritStateEffects=true ; boolean (state effects = chaos, iron curtain etc.)
InheritCommands=true ; boolean
InheritCommands.StopCommand=true ; boolean
InheritCommands.DeployCommand=true ; boolean
LowSelectionPriority=true ; boolean, whether the child is low priority while attached
PassSelection=true ; boolean, whether the child selection propagates to parent
TransparentToMouse=false ; boolean, can't click on attached techno if set
YSortPosition=default ; Attachment YSort position enumeration - default|underparent|overparent
InheritDestruction=true ; boolean
InheritHeightStatus=true ; boolean, whether the layer and InAir/OnGround/IsSurfaced inherited from parent
OccupiesCell=true ; boolean
DestructionWeapon.Child= ; WeaponType, detonated on child when parent is destroyed
DestructionWeapon.Parent= ; WeaponType, detonated on parent when child is destroyed
ParentDestructionMission= ; MissionType, queued to child when parent is destroyed
ParentDetachmentMission= ; MissionType, queued to child when it's detached from parent

[SOMETECHNO] ; TechnoType
; used when this techno is attached
AttachmentTopLayerMinHeight= ; integer
AttachmentUndergroundLayerMaxHeight= ; integer
; used for attaching other technos
AttachmentX.Type=MNT ; AttachmentType (example)
AttachmentX.TechnoType= ; TechnoType that can be attached, currently only units are supported
AttachmentX.FLH=0,0,0 ; integer - Forward, Lateral, Height
AttachmentX.IsOnTurret=false ; boolean
AttachmentX.RotationAdjust=0 ; rotation in DirType, from -255 to 255
AttachmentX.ID= ; string, max 32 chars - ID for child transfer on type conversion; must be unique per TechnoType

[General]
AttachmentTopLayerMinHeight=500 ; integer
AttachmentUndergroundLayerMaxHeight=-256 ; integer
```

### Custom Radiation Types

![image](_static/images/radtype-01.png)
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ New:
- [Implement `CurleyShuffle` for AircraftTypes](Fixed-or-Improved-Logics.md#implement-curleyshuffle-for-aircrafttypes) (ported from Vinifera by Noble_Fish)
- Customize which parasite can remove by warhead (by NetsuNegi)
- Add toggle of whether shield use ArmorMultiplier or not (by NetsuNegi)
- [Techno attachment system](New-or-Enhanced-Logics.md#attachments) (by Kerbiter)

Vanilla fixes:
- Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya)
Expand Down
4 changes: 4 additions & 0 deletions src/Ext/Building/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@ void BuildingExt::KickOutStuckUnits(BuildingClass* pThis)
if (pThis->Owner != pUnit->Owner || pUnit->Locomotor->Destination() != CoordStruct::Empty)
continue;

// Skip attachments - they shouldn't be treated as stuck units
if (TechnoExt::IsAttached(pUnit))
continue;

const auto height = pUnit->GetHeight();

if (height < 0 || height > Unsorted::CellHeight)
Expand Down
4 changes: 4 additions & 0 deletions src/Ext/Building/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ DEFINE_HOOK(0x43FE69, BuildingClass_AI, 0xA)
const auto pTechnoExt = pBuildingExt->TechnoExtData;
pTechnoExt->UpdateLaserTrails(); // Mainly for on turret trails

for (auto const& attachment : pTechnoExt->ChildAttachments)
attachment->AI();

// Force airstrike targets to redraw every frame to account for tint intensity fluctuations.
if (pTechnoExt->AirstrikeTargetingMe)
pThis->Mark(MarkType::Change);
Expand Down Expand Up @@ -752,6 +755,7 @@ DEFINE_HOOK(0x44EFD8, BuildingClass_FindExitCell_BarracksExitCell, 0x6)
return 0;
}


DEFINE_HOOK(0x444B83, BuildingClass_ExitObject_BarracksExitCell, 0x7)
{
enum { SkipGameCode = 0x444C7C };
Expand Down
16 changes: 15 additions & 1 deletion src/Ext/Cell/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ void CellExt::ExtData::Serialize(T& Stm)
.Process(this->RadSites)
.Process(this->RadLevels)
.Process(this->InfantryCount)
.Process(this->IncomingUnit)
.Process(this->IncomingUnitAlt)
;
}

Expand All @@ -28,7 +30,19 @@ void CellExt::ExtData::SaveToStream(PhobosStreamWriter& Stm)
}

void CellExt::ExtData::InvalidatePointer(void* ptr, bool removed)
{ }
{
if (ptr == static_cast<void*>(this->IncomingUnit))
{
this->OwnerObject()->OccupationFlags &= ~0x20;
this->IncomingUnit = nullptr;
}

if (ptr == static_cast<void*>(this->IncomingUnitAlt))
{
this->OwnerObject()->AltOccupationFlags &= ~0x20;
this->IncomingUnitAlt = nullptr;
}
}

bool CellExt::RadLevel::Load(PhobosStreamReader& stm, bool registerForChange)
{
Expand Down
4 changes: 3 additions & 1 deletion src/Ext/Cell/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ class CellExt
std::vector<RadSiteClass*> RadSites {};
std::vector<RadLevel> RadLevels { };
int InfantryCount{ 0 };
UnitClass* IncomingUnit {};
UnitClass* IncomingUnitAlt {};

ExtData(CellClass* OwnerObject) : Extension<CellClass>(OwnerObject)
{ }

virtual ~ExtData() = default;

virtual void InvalidatePointer(void* ptr, bool removed) override;
virtual void InvalidatePointer(void* ptr, bool bRemoved) override;

virtual void LoadFromStream(PhobosStreamReader& Stm) override;
virtual void SaveToStream(PhobosStreamWriter& Stm) override;
Expand Down
73 changes: 73 additions & 0 deletions src/Ext/Cell/Hooks.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "Body.h"

#include <Ext/Rules/Body.h>
#include <Ext/Techno/Body.h>

DEFINE_HOOK(0x480EA8, CellClass_DamageWall_AdjacentWallDamage, 0x7)
{
Expand All @@ -9,3 +10,75 @@ DEFINE_HOOK(0x480EA8, CellClass_DamageWall_AdjacentWallDamage, 0x7)
pThis->DamageWall(RulesExt::Global()->AdjacentWallDamage);
return SkipGameCode;
}

// because 🦅💣 takes over, we have to do reimpl even more of the func and replicate Ares code

void __fastcall UnitClass_SetOccupyBit_Reimpl(UnitClass* pThis, void*, CoordStruct* pCrd)
{
if (TechnoExt::DoesntOccupyCellAsChild(pThis))
return;

CellClass* pCell = MapClass::Instance.GetCellAt(*pCrd);
auto pCellExt = CellExt::ExtMap.Find(pCell);
int height = MapClass::Instance.GetCellFloorHeight(*pCrd) + CellClass::BridgeHeight;
bool alt = (pCrd->Z >= height && pCell->ContainsBridge());

// remember which occupation bit we set
auto pExt = TechnoExt::ExtMap.Find(pThis);
pExt->AltOccupation = alt;

if (alt)
{
pCell->AltOccupationFlags |= 0x20;
// Phobos addition: set incoming unit tracker
pCellExt->IncomingUnitAlt = pThis;
}
else
{
pCell->OccupationFlags |= 0x20;
// Phobos addition: set incoming unit tracker
pCellExt->IncomingUnit = pThis;
}
}

DEFINE_FUNCTION_JUMP(VTABLE, 0x7F5D60, UnitClass_SetOccupyBit_Reimpl);

void __fastcall UnitClass_ClearOccupyBit_Reimpl(UnitClass* pThis, void*, CoordStruct* pCrd)
{
if (TechnoExt::DoesntOccupyCellAsChild(pThis))
return;

enum { obNormal = 1, obAlt = 2 };

CellClass* pCell = MapClass::Instance.GetCellAt(*pCrd);
auto pCellExt = CellExt::ExtMap.Find(pCell);
int height = MapClass::Instance.GetCellFloorHeight(*pCrd) + CellClass::BridgeHeight;
int alt = (pCrd->Z >= height) ? obAlt : obNormal;

// also clear the last occupation bit, if set
auto pExt = TechnoExt::ExtMap.Find(pThis);
if(pExt->AltOccupation.has_value())
{
int lastAlt = pExt->AltOccupation.value() ? obAlt : obNormal;
alt |= lastAlt;
pExt->AltOccupation.reset();
}

if (alt & obAlt)
{
pCell->AltOccupationFlags &= ~0x20;
// Phobos addition: clear incoming unit tracker
pCellExt->IncomingUnitAlt = nullptr;
}

if (alt & obNormal)
{
pCell->OccupationFlags &= ~0x20;
// Phobos addition: clear incoming unit tracker
pCellExt->IncomingUnit = nullptr;
}
}

DEFINE_FUNCTION_JUMP(VTABLE, 0x7F5D64, UnitClass_ClearOccupyBit_Reimpl);

// TODO ^ same for TA for non-UnitClass, not needed so cba for now
7 changes: 7 additions & 0 deletions src/Ext/Rules/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <New/Type/BannerTypeClass.h>
#include <New/Type/InsigniaTypeClass.h>
#include <New/Type/SelectBoxTypeClass.h>
#include <New/Type/AttachmentTypeClass.h>

std::unique_ptr<RulesExt::ExtData> RulesExt::Data = nullptr;

Expand Down Expand Up @@ -37,6 +38,7 @@ void RulesExt::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI)
AttachEffectTypeClass::LoadFromINIList(pINI);
BannerTypeClass::LoadFromINIList(pINI);
InsigniaTypeClass::LoadFromINIList(pINI);
AttachmentTypeClass::LoadFromINIList(pINI);

Data->LoadBeforeTypeData(pThis, pINI);
}
Expand Down Expand Up @@ -372,6 +374,9 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI)

this->UnitsUnsellable.Read(exINI, GameStrings::General, "UnitsUnsellable");

this->AttachmentTopLayerMinHeight.Read(exINI, GameStrings::General, "AttachmentTopLayerMinHeight");
this->AttachmentUndergroundLayerMaxHeight.Read(exINI, GameStrings::General, "AttachmentUndergroundLayerMaxHeight");

// Section AITargetTypes
int itemsCount = pINI->GetKeyCount("AITargetTypes");
for (int i = 0; i < itemsCount; ++i)
Expand Down Expand Up @@ -677,6 +682,8 @@ void RulesExt::ExtData::Serialize(T& Stm)
.Process(this->CylinderRangefinding)
.Process(this->PenetratesTransport_Level)
.Process(this->UnitsUnsellable)
.Process(this->AttachmentTopLayerMinHeight)
.Process(this->AttachmentUndergroundLayerMaxHeight)
;
}

Expand Down
Loading
Loading