From 453f8c05a4fc2ef03ba1d4f7bac43ba871c52fbd Mon Sep 17 00:00:00 2001
From: Nikolay Korolev <nickvnuk@gmail.com>
Date: Sun, 29 Aug 2021 19:32:22 +0300
Subject: script revision p1

---
 src/vehicles/Bike.cpp | 34 +++++++++++++++++++++++++++++++---
 1 file changed, 31 insertions(+), 3 deletions(-)

(limited to 'src/vehicles/Bike.cpp')

diff --git a/src/vehicles/Bike.cpp b/src/vehicles/Bike.cpp
index 60530fff..d8ad71ea 100644
--- a/src/vehicles/Bike.cpp
+++ b/src/vehicles/Bike.cpp
@@ -37,6 +37,7 @@
 #include "Bike.h"
 #include "Debug.h"
 #include "SaveBuf.h"
+#include "Garages.h"
 
 const uint32 CBike::nSaveStructSize =
 #ifdef COMPATIBLE_SAVES
@@ -232,7 +233,19 @@ CBike::ProcessControl(void)
 
 	ProcessCarAlarm();
 
-	ActivateBombWhenEntered();
+	if (pDriver) {
+		if (!bDriverLastFrame && m_bombType == CARBOMB_ONIGNITIONACTIVE) {
+			// If someone enters the car and there is a bomb, detonate
+			m_nBombTimer = 1000;
+			m_pBlowUpEntity = m_pBombRigger;
+			if (m_pBlowUpEntity)
+				m_pBlowUpEntity->RegisterReference((CEntity**)&m_pBlowUpEntity);
+			DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TICK, 1.0f);
+		}
+		bDriverLastFrame = true;
+	}
+	else
+		bDriverLastFrame = false;
 
 	CRubbish::StirUp(this);
 
@@ -300,8 +313,23 @@ CBike::ProcessControl(void)
 				ApplyMoveForce(parallelSpeed * -CTimer::GetTimeStep()*SAND_SLOWDOWN*m_fMass);
 			}
 		}
-		if(CPad::GetPad(0)->WeaponJustDown())
-			ActivateBomb();
+
+#ifdef BOMBS_ON_BIKES
+		if(CPad::GetPad(0)->WeaponJustDown()) {
+			if (m_bombType == CARBOMB_TIMED) {
+				m_bombType = CARBOMB_TIMEDACTIVE;
+				m_nBombTimer = 7000;
+				m_pBlowUpEntity = FindPlayerPed();
+				CGarages::TriggerMessage("GA_12", -1, 3000, -1);
+				DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TIMED_ACTIVATED, 1.0f);
+			}
+			else if (m_bombType == CARBOMB_ONIGNITION) {
+				m_bombType = CARBOMB_ONIGNITIONACTIVE;
+				CGarages::TriggerMessage("GA_12", -1, 3000, -1);
+				DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_ONIGNITION_ACTIVATED, 1.0f);
+			}
+		}
+#endif
 		break;
 
 	case STATUS_PLAYER_PLAYBACKFROMBUFFER:
-- 
cgit v1.2.3