New Feature: Support Convert to another type.#2294
Conversation
|
Nightly build for this pull request:
This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build. |
| // Carry over the vehicle's move order | ||
| pUnit->SetDestination(savedDestination, true); | ||
| pUnit->QueueMission(savedMission, false); | ||
| pUnit->NextMission(); | ||
| pUnit->SetTarget(savedTarget); |
There was a problem hiding this comment.
Not quite sure about the inheritance status section. MissionStatus may also be considered. And whether buildings should skip the inheritance of some attributes.
There was a problem hiding this comment.
There was a problem hiding this comment.
Huh,
- Q: Should a building that has
UndeploysIntoinherit the destination?
This kind of issue might need a toggle.
There was a problem hiding this comment.
Building has no destination.
There was a problem hiding this comment.
no destination
That is an example of behavior such as a moving vehicle immediately undeploying after conversion and continuing to the target location.
Alternatively: if a unit becomes a building under unload mission, should the building inherit the unload mission to attack the ground directly below... and so on.
Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
… space Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
Summary
Refactored the underlying type conversion system (
ConvertToType/ConvertToTypeEx) to support cross-type conversion between allTechnoTypeclasses exceptAircraftType. AddedUndeploysInto.ConvertToas a new conversion trigger onBuildingType.Changes
Core: rewritten conversion logic
ConvertToTypeand newConvertToTypeExnow handle cross-type conversion via creating a new object + destroying the old one, supportingInfantryType,UnitType, andBuildingType.AircraftTypeis only supported for same-type conversion (in-place type pointer update).PendingConvertTechnoTypeprocessed inOnEarlyUpdate— used when the source unit needs to finish its current animation frame before being destroyed.This improvement applies to all existing conversion paths (
Convert.Deploy,Convert.Undeploy,Convert.HumanToComputer,Convert.ComputerToHuman, etc.).New feature:
UndeploysInto.ConvertToBuildingTypetagUndeploysInto.ConvertTospecifies a targetTechnoType.UndeploysIntocreates the vehicle, it is converted to the target type on the next frame.Refactor
TransferMindControlOnDeployfromHooks.DeploysInto.cppintoTechnoExtas a reusable static method.Selection preservation
Documentation
Updated
New-or-Enhanced-Logics.mdwith documentation forUndeploysInto.ConvertTo, the expanded type support inConvert.Deploy/Convert.Undeploy, and a warning that cross-type conversion creates a new object and destroys the old one.Files Changed
src/Ext/Techno/Body.cppConvertToTypeExcross-type conversion,ConvertToTypesame-type fallback, property transfersrc/Ext/Techno/Body.hPendingConvertTechnoType, static method declarationssrc/Ext/Techno/Body.Update.cppsrc/Ext/Unit/Hooks.DeploysInto.cppTechnoExt, addUndeploysInto.ConvertTohooksrc/Ext/BuildingType/Body.h/.cppUndeploysInto.ConvertTotagdocs/New-or-Enhanced-Logics.md