feat: Add option to allow a crate to be picked up multiple times in the one frame#2297
Open
Stubbjax wants to merge 1 commit intoTheSuperHackers:mainfrom
Open
feat: Add option to allow a crate to be picked up multiple times in the one frame#2297Stubbjax wants to merge 1 commit intoTheSuperHackers:mainfrom
Stubbjax wants to merge 1 commit intoTheSuperHackers:mainfrom
Conversation
Greptile Overview
|
| Filename | Overview |
|---|---|
| Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp | Initialized m_allowMultiPickup to FALSE, added INI parser field, and updated validation logic to conditionally allow multi-pickup |
| GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp | Initialized m_allowMultiPickup to FALSE, added INI parser field, and updated validation logic to conditionally allow multi-pickup (Zero Hour version) |
Sequence Diagram
sequenceDiagram
participant Object1 as Colliding Object 1
participant Object2 as Colliding Object 2
participant Crate as CrateCollide Module
participant Logic as Game Logic
Note over Object1,Logic: Same Frame - Multiple Collisions
Object1->>Crate: onCollide(Object1)
Crate->>Crate: isValidToExecute(Object1)
alt AllowMultiPickup = No (default)
Crate->>Crate: Check isDestroyed()
Note over Crate: FALSE - not destroyed yet
end
Crate->>Crate: executeCrateBehavior(Object1)
Crate->>Logic: destroyObject(crate)
Note over Crate: Crate marked as destroyed
Object2->>Crate: onCollide(Object2)
Crate->>Crate: isValidToExecute(Object2)
alt AllowMultiPickup = Yes
Note over Crate: Skip destroyed check, allow pickup
Crate->>Crate: executeCrateBehavior(Object2)
else AllowMultiPickup = No (default)
Crate->>Crate: Check isDestroyed()
Note over Crate: TRUE - already destroyed
Crate-->>Object2: Return FALSE (prevent pickup)
end
xezon
reviewed
Feb 13, 2026
| m_executeAnimationFades = TRUE; | ||
| m_isBuildingPickup = FALSE; | ||
| m_isHumanOnlyPickup = FALSE; | ||
| m_allowMultiPickup = FALSE; |
There was a problem hiding this comment.
m_allowMultiPickup = (PRESERVE_RETAIL_BEHAVIOR != 0);
The init value needs to be true when preserving retail behavior, so that legacy INI files work as usual, meaning Mods do not need to be adapted to work correctly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change is a follow-up to #2279 and adds an
AllowMultiPickupfield to theCrateCollidemodule. When assigned a value ofYes, a crate can be collected by multiple colliding objects in a single frame, effectively replicating the original retail behaviour. The field defaults to a value ofNowhen unassigned.This feature was requested as some mods rely on the original behaviour.
Usage: