Skip to content

Commit

Permalink
[fixed] DWB bomb droid detonation bug
Browse files Browse the repository at this point in the history
Change-Id: Ib21a907a36351d6028b65cca29a99d1717ecc030
  • Loading branch information
Miztah committed Sep 29, 2018
1 parent 5f3836b commit 50db318
Showing 1 changed file with 7 additions and 6 deletions.
Expand Up @@ -523,7 +523,6 @@ end
function DeathWatchBunkerScreenPlay:setBombDroidTemplate(pDroid)
AiAgent(pDroid):setAiTemplate("idlewait") -- Don't move unless patrol point is added to list
AiAgent(pDroid):setFollowState(4) -- Patrolling
createObserver(OBJECTDESTRUCTION, "DeathWatchBunkerScreenPlay", "bombDroidDetonated", spawnedPointer)
end

function DeathWatchBunkerScreenPlay:setLootBoxPermissions(pContainer)
Expand All @@ -536,7 +535,7 @@ function DeathWatchBunkerScreenPlay:onEnterDWB(sceneObject, pCreature)
if (not SceneObject(pCreature):isPlayerCreature()) then
return 0
end

createObserver(SPATIALCHATSENT, "DeathWatchBunkerScreenPlay", "notifyTerminalChatSent", pCreature)

self:lockAll(pCreature)
Expand All @@ -552,7 +551,7 @@ function DeathWatchBunkerScreenPlay:onExitDWB(sceneObject, pCreature, long)
if long == self.buildingIds.outside or long == 0 then
self:lockAll(pCreature)
end

dropObserver(SPATIALCHATSENT, "DeathWatchBunkerScreenPlay", "notifyTerminalChatSent", pCreature)

return 0
Expand Down Expand Up @@ -790,6 +789,7 @@ function DeathWatchBunkerScreenPlay:doBombDroidAction(pBombDroid)
if (spatialCommand == "detonate") then
CreatureObject(pBombDroid):playEffect("clienteffect/combat_grenade_proton.cef", "")
CreatureObject(pBombDroid):inflictDamage(pBombDroid, 0, 1000000, 1)
self:bombDroidDetonated(pBombDroid)
writeData("dwb:lastDroidDetonate", os.time())
return
end
Expand Down Expand Up @@ -916,7 +916,7 @@ function DeathWatchBunkerScreenPlay:notifyEnteredOutsideLockedDoorArea(pArea, pP
return 0
end

function DeathWatchBunkerScreenPlay:bombDroidDetonated(pBombDroid, pBombDroid2)
function DeathWatchBunkerScreenPlay:bombDroidDetonated(pBombDroid)
if (pBombDroid == nil) then
return 1
end
Expand All @@ -933,12 +933,13 @@ function DeathWatchBunkerScreenPlay:bombDroidDetonated(pBombDroid, pBombDroid2)

if (pDebris ~= nil and SceneObject(pBombDroid):isInRangeWithObject(pDebris, 5)) then
SceneObject(pDebris):playEffect("clienteffect/combat_grenade_proton.cef", "")
createEvent(1000, "DeathWatchBunkerScreenPlay", "destroyDebris", pDebris, "")
createEvent(500, "DeathWatchBunkerScreenPlay", "destroyDebris", pDebris, "")
elseif (pDebris2 ~= nil and SceneObject(pBombDroid):isInRangeWithObject(pDebris2, 5)) then
SceneObject(pDebris2):playEffect("clienteffect/combat_grenade_proton.cef", "")
createEvent(1000, "DeathWatchBunkerScreenPlay", "destroyDebris", pDebris2, "")
createEvent(500, "DeathWatchBunkerScreenPlay", "destroyDebris", pDebris2, "")
end

createEvent(2000, "DeathWatchBunkerScreenPlay", "despawnCreature", pBombDroid, "")
deleteData("dwb:bombDroid")

return 1
Expand Down

0 comments on commit 50db318

Please sign in to comment.