Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class CrateCollideModuleData : public CollideModuleData
Bool m_isForbidOwnerPlayer; ///< This crate cannot be picked up by the player of the dead thing that made it.
Bool m_isBuildingPickup; ///< This crate can be picked up by a Building (bypassing AI requirement)
Bool m_isHumanOnlyPickup; ///< Can this crate only be picked up by a human player? (Mission thing)
Bool m_allowMultiPickup; ///< Can this crate be picked up by multiple objects on the same frame?
ScienceType m_pickupScience; ///< Can only be picked up by a unit whose player has this science
FXList *m_executeFX; ///< FXList to play when activated

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ CrateCollideModuleData::CrateCollideModuleData()
m_executeAnimationFades = TRUE;
m_isBuildingPickup = FALSE;
m_isHumanOnlyPickup = FALSE;
m_allowMultiPickup = FALSE;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

m_executeFX = nullptr;
m_pickupScience = SCIENCE_INVALID;
m_executionAnimationTemplate = AsciiString::TheEmptyString;
Expand All @@ -68,6 +69,7 @@ void CrateCollideModuleData::buildFieldParse(MultiIniFieldParse& p)
{ "ForbidOwnerPlayer", INI::parseBool, nullptr, offsetof( CrateCollideModuleData, m_isForbidOwnerPlayer ) },
{ "BuildingPickup", INI::parseBool, nullptr, offsetof( CrateCollideModuleData, m_isBuildingPickup ) },
{ "HumanOnly", INI::parseBool, nullptr, offsetof( CrateCollideModuleData, m_isHumanOnlyPickup ) },
{ "AllowMultiPickup", INI::parseBool, nullptr, offsetof( CrateCollideModuleData, m_allowMultiPickup ) },
{ "PickupScience", INI::parseScience, nullptr, offsetof( CrateCollideModuleData, m_pickupScience ) },
{ "ExecuteFX", INI::parseFXList, nullptr, offsetof( CrateCollideModuleData, m_executeFX ) },
{ "ExecuteAnimation", INI::parseAsciiString, nullptr, offsetof( CrateCollideModuleData, m_executionAnimationTemplate ) },
Expand Down Expand Up @@ -164,7 +166,7 @@ Bool CrateCollide::isValidToExecute( const Object *other ) const

// TheSuperHackers @bugfix Stubbjax 09/02/2026 Prevent the crate from being collected multiple times in a single frame.
#if !RETAIL_COMPATIBLE_CRC
if (getObject()->isDestroyed())
if (getObject()->isDestroyed() && !md->m_allowMultiPickup)
return FALSE;
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class CrateCollideModuleData : public CollideModuleData
Bool m_isForbidOwnerPlayer; ///< This crate cannot be picked up by the player of the dead thing that made it.
Bool m_isBuildingPickup; ///< This crate can be picked up by a Building (bypassing AI requirement)
Bool m_isHumanOnlyPickup; ///< Can this crate only be picked up by a human player? (Mission thing)
Bool m_allowMultiPickup; ///< Can this crate be picked up by multiple objects on the same frame?
ScienceType m_pickupScience; ///< Can only be picked up by a unit whose player has this science
FXList *m_executeFX; ///< FXList to play when activated

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ CrateCollideModuleData::CrateCollideModuleData()
m_executeAnimationFades = TRUE;
m_isBuildingPickup = FALSE;
m_isHumanOnlyPickup = FALSE;
m_allowMultiPickup = FALSE;
m_executeFX = nullptr;
m_pickupScience = SCIENCE_INVALID;
m_executionAnimationTemplate = AsciiString::TheEmptyString;
Expand All @@ -71,6 +72,7 @@ void CrateCollideModuleData::buildFieldParse(MultiIniFieldParse& p)
{ "ForbidOwnerPlayer", INI::parseBool, nullptr, offsetof( CrateCollideModuleData, m_isForbidOwnerPlayer ) },
{ "BuildingPickup", INI::parseBool, nullptr, offsetof( CrateCollideModuleData, m_isBuildingPickup ) },
{ "HumanOnly", INI::parseBool, nullptr, offsetof( CrateCollideModuleData, m_isHumanOnlyPickup ) },
{ "AllowMultiPickup", INI::parseBool, nullptr, offsetof( CrateCollideModuleData, m_allowMultiPickup ) },
{ "PickupScience", INI::parseScience, nullptr, offsetof( CrateCollideModuleData, m_pickupScience ) },
{ "ExecuteFX", INI::parseFXList, nullptr, offsetof( CrateCollideModuleData, m_executeFX ) },
{ "ExecuteAnimation", INI::parseAsciiString, nullptr, offsetof( CrateCollideModuleData, m_executionAnimationTemplate ) },
Expand Down Expand Up @@ -167,7 +169,7 @@ Bool CrateCollide::isValidToExecute( const Object *other ) const

// TheSuperHackers @bugfix Stubbjax 09/02/2026 Prevent the crate from being collected multiple times in a single frame.
#if !RETAIL_COMPATIBLE_CRC
if (getObject()->isDestroyed())
if (getObject()->isDestroyed() && !md->m_allowMultiPickup)
return FALSE;
#endif

Expand Down
Loading