Skip to content

Commit c8814ac

Browse files
committed
Working fix for v1.7.0.0
Temporary fix for #6 - seems to work again, but I need to see what is really going on and fix properly..
1 parent 102542d commit c8814ac

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

BulkFill.lua

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,76 @@ BulkFill.INACTIVE_CB = { 1.0, 0.9, 0.0, 0.9 }
2020
BulkFill.UNSUPPORTED_CB = { 1.0, 0.5, 0.5, 0.9 }
2121
BulkFill.UNSELECTED_CB = { 1.0, 1.0, 1.0, 0.3 }
2222

23+
24+
-- FillUnit.onDelete = Utils.overwrittenFunction(FillUnit.onDelete,
25+
-- function(self, superFunc)
26+
-- local spec = self.spec_fillUnit
27+
-- if spec.fillTrigger ~= nil then
28+
-- g_currentMission.activatableObjectsSystem:removeActivatable(spec.fillTrigger.activatable)
29+
-- for _, trigger in pairs(spec.fillTrigger.triggers) do
30+
-- trigger:onVehicleDeleted(self)
31+
-- end
32+
-- spec.fillTrigger.currentTrigger = nil
33+
-- spec.fillTrigger.selectedTrigger = nil
34+
-- end
35+
-- if spec.fillUnits ~= nil then
36+
-- for _, fillUnit in ipairs(spec.fillUnits) do
37+
-- for _, alarmTrigger in ipairs(fillUnit.alarmTriggers) do
38+
-- g_soundManager:deleteSample(alarmTrigger.sample)
39+
-- end
40+
-- g_effectManager:deleteEffects(fillUnit.fillEffects)
41+
-- g_animationManager:deleteAnimations(fillUnit.animationNodes)
42+
-- if fillUnit.exactFillRootNode ~= nil then
43+
-- g_currentMission:removeNodeObject(fillUnit.exactFillRootNode)
44+
-- end
45+
-- end
46+
-- end
47+
-- g_effectManager:deleteEffects(spec.fillEffects)
48+
-- g_animationManager:deleteAnimations(spec.animationNodes)
49+
-- if spec.samples ~= nil then
50+
-- g_soundManager:deleteSamples(spec.samples)
51+
-- table.clear(spec.samples)
52+
-- end
53+
-- end
54+
-- )
55+
56+
FillUnit.setFillUnitIsFilling = Utils.overwrittenFunction(FillUnit.setFillUnitIsFilling,
57+
function(self, superFunc, isFilling, noEventSend)
58+
59+
local spec = self.spec_fillUnit
60+
if isFilling ~= spec.fillTrigger.isFilling then
61+
if noEventSend == nil or noEventSend == false then
62+
if g_server == nil then
63+
g_client:getServerConnection():sendEvent(SetFillUnitIsFillingEvent.new(self, isFilling))
64+
else
65+
g_server:broadcastEvent(SetFillUnitIsFillingEvent.new(self, isFilling), nil, nil, self)
66+
end
67+
end
68+
spec.fillTrigger.isFilling = isFilling
69+
if isFilling then
70+
spec.fillTrigger.currentTrigger = nil
71+
for _, trigger in ipairs(spec.fillTrigger.triggers) do
72+
if trigger:getIsActivatable(self) then
73+
spec.fillTrigger.currentTrigger = trigger
74+
trigger:setFillSoundIsPlaying(isFilling)
75+
break
76+
end
77+
end
78+
elseif spec.fillTrigger.currentTrigger ~= nil then
79+
spec.fillTrigger.currentTrigger:setFillSoundIsPlaying(isFilling)
80+
--spec.fillTrigger.currentTrigger = nil
81+
end
82+
if self.isClient then
83+
self:setFillSoundIsPlaying(isFilling)
84+
end
85+
SpecializationUtil.raiseEvent(self, "onFillUnitIsFillingStateChanged", isFilling)
86+
if not isFilling then
87+
self:updateFillUnitTriggers()
88+
end
89+
end
90+
end
91+
)
92+
2393
function BulkFill.prerequisitesPresent(specializations)
2494
return SpecializationUtil.hasSpecialization(FillUnit, specializations) and
2595
SpecializationUtil.hasSpecialization(FillVolume, specializations)

0 commit comments

Comments
 (0)