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. |
TaranDahl
left a comment
There was a problem hiding this comment.
I see no other issues.
|
喵? |
Since this is your first PR submission, your code will need reviews from more maintainers before it can be merged. This is the rule of Phobos. |
OK, I will stop resolving the conflict before there are further results. |
There was a problem hiding this comment.
Pull request overview
This pull request refactors Phobos’ TechnoType conversion pipeline to support cross-category conversions (object replacement) across Infantry/Unit/Building types, adds a new BuildingType INI trigger (UndeploysInto.ConvertTo) to convert the undeployed unit on the next frame, and updates documentation/changelog/credits accordingly.
Changes:
- Added cross-category conversion via
TechnoExt::ConvertToTypeEx(create new object + destroy old), with deferred conversion support (PendingConvertTechnoType) processed inTechnoExt::OnEarlyUpdate. - Centralized status transfer during deploy/undeploy (mind control, shields, invulnerability, attached effects, multipliers, etc.) via
TechnoExt::SyncStatus. - Added deploy feedback improvements and documented the new conversion behaviors (including zh_CN locale updates and credits/changelog entries).
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/Misc/Hooks.BugFixes.cpp |
Switches deploy-to-fire checks to TechnoExt::CanDeployIntoBuilding. |
src/Ext/Unit/Hooks.DeploysInto.cpp |
Uses TechnoExt::SyncStatus, adds UndeploysInto.ConvertTo deferral, adds deploy action hook, adjusts deploy placement/desync logic. |
src/Ext/Unit/Hooks.DeployFire.cpp |
Adds NoDeploy feedback (EVA) when Convert.Deploy targets a building without sufficient space. |
src/Ext/Unit/Body.h |
Removes UnitExt deployer/static deploy checks now moved into TechnoExt. |
src/Ext/Unit/Body.cpp |
Removes UnitExt::Deployer and UnitExt::CanDeployIntoBuilding implementation. |
src/Ext/Techno/Body.Update.cpp |
Processes deferred conversions (PendingConvertTechnoType) during early update. |
src/Ext/Techno/Body.h |
Adds PendingConvertTechnoType, Deployer, and new conversion/status-transfer method declarations. |
src/Ext/Techno/Body.cpp |
Implements SyncStatus, moves deploy-related helpers into TechnoExt, and adds ConvertToTypeEx for cross-category conversions. |
src/Ext/BuildingType/Body.h |
Adds UndeploysInto_ConvertTo storage and declares a helper for deploy cell computation. |
src/Ext/BuildingType/Body.cpp |
Implements GetDeployBuildingTopLeftCell, reads/serializes UndeploysInto.ConvertTo. |
docs/Whats-New.md |
Adds changelog entries for cross-category conversion and related improvements. |
docs/New-or-Enhanced-Logics.md |
Documents UndeploysInto.ConvertTo. |
docs/Fixed-or-Improved-Logics.md |
Updates “fixed/improved” notes for conversion behavior and feedback. |
docs/locale/zh_CN/LC_MESSAGES/Whats-New.po |
Adds zh_CN translations for new changelog bullets. |
docs/locale/zh_CN/LC_MESSAGES/New-or-Enhanced-Logics.po |
Adds zh_CN translations for UndeploysInto.ConvertTo docs. |
docs/locale/zh_CN/LC_MESSAGES/Fixed-or-Improved-Logics.po |
Updates zh_CN translations to match new conversion/feedback entries. |
docs/locale/zh_CN/LC_MESSAGES/CREDITS.po |
Adds zh_CN credits entries for the contributor. |
CREDITS.md |
Adds credits entries for the new conversion features and preservation behaviors. |
Suppressed comments (3)
src/Ext/Techno/Body.cpp:526
ConvertToTypeExcallsSyncStatus(which can transfer mind control, shields, attached effects, etc.) beforeForceCreate. IfForceCreatefails, the source unit's state may already have been mutated (e.g., mind control freed), leaving it in an inconsistent state.
SyncStatus(pThis, pBuilding);
pBuilding->QueueMission(Mission::Construction, false);
pBuilding->NextMission();
src/Ext/Techno/Body.cpp:576
ConvertToTypeExcallsSyncStatusbefore attemptingUnlimbothe new unit. IfUnlimbofails, the rollback path re-unlimbos the old unit but does not restore any state already transferred (mind control, attached effects, etc.). Move status transfer until after the new unit has been successfully placed.
if (auto const pUnit = static_cast<FootClass*>(pToType->CreateObject(pHouse)))
{
SyncStatus(pThis, pUnit);
// Remove old techno from map
pThis->Limbo();
src/Ext/Techno/Body.cpp:568
- PR description says cross-category conversion should not support
AircraftType(only same-type in-place conversion).ConvertToTypeExcurrently includesAbstractType::AircraftTypein the cross-type object-replacement path, which contradicts that behavior.
case AbstractType::InfantryType:
case AbstractType::UnitType:
case AbstractType::AircraftType:
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
1e729ed to
7233fdb
Compare
Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
…rsion and improve code clarity Co-authored-by: Netsu_Negi <71598172+NetsuNegi@users.noreply.github.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>
Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>
What kind of change is this?
Skip Changelog).Skip Changelog,Skip Docs).Skip Docs).Skip Changelog,Skip Docs,Skip Credits).Description
This PR allows Phobos TechnoType conversion logic to convert between different TechnoType categories.
Changes
TechnoExt::ConvertToTypeto acceptTechnoClassinstead of onlyFootClass.BuildingType, including building-to-building conversions.Convert.Deploy,Convert.Undeploy,Ammo.AutoConvertTypeandConvert.Health.TechnoClassupdate path.Convert.Deployconversions to buildings now validate building placement rules before execution.Notes
Because cross-category conversions create a new map object, some state or associations attached to the original object may not be preserved.