2525// /////////////////////////////////////////////////////////////////////////////////////////////////
2626//
2727// FILE: StickyBombCrateCollide.cpp
28- // Author: Kris Morness, June 2003
29- // Desc: A crate (actually a saboteur - mobile crate) that resets the timer on the target supply dropzone.
28+ // Author: Andi W - Sept 2025
29+ // Desc: Creates a Sticks Bomb on the object we collide with
3030//
3131// /////////////////////////////////////////////////////////////////////////////////////////////////
3232
3333
34-
3534// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
3635#include " PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
3736
38- // #include "Common/GameAudio.h"
39- // #include "Common/MiscAudio.h"
4037#include " Common/Player.h"
41- // #include "Common/PlayerList.h"
4238#include " Common/Radar.h"
43- // #include "Common/SpecialPower.h"
4439#include " Common/ThingFactory.h"
4540#include " Common/ThingTemplate.h"
4641#include " Common/Xfer.h"
4742
48- // #include "GameClient/Drawable.h"
4943#include " GameClient/Eva.h"
50- // #include "GameClient/InGameUI.h" // useful for printing quick debug strings when we need to
5144
52- // #include "GameLogic/ExperienceTracker.h"
5345#include " GameLogic/Object.h"
54- // #include "GameLogic/PartitionManager.h"
55- // #include "GameLogic/ScriptEngine.h"
5646
5747#include " GameLogic/Module/AIUpdate.h"
58- // #include "GameLogic/Module/ContainModule.h"
59- // #include "GameLogic/Module/DozerAIUpdate.h"
60- // #include "GameLogic/Module/HijackerUpdate.h"
61- // #include "GameLogic/Module/OCLUpdate.h"
6248#include " GameLogic/Module/StickyBombCrateCollide.h"
6349#include " GameLogic/Module/StickyBombUpdate.h"
64- // #include "GameLogic/Module/SpecialPowerModule.h"
6550
6651
6752
@@ -79,29 +64,29 @@ StickyBombCrateCollide::~StickyBombCrateCollide( void )
7964
8065// -------------------------------------------------------------------------------------------------
8166// -------------------------------------------------------------------------------------------------
82- Bool StickyBombCrateCollide::isValidToExecute ( const Object *other ) const
83- {
84- if ( !CrateCollide::isValidToExecute (other) )
85- {
86- if (other != NULL )
87- DEBUG_LOG ((" StickyBombCrateCollide::isValidToExecute >>> target '%s' Not Valid." , other->getTemplate ()->getName ().str ()));
88- else
89- DEBUG_LOG ((" StickyBombCrateCollide::isValidToExecute >>> collide with ground!" ));
90- // Extend functionality.
91- return FALSE ;
92- }
93-
94- // Do we need anything here?
95- DEBUG_LOG ((" StickyBombCrateCollide::isValidToExecute >>> target '%s' Valid!" , other->getTemplate ()->getName ().str ()));
96- return TRUE ;
97- }
67+ // Bool StickyBombCrateCollide::isValidToExecute( const Object *other ) const
68+ // {
69+ // if( !CrateCollide::isValidToExecute(other) )
70+ // {
71+ // if (other != NULL)
72+ // DEBUG_LOG(("StickyBombCrateCollide::isValidToExecute >>> target '%s' Not Valid.", other->getTemplate()->getName().str()));
73+ // else
74+ // DEBUG_LOG(("StickyBombCrateCollide::isValidToExecute >>> collide with ground!"));
75+ // //Extend functionality.
76+ // return FALSE;
77+ // }
78+ //
79+ // // Do we need anything here?
80+ // DEBUG_LOG(("StickyBombCrateCollide::isValidToExecute >>> target '%s' Valid!", other->getTemplate()->getName().str()));
81+ // return TRUE;
82+ // }
9883
9984// -------------------------------------------------------------------------------------------------
10085// -------------------------------------------------------------------------------------------------
10186Bool StickyBombCrateCollide::executeCrateBehavior ( Object *other )
10287{
10388
104- DEBUG_LOG ((" StickyBombCrateCollide::executeCrateBehavior 0" ));
89+ // DEBUG_LOG(("StickyBombCrateCollide::executeCrateBehavior 0"));
10590 const StickyBombCrateCollideModuleData* md = getStickyBombCrateCollideModuleData ();
10691
10792 if (m_hasCollided && !md->m_allowMultiCollide )
@@ -131,6 +116,12 @@ Bool StickyBombCrateCollide::executeCrateBehavior( Object *other )
131116
132117 }
133118
119+ Real randomNumber = GameLogicRandomValueReal (0 , 1 );
120+ if (randomNumber > md->m_triggerChance ) {
121+ m_hasCollided = TRUE ;
122+ return false ;
123+ }
124+
134125 if (md->m_showInfiltrationEvent )
135126 TheRadar->tryInfiltrationEvent ( other );
136127
0 commit comments