do

# Brute51: This is part of the rebuild bonus callback script. If Destroy() isn't called here but OnDestroy() is that
# means that the engine removed a prop, most likely a wreckage used for a rebuild bonus.

local CBFP_oldProp = Prop
local Game = import('/lua/game.lua')
local RebuildBonusCheckCallback = import(Game.CBFP_Path..'/lua/sim/RebuildBonusCallback.lua').RunRebuildBonusCallback

Prop = Class(CBFP_oldProp, Entity) {

    Destroy = function(self)
        self.DestroyCalled = true
        CBFP_oldProp.Destroy(self)
    end,

    OnDestroy = function(self)
        if self.IsWreckage and not self.DestroyCalled then
            RebuildBonusCheckCallback(self:GetPosition(), self.AssociatedBP)
        end
        CBFP_oldProp.OnDestroy(self)
    end,
}


end