Statistics: Posted by Resin_Smoker — 01 May 2014, 02:09
Statistics: Posted by errorblankfield — 11 Apr 2014, 06:24
Statistics: Posted by errorblankfield — 09 Apr 2014, 05:39
Statistics: Posted by rockoe10 — 08 Apr 2014, 02:32
Statistics: Posted by Resin_Smoker — 03 Apr 2014, 20:09
Statistics: Posted by Resin_Smoker — 10 Mar 2014, 21:20
Statistics: Posted by Resin_Smoker — 06 Mar 2014, 23:09
Statistics: Posted by Krapougnak — 06 Mar 2014, 10:27
------------------------------------------------------------------------------------------
-- File : /mods/hover_bomber_fix/hook/lua/defaultunits.lua
-- Author(s): Resin_Smoker
-- Summary : Prevents bomber from firing if they're not moving at least cruising speed
-- Copyright © 2014 All rights reserved.
------------------------------------------------------------------------------------------
do
--> Triggers all logs to report if flag set true, otherwise use the local flags within each function for specific outputs
local masterDebug = true
------------------------------------------------------------------------------------------
-- Air Units
------------------------------------------------------------------------------------------
local oldAirUnit = AirUnit
AirUnit = Class( oldAirUnit ) {
OnStopBeingBuilt = function( self, builder, layer )
--> Run old OnStopBeingBuilt first
oldAirUnit.OnStopBeingBuilt( self, builder, layer )
--> Get units BP
local bp = self:GetBlueprint()
local myDebug = false
if myDebug and masterDebug then
LOG('*** hover_bomber_fix defaultunits.lua, OnStopBeingBuilt ***')
LOG(' Projectile ID: ', self:GetEntityId() )
LOG(' Game time is: ', GetGameTimeSeconds() )
LOG(' Name: ', bp.General.UnitName )
LOG('*************************************')
end
--> Ensure that unit is winged, has the category "Bomber" and is not the Mercy suicide missile
if bp.Air.Winged and EntityCategoryContains(categories.BOMBER, self) and bp.General.UnitName != '<LOC daa0206_name>Mercy' then
if myDebug and masterDebug then
LOG(' Airunit is a BOMBER')
LOG(' ')
end
--> Setup global flags
self.IsBomber = true
self.MyWepEnabled = true
else
if myDebug and masterDebug then
LOG(' Airunit is NOT a bomber')
LOG(' ')
end
end
end,
OnMotionHorzEventChange = function(self, new, old)
local myDebug = true
--> Run old OnMotionHorzEventChange first
oldAirUnit.OnMotionHorzEventChange(self, new, old)
--> Does unit still exist
if self and not self:IsDead() then
--> Is unit a bomber, is motion type different from last one reported
if self.IsBomber and new != old then
--> Did our bomber start moving again and are the weapons disabled
if ( new == 'Cruise' or new == 'TopSpeed' ) and ( old == 'Stopping' or old == 'Stopped' ) and not self.MyWepEnabled and not self.WeaponReactivationFork then
--> Kick off delay fork
self.WeaponReactivationFork = ForkThread(self.WeaponReactivationDelay, self, new, old)
--> Did our bomber stop moving again and are the weapons enabled
elseif ( old == 'Cruise' or old == 'TopSpeed' ) and ( new == 'Stopping' or new == 'Stopped' ) and self.MyWepEnabled then
--> Kill fork if active
if self.WeaponReactivationFork then
if myDebug and masterDebug then
LOG(' Killing WeaponReactivationFork')
end
KillThread(self.WeaponReactivationFork)
--> Clear off the global so the event can be used again
self.WeaponReactivationFork = nil
end
--> Set flag to false
self.MyWepEnabled = false
--> Loop though all weapons
for i = 1, self:GetWeaponCount() do
local wep = self:GetWeapon(i)
local wepBP = wep:GetBlueprint()
--> Only disable if weapon is not anti-air
if wepBP.WeaponCategory != 'Anti Air' and wepBP.RangeCategory != 'UWRC_AntiAir' then
wep:SetEnabled(false)
if myDebug and masterDebug then
LOG(' Bomber is at: ', new, ' from:', old,' DISABLING weapons')
end
end
end
end
end
end
end,
WeaponReactivationDelay = function( self, new, old )
local myDebug = true
if myDebug and masterDebug then
LOG('WeaponReactivationDelay')
end
--> Time delay in "ticks" before weapons are set active again. 10 ticks = 1 second. Please do not use setting lower than 5 ticks to help keep the game sync'd during multiplayer
--> Remember the default ping for all players is at least 500ms or 0.5 seconds or 5 ticks.
WaitTicks(10)
if myDebug and masterDebug then
LOG(' Delay complete...')
end
--> Does unit still exist
if self and not self:IsDead() then
--> Set flag to true
self.MyWepEnabled = true
--> Loop though all weapons
for i = 1, self:GetWeaponCount() do
local wep = self:GetWeapon(i)
local wepBP = wep:GetBlueprint()
--> Only enable if weapon is not anti-air
if wepBP.WeaponCategory != 'Anti Air' and wepBP.RangeCategory != 'UWRC_AntiAir' then
wep:SetEnabled(true)
if myDebug and masterDebug then
LOG(' Bomber is at: ', new, ' from:', old,' ENABLING weapons')
end
end
end
end
end,
}
end
Statistics: Posted by Resin_Smoker — 06 Mar 2014, 06:34
Statistics: Posted by Resin_Smoker — 02 Mar 2014, 01:33
Statistics: Posted by Lame — 02 Mar 2014, 01:10
------------------------------------------------------------------------------------------
-- File : /mods/hover_bomber_fix/hook/lua/defaultunits.lua
-- Author(s): Resin_Smoker
-- Summary : Prevents bomber from firing if they're not moving at least cruising speed
-- Copyright © 2014 All rights reserved.
------------------------------------------------------------------------------------------
do
--> Triggers all logs to report if flag set true, otherwise use the local flags within each function for specific outputs
local masterDebug = false
------------------------------------------------------------------------------------------
-- Air Units
------------------------------------------------------------------------------------------
local oldAirUnit = AirUnit
AirUnit = Class( oldAirUnit ) {
OnStopBeingBuilt = function( self, builder, layer )
--> Run old OnStopBeingBuilt first
oldAirUnit.OnStopBeingBuilt( self, builder, layer )
--> Get units BP
local bp = self:GetBlueprint()
local myDebug = false
if myDebug or masterDebug then
LOG('*** hover_bomber_fix defaultunits.lua, OnStopBeingBuilt ***')
LOG(' Projectile ID: ', self:GetEntityId() )
LOG(' Game time is: ', GetGameTimeSeconds() )
LOG(' Name: ', bp.General.UnitName )
LOG('*************************************')
end
--> Ensure that unit is winged, has the category "Bomber" and is not the Mercy suicide missile
if bp.Air.Winged and EntityCategoryContains(categories.BOMBER, self) and bp.General.UnitName != '<LOC daa0206_name>Mercy' then
if myDebug or masterDebug then
LOG(' Airunit is a BOMBER')
LOG(' ')
end
--> Setup global flags
self.IsBomber = true
self.MyWepEnabled = true
else
if myDebug or masterDebug then
LOG(' Airunit is NOT a bomber')
LOG(' ')
end
end
end,
OnMotionHorzEventChange = function(self, new, old)
local myDebug = true
--> Run old OnMotionHorzEventChange first
oldAirUnit.OnMotionHorzEventChange(self, new, old)
--> Does unit still exist
if self and not self:IsDead() then
--> Is unit a bomber, is motion type different from last one reported
if self.IsBomber and new != old then
--> Did our bomber start moving again and are the weapons disabled
if ( new == 'Cruise' or new == 'TopSpeed' ) and ( old == 'Stopping' or old == 'Stopped' ) and not self.MyWepEnabled then
--> Set flag to true
self.MyWepEnabled = true
--> Loop though all weapons
for i = 1, self:GetWeaponCount() do
local wep = self:GetWeapon(i)
local wepBP = wep:GetBlueprint()
--> Only enable if weapon is not anti-air
if wepBP.WeaponCategory != 'Anti Air' and wepBP.RangeCategory != 'UWRC_AntiAir' then
wep:SetEnabled(true)
if myDebug or masterDebug then
LOG(' Bomber is at: ', new, ' from:', old,' ENABLING weapons')
end
end
end
--> Did our bomber stop moving again and are the weapons enabled
elseif ( old == 'Cruise' or old == 'TopSpeed' ) and ( new == 'Stopping' or new == 'Stopped' ) and self.MyWepEnabled then
--> Set flag to false
self.MyWepEnabled = false
--> Loop though all weapons
for i = 1, self:GetWeaponCount() do
local wep = self:GetWeapon(i)
local wepBP = wep:GetBlueprint()
--> Only disable if weapon is not anti-air
if wepBP.WeaponCategory != 'Anti Air' and wepBP.RangeCategory != 'UWRC_AntiAir' then
wep:SetEnabled(false)
if myDebug or masterDebug then
LOG(' Bomber is at: ', new, ' from:', old,' DISABLING weapons')
end
end
end
end
end
end
end,
}
end
Statistics: Posted by Resin_Smoker — 01 Mar 2014, 22:48
------------------------------------------------------------------------------------------
-- File : /mods/hover_bomber_fix/hook/lua/defaultunits.lua
-- Author(s): Resin_Smoker
-- Summary : Prevents bomber from firing if they're not moving at least cruising speed
-- Copyright © 2014 All rights reserved.
------------------------------------------------------------------------------------------
do
--> Triggers all logs to report if flag set true, otherwise use the local flags within each function for specific outputs
local masterDebug = false
------------------------------------------------------------------------------------------
-- Air Units
------------------------------------------------------------------------------------------
local oldAirUnit = AirUnit
AirUnit = Class( oldAirUnit ) {
OnStopBeingBuilt = function( self, builder, layer )
local myDebug = false
if myDebug or masterDebug then
LOG('*** hover_bomber_fix defaultunits.lua, OnStopBeingBuilt ***')
LOG(' Projectile ID: ', self:GetEntityId() )
LOG(' Game time is: ', GetGameTimeSeconds() )
LOG('*************************************')
end
oldAirUnit.OnStopBeingBuilt( self, builder, layer )
local bp = self:GetBlueprint()
if bp.Air.Winged and EntityCategoryContains(categories.BOMBER, self) then
if myDebug or masterDebug then
LOG(' Airunit is bomber')
end
self.IsBomber = true
self.MyWepEnabled = true
else
if myDebug or masterDebug then
LOG(' Airunit is NOT a bomber')
end
self.IsBomber = false
end
end,
OnMotionHorzEventChange = function(self, new, old)
local myDebug = true
oldAirUnit.OnMotionHorzEventChange(self, new, old)
if self and not self:IsDead() then
if self.IsBomber and new != old and not self.WeapWaitState then
if ( new == 'Cruise' or new == 'TopSpeed' ) and ( old == 'Stopping' or old == 'Stopped' ) and not self.MyWepEnabled then
self.MyWepEnabled = true
for i = 1, self:GetWeaponCount() do
self:GetWeapon(i):SetEnabled(true)
end
if myDebug or masterDebug then
LOG(' Bomber is at: ', new, ' from:', old,' ENABLING weapons')
end
elseif ( old == 'Cruise' or old == 'TopSpeed' ) and ( new == 'Stopping' or new == 'Stopped' ) and self.MyWepEnabled then
self.MyWepEnabled = false
for i = 1, self:GetWeaponCount() do
self:GetWeapon(i):SetEnabled(false)
end
if myDebug or masterDebug then
LOG(' Bomber is at: ', new, ' from:', old,' DISABLING weapons')
end
end
end
end
end,
}
end
Statistics: Posted by Resin_Smoker — 01 Mar 2014, 07:47
Statistics: Posted by Resin_Smoker — 26 Feb 2014, 19:56