Bridge Commander Central

BC Forums => BC Scripting => Topic started by: Bat66wat6 on July 24, 2013, 09:10:58 AM

Title: Reacting to FTech events?
Post by: Bat66wat6 on July 24, 2013, 09:10:58 AM
First and foremost. I am an idiot. To those with 10 years Python and BC API experience on me  :bow:
Apologies for the (no doubt) repost. Search of BC Scripting / Modding came up dry with: Creating a basic autoload script and Becoming A Scripter 101. Neither covered what i'm after.
- - - -
How would one go about defining a trigger for a FoundationTech event such as the Breen Damper?

I have a QBautostart script. I know that you can create triggers and react to those triggers within the same script thusly:
Code: [Select]
App.g_kEventManager.AddBroadcastPythonFuncHandler(App.ET_OBJECT_EXPLODING, pMission, __name__ + ".ObjectDestroyed")

def ObjectDestroyed(pObject, pEvent):
        pObject = App.ObjectClass_Cast(pEvent.GetDestination())
        pShip = App.ShipClass_Cast(pObject)
        print pShip.GetName(), " just blew up!"
        pObject.CallNextHandler(pEvent)

I believe I found the way FTech is defining its triggers ( \scripts\FoundationTech.py )
Code: [Select]
App.g_kEventManager.AddBroadcastPythonFuncHandler(self.eventKey, MissionLib.GetEpisode(), 'FoundationTriggers.' + self.name + str(self.eventKey))
The problem is the first argument ( self.eventkey ) because it is a variable dynamically created by FTech. In order to create a:
App.g_kEventManager.AddBroadcastPythonFuncHandler
I will need the value of self.eventkey for Breen Damper tech.

The purpose here is to have custom code triggered when a Damper Weapon enabled FTech torpedo impacts a target.
Code: [Select]
def ShipHitWithDamper(pObject, pEvent):
        pObject = App.ObjectClass_Cast(pEvent.GetDestination())
        pShip = App.ShipClass_Cast(pObject)
        print pShip.GetName(), " was just hit with a Breen Damper torpedo!"
        pObject.CallNextHandler(pEvent)
Title: Re: Reacting to FTech events?
Post by: Mario on July 24, 2013, 01:47:44 PM
The thing is that the following doesn't belong under BC API category. This mod was written by MLeo so I'd advise you to study the BreenDamper source code and see if it exposes any events for a start.

Many of us who wrote certain scripts exposed certain API elements for others to attach to. However I can't say that we all used some unified approach though.
Title: Re: Reacting to FTech events?
Post by: Nighthawk on July 24, 2013, 03:01:56 PM
IIRC there's a limited set of listeners predefined by FTech, and they're continuously scanning the game at every event being fired.
so if you fire a breen damper, a transphasic torpedo or hit a regenerative shield, it's the same module tracking all those events, which then gets directed to each particular action (cutting power, ignoring shields, or boosting shields, in these cases)

search the code for OnWeaponHit, OnFire, OnYield,... those are bound to be from FTech
Title: Re: Reacting to FTech events?
Post by: Bat66wat6 on July 24, 2013, 03:45:24 PM
DamperWeapon.py defines its own OnYield's as member functions of a class of BreenDrainerWeaponDef and _BreenDrainerWeaponDef.

Beyond this DamperWeapon.py does not mention triggers anywhere but it does import App, FoundationTech and MissionLib.

In FoundationTech.py it calls oYield.OnYield functions but oYield is set as:
Code: [Select]
oYield = dYields[sName]where dYields is defined as:
Code: [Select]
dYields = {} # Dictionary of weapon yields, placed here by projectile .py's for lookup
This is where the trail dead-ends for me. The only things FoundationTech import are:
Foundation               # 1000+ lines, no mention of "trigger"
FoundationTriggers     # empty
MissionLib                 # include BC API stuff
Registry                   # ?
string                     # irrelevant .pyc
Title: Re: Reacting to FTech events?
Post by: KrrKs on July 25, 2013, 06:46:08 AM
I hope i'm not totally wrong, but isn't the "WeaponHit" class in FoundationTech pretty much what you want to do?
Note the
Quote
oWeaponHit = WeaponHit('WeaponHit', App.ET_WEAPON_HIT, dMode)
at the end.
Title: Re: Reacting to FTech events?
Post by: Bat66wat6 on July 25, 2013, 08:38:42 AM
Perhaps that is what I am looking for ... ?
I do not understand how to use it though and naturally failed by implementing it as:
Code: [Select]
import App
import MissionLib
import Foundation
import string
import Lib.LibEngineering
from QuickBattle import Quickbattle

# handle Breen Damper FTech equipped weapons
def WeaponHit(pObject, pEvent):
pShip = App.ShipClass_Cast(pEvent.GetDestination())
weapType = ""
if pEvent.GetWeaponType() == pEvent.PHASER:
weapType = "Phaser"
elif pEvent.GetWeaponType() == pEvent.TRACTOR_BEAM:
weapType = "Tractor"
else:
pTorp = App.Torpedo_Cast(pEvent.GetSource())
if pTorp:
if pTorp.GetGuidanceLifeTime() > 0.0:
weapType = "Torpedo"
else:
weapType = "Pulse weapon"
print pShip.GetName(), "just got hit by a:", weapType
        pObject.CallNextHandler(pEvent)

def init():
App.g_kEventManager.AddBroadcastPythonFuncHandler(App.ET_WEAPON_HIT, pMission, __name__ + ".WeaponHit")

Quote
Error: was unable to load PrimSecShieldGenerators - SyntaxError: ('invalid token', ('.\\Scripts\\Custom\\QBautostart\\PrimSecShieldGenerators.py', 778, 54, '\011\011elif pEvent.GetWeaponType() == pEvent.TRACTOR_BEAM:\012'))
Traceback (innermost last):
  File ".\Scripts\Custom\Autoload\LoadEngineeringExtension.py", line 157, in ImportQBautostart
  File ".\Scripts\Custom\QBautostart\PrimSecShieldGenerators.py", line 778
     elif pEvent.GetWeaponType() == pEvent.TRACTOR_BEAM:
                                                        ^
 SyntaxError: invalid token

Please remember that I am an idiot. The experience gap between me and you is vast.

In addition to getting a handler for weapon impacts, there remains the larger question of determining if it is a Breen Damper FTech weapon.
Title: Re: Reacting to FTech events?
Post by: Mario on July 25, 2013, 02:33:34 PM
You could always try to load the script and see if it has damper tech.

Code: [Select]
pTorp = App.Torpedo_Cast(pEvent.GetSource())
if pTorp:
pModule = __import__(pTorp.GetModuleName())
if hasattr(pModule, "sYieldName"):
if pModule.sYieldName == "Damper Weapon":
print 'do my stuff'

Note that the following is not perfect because it assumes that the user who added the following tech used the default instructions.
Code: [Select]
sYieldName = 'Damper Weapon'
sFireName = None

try:
import FoundationTech
try:
oFire = FoundationTech.oTechs[sFireName]
FoundationTech.dOnFires[__name__] = oFire
except:
pass

try:
oYield = FoundationTech.oTechs[sYieldName]
FoundationTech.dYields[__name__] = oYield
except:
pass
except:
pass

If I register my tech in the following manner
Code: [Select]
try:
import FoundationTech
try:
oFire = FoundationTech.oTechs[None]
FoundationTech.dOnFires[__name__] = oFire
except:
pass

try:
oYield = FoundationTech.oTechs['Damper Weapon']
FoundationTech.dYields[__name__] = oYield
except:
pass
except:
pass

This approach won't work because my script is missing the sYieldName var.
Title: Re: Reacting to FTech events?
Post by: Bat66wat6 on July 25, 2013, 04:12:47 PM
Thanks Sovereign that worked like a charm, although I had to change the handler name to something other than 'WeaponHit' as it overriden the FTech 'WeaponHit' handler  :nono:

Code: [Select]
# handle Breen Damper FTech equiped weapons
def BreenDamperImpactHandler(pObject, pEvent):
pShip = App.ShipClass_Cast(pEvent.GetDestination())
pTorp = App.Torpedo_Cast(pEvent.GetSource())
if pTorp:
print pShip.GetName(), "just got hit by a torpedo"
pModule = __import__(pTorp.GetModuleName())
if hasattr(pModule, "sYieldName"):
if pModule.sYieldName == "Damper Weapon":
# my code for damper impact
elif hasattr(pModule, "oYield"):
if pModule.oYield == "Damper Weapon":  # < - - - - will not work, class instance
# my code for damper impact
        pObject.CallNextHandler(pEvent)

def init():
App.g_kEventManager.AddBroadcastPythonFuncHandler(App.ET_WEAPON_HIT, pMission, __name__ + ".BreenDamperImpactHandler")

As you can see I am extending the use of hasattr to find "oYield". Even though oYield is in a try block it works.
Only problem is that during runtime oYield is an instance of
ftb.Tech.DamperWeapon.BreenDrainerWeaponDef
and I do not know how to do class type comparisons.

I am also unsure as to the overhead of using __import__ and hasattr in a handler that could be called for every Damper equipped torpedo  :(

Of course it would be ideal for an actual FTech handler for FTech torpedos but I guess it is what it is.  :idk:
Title: Re: Reacting to FTech events?
Post by: KrrKs on July 25, 2013, 07:12:26 PM
Only problem is that during runtime oYield is an instance of
ftb.Tech.DamperWeapon.BreenDrainerWeaponDef
and I do not know how to do class type comparisons.

I am also unsure as to the overhead of using __import__ and hasattr in a handler that could be called for every Damper equipped torpedo  :(

Of course it would be ideal for an actual FTech handler for FTech torpedos but I guess it is what it is.  :idk:

AFAIK
Quote
type(<yourInstance>)
returns a class identifier (not just the name but something like
Quote
<class 'whatever'>
),
so you should be able to use that.

Concerning the import overhead: I think pretty much every script in BC imports the App and/or MissionLib; plus most custom ones Foundation and/or QBAutostart.
If there were any kind of (noticeable) slowdown due to the import statement, BC would be pretty much unplayable.
Title: Re: Reacting to FTech events?
Post by: Bat66wat6 on July 25, 2013, 09:03:44 PM
Krrks you were so close to giving me the straight shot answer for my == problem. Python is not my thing so it took over half an hour to find the answer to my type() == classname problem.
http://stackoverflow.com/questions/54867/old-style-and-new-style-classes-in-python/54873#54873 (http://stackoverflow.com/questions/54867/old-style-and-new-style-classes-in-python/54873#54873)
In the older version of Python used by BC type(instancevar) is always <type 'instance'>.
Only way to do comparison in older versions is: instancevar.__class__ == classname
 - - - - -

I got it working to an acceptable level but aren't sure of the quality or robustness of the implementation.
Code: [Select]
# handle Breen Damper FTech equipped weapons
def BreenDamperHandler(pObject, pEvent):
pShip = App.ShipClass_Cast(pEvent.GetDestination())
pTorp = App.Torpedo_Cast(pEvent.GetSource())
if pTorp:
pModule = __import__(pTorp.GetModuleName())
if hasattr(pModule, "sYieldName"):
if pModule.sYieldName == "Damper Weapon":
ReactToBreenDamperHit(pShip)
elif hasattr(pModule, "oYield"):
pDamperModule = __import__("ftb.Tech.DamperWeapon")
if pModule.oYield.__class__ == pDamperModule.BreenDrainerWeaponDef:
ReactToBreenDamperHit(pShip)
        pObject.CallNextHandler(pEvent)

def init():
App.g_kEventManager.AddBroadcastPythonFuncHandler(App.ET_WEAPON_HIT, pMission, __name__ + ".BreenDamperHandler")

Input on how I could improve the function is welcomed. If nobody has any more suggestions i'd like to leave my thanks here and give you all a round of cookies.

Title: Re: Reacting to FTech events?
Post by: Nighthawk on July 26, 2013, 12:11:45 AM
AFAIK, you don't have to check which torpedo type is hitting, because the damper torpedo already passes the "it's me" token when it's fired.

like I said, FTech is continuously checking for specific events while it's active, so try tracking the code until you find what you need.

if you look at the torpedo file,

Code: [Select]
##################################################################################
#
## Foundation Technologies, copyright 2004 by Daniel Rollings AKA Dasher42
#
# This string is used to set a yield type using Foundation Technology plugins.
# If you wish extra functionality, subclassing an existing plugin here is acceptable,
# but the easiest way to set a special yield is to set this string to the name of an
# existing technology.

sYieldName = 'Breen Drainer Weapon'

sFireName = None

##################################################
#
# Do not edit below.

import FoundationTech
import ftb.Tech.BreenDrainer

#oFire = FoundationTech.oTechs[sFireName]
oFire = ftb.Tech.BreenDrainer.oDrainerWeapon
FoundationTech.dOnFires[__name__] = oFire
oYield = FoundationTech.oTechs[sYieldName]

FoundationTech.dYields[__name__] = oYield

when the torpedo fires, it's gonna carry with it the info "hey, I'm a FTech weapon, and I'm a drainer torpedo. Activate the draining effect when I hit"

likewise, you can use the technology to give draining effects to any other weapon.
I suggest you check scripts/ftb/BreenDrainer.py to better understand how it works.
Title: Re: Reacting to FTech events?
Post by: hobbs on July 26, 2013, 05:30:59 AM
can i ask... what is it you wanted this trigger for? sorry if ive missed something but im even less of a scripter than you... but i cant see for looking what it is you want this script to do.
Title: Re: Reacting to FTech events?
Post by: Bat66wat6 on July 26, 2013, 08:06:14 AM
Sorry Nighthawk I don't fully understand.

What you are saying makes sense but it's hard to see how it changes the implementation because it already reads the torpedo script by importing it and then parsing it with hasattr. Are you saying I could just check the torpedo script for Damper Weapon values / class instances match ups? ... because that's what it's doing at the moment.

Code: [Select]
if pTorp:
pModule = __import__(pTorp.GetModuleName())
if hasattr(pModule, "sYieldName"):
if pModule.sYieldName == "Damper Weapon":
ReactToBreenDamperHit(pShip)
Is a torpedo. Import torpedo script as object and scan for sYieldName. sYieldName exists? Yep. sYieldName == "Damper Weapon".
Bingo!

Code: [Select]
elif hasattr(pModule, "oYield"):
pDamperModule = __import__("ftb.Tech.DamperWeapon")
if pModule.oYield.__class__ == pDamperModule.BreenDrainerWeaponDef:
ReactToBreenDamperHit(pShip)
oYield exists in script object? Yep. Import DamperWeapon script object. Compare oYield class type to BreenDrainerWeaponDef in DamperWeapon.py.

can i ask... what is it you wanted this trigger for? sorry if ive missed something but im even less of a scripter than you... but i cant see for looking what it is you want this script to do.
Worf: Fifty-two disruptor banks, twenty-seven photon torpedo bays, primary and secondary shields.
Nemesis as it should have been:
Title: Re: Reacting to FTech events?
Post by: Nighthawk on July 26, 2013, 08:48:38 AM
why do you need a drainer weapon to add shield effects?... just look at ShieldGenerators.py script from QBAutostart  :lostit:
Title: Re: Reacting to FTech events?
Post by: Bat66wat6 on July 26, 2013, 10:02:50 AM
why do you need a drainer weapon to add shield effects?... just look at ShieldGenerators.py script from QBAutostart  :lostit:
ShieldGenerators.py is a different implementation. It treats all generators as contributing to one massive strong shield.
My interpretation of having 2 generators is that they are seperate and interchangeable. Ergo: primary and secondary shields.
Graphical shield effects are irrelevant.

Code: [Select]
# handle Breen Damper FTech equipped weapons
def BreenDamperHandler(pObject, pEvent):
pShip = App.ShipClass_Cast(pEvent.GetDestination())
pTorp = App.Torpedo_Cast(pEvent.GetSource())
if pTorp:
pModule = __import__(pTorp.GetModuleName())
if hasattr(pModule, "sYieldName"):
if pModule.sYieldName == "Damper Weapon":
ReactToBreenDamperHit(pShip)
elif hasattr(pModule, "oYield"):
pDamperModule = __import__("ftb.Tech.DamperWeapon")
if pModule.oYield.__class__ == pDamperModule.BreenDrainerWeaponDef:
ReactToBreenDamperHit(pShip)
        pObject.CallNextHandler(pEvent)

def init():
App.g_kEventManager.AddBroadcastPythonFuncHandler(App.ET_WEAPON_HIT, pMission, __name__ + ".BreenDamperHandler")
Input on how I could improve the function is welcomed. If nobody has any more suggestions i'd like to leave my thanks here and give you all a round of cookies.
Title: Re: Reacting to FTech events?
Post by: Mario on July 26, 2013, 03:24:51 PM
AFAIK, you don't have to check which torpedo type is hitting, because the damper torpedo already passes the "it's me" token when it's fired.

like I said, FTech is continuously checking for specific events while it's active, so try tracking the code until you find what you need.

if you look at the torpedo file,

Code: [Select]
##################################################################################
#
## Foundation Technologies, copyright 2004 by Daniel Rollings AKA Dasher42
#
# This string is used to set a yield type using Foundation Technology plugins.
# If you wish extra functionality, subclassing an existing plugin here is acceptable,
# but the easiest way to set a special yield is to set this string to the name of an
# existing technology.

sYieldName = 'Breen Drainer Weapon'

sFireName = None

##################################################
#
# Do not edit below.

import FoundationTech
import ftb.Tech.BreenDrainer

#oFire = FoundationTech.oTechs[sFireName]
oFire = ftb.Tech.BreenDrainer.oDrainerWeapon
FoundationTech.dOnFires[__name__] = oFire
oYield = FoundationTech.oTechs[sYieldName]

FoundationTech.dYields[__name__] = oYield

when the torpedo fires, it's gonna carry with it the info "hey, I'm a FTech weapon, and I'm a drainer torpedo. Activate the draining effect when I hit"

likewise, you can use the technology to give draining effects to any other weapon.
I suggest you check scripts/ftb/BreenDrainer.py to better understand how it works.

FTech doesn't externally expose an event which he can listen for, so this won't work.
Title: Re: Reacting to FTech events?
Post by: Bat66wat6 on July 26, 2013, 03:45:52 PM
Sovereign has spoken  :dontcare:

Thanks for all your help. Would have taken me weeks to solve this  :thumbsup:

Cookies for all :)
Title: Re: Reacting to FTech events?
Post by: Nighthawk on July 27, 2013, 01:38:09 AM
FTech doesn't externally expose an event which he can listen for, so this won't work.

but he can write a script similar to the one actually used by FTech .... every script in ftb/tech handles the reaction to a given type of event, so he can just modify one activated by OnTorpDefense, and use the same code as BreenDrainer.py

what I mean was, that he has the framework doing that already... no need to write a check script to see if the thing being fired is a FTech weapon, when the very script is written for FTech.
Title: Re: Reacting to FTech events?
Post by: Bat66wat6 on July 27, 2013, 07:45:52 AM
but he can write a script similar to the one actually used by FTech .... every script in ftb/tech handles the reaction to a given type of event, so he can just modify one activated by OnTorpDefense, and use the same code as BreenDrainer.py

what I mean was, that he has the framework doing that already... no need to write a check script to see if the thing being fired is a FTech weapon, when the very script is written for FTech.

Will I not have to edit one of the Foundation files (\scripts\FoundationTech.py) ... or is this an addition I can add to my \scripts\custom\QBautostart.py ?

I will listen to what you have to say but I will need help. Code in FoundationTech.py looks like gibberish :\
Title: Re: Reacting to FTech events?
Post by: Nighthawk on July 27, 2013, 09:17:03 AM
read BreenDrainer.py

Code: [Select]
class BreenDrainerWeaponDef(MultipleDisableDef):

def IsDrainYield(self):
debug(__name__ + ", IsDrainYield")
return 1

def OnYield(self, pShip, pInstance, pEvent, pTorp):
debug(__name__ + ", OnYield")
if FoundationTech.EffectsLib:
FoundationTech.EffectsLib.CreateSpecialFXSeq(pShip, pEvent, 'Damper')

pShipID = pShip.GetObjID()
pShip = App.ShipClass_Cast(App.TGObject_GetTGObjectPtr(pShipID))

# useless against stations
if not pShip or pShip.GetShipProperty().IsStationary():
return

pPlayer = MissionLib.GetPlayer()
if pPlayer.GetObjID() == pShip.GetObjID():
pVoice = App.g_kSoundManager.GetSound("PowerDisabled")
if pVoice:
        pVoice.Play()

                        pSound = App.g_kSoundManager.GetSound("BreenDraining")
                        if not pSound:
                                pSound = App.TGSound_Create("sfx/BreenDraining.wav", "BreenDraining", 0)
                        if pSound:
                                pSound.Play()

if FoundationTech.BridgeFX:
FoundationTech.BridgeFX.CreateDrainEffect()
                       
                        # disable glow on ship
if not pShip.IsDead(): # possible crash work around
                        pShip.DisableGlowAlphaMaps()

                # clients shouldn't do anything here
                if App.g_kUtopiaModule.IsMultiplayer() and not App.g_kUtopiaModule.IsHost():
                        return

pPower = pShip.GetPowerSubsystem()
if pPower:
                        IonSubSystem(pPower)
                #pProp = pPower.GetProperty()
                #pProp.SetPowerOutput(0.0)
                        #pProp.SetMainConduitCapacity(0.000001)
                        #pProp.SetBackupConduitCapacity(0.000001)

pShields = pShip.GetShields()
if pShields:
                        IonSubSystem(pShields)

pCloak = pShip.GetCloakingSubsystem()
if pCloak:
                        IonSubSystem(pCloak)

                pImpulse = pShip.GetImpulseEngineSubsystem()
                if pImpulse:
                        IonSubSystem(pImpulse)

                pWarp = pShip.GetWarpEngineSubsystem()
                if pWarp:
                        IonSubSystem(pWarp)

        pWeaponSys = pShip.GetTorpedoSystem()
        if pWeaponSys:
        IonSubSystem(pWeaponSys)
        pWeaponSys = pShip.GetPhaserSystem()
        if pWeaponSys:
        IonSubSystem(pWeaponSys)
        pWeaponSys = pShip.GetPulseWeaponSystem()
        if pWeaponSys:
        IonSubSystem(pWeaponSys)

OnYield gets activated when FTech detects a BreenDrainer torpedo has hit something... FTech goes check WHAT actually hit WHAT, and if it's a torpedo, then it fires the OnTorpDefense function, which takes you to the OnYield function here.
... to sum things up: study these kind of scripts and you will learn how to create the reaction you need for a given input.

like I said, FTech is always checking specific events, yours included... you don't need to write another handler for an event that's already being watched by a larger framework... just add your effect to the queue of effects to be fired when the trigger goes off.
Title: Re: Reacting to FTech events?
Post by: Bat66wat6 on July 27, 2013, 09:49:18 AM
But this will require modification of Foundation scripts. Correct?

I really do want a FTech trigger that goes off for FTech events but i'm not going to modify Foundation its self to get one.

I'm not trying to be difficult or annoy you, I just won't mod other peoples mods to get mine to work. That's a big no no.
Title: Re: Reacting to FTech events?
Post by: Nighthawk on July 27, 2013, 02:08:58 PM
you can duplicate one of the scripts from scripts/ftb/tech to keep the structure, and then replace the content with whatever you need.
you don't have to modify anything related to Foundation itself.
Title: Re: Reacting to FTech events?
Post by: Mario on July 27, 2013, 05:36:27 PM
It's been really a long time since I turned on BC and read BCs scripts. I was generally giving pointers which were on the top of my head presuming that FTech did not expose any events which can be used.

Nighthawk now that you've posted the BreenDamper source code I see what you're aiming at and generally explained a bit better what you were trying to say it is much better and up to standards to do it this way. No offense but the points you were trying to make were not very clear to me.

To oversimplify Bat66wat6 what he's aiming at is that you create your own FTech plugin which will allow you to listen for FTech "events" which are triggered internally and give you everything you'd need for your own script. This is a much better solution and up to best practices provided you get all the information you need from FTech which by seeing the code I believe you will.
Title: Re: Reacting to FTech events?
Post by: Bat66wat6 on July 27, 2013, 08:34:36 PM
I will do my best to understand these 'FTech handlers' you speak of. Somehow I suspect i'm a loooooong way off the right way of doing things in BC haha  :(

Don't be surprised if I don't post back for a while, or post back saying i'm sticking with the current implementation.
 I am attempting to build something using a language I don't fully understand in an environment I don't understand.

 :newbie:
Title: Re: Reacting to FTech events?
Post by: Nighthawk on July 28, 2013, 02:54:25 PM
No offense but the points you were trying to make were not very clear to me.

I was trying to play along with what he was telling us until I realized it wasn't going anywhere... then I got back to the "Foundation" of it XD
FTech is built to detect multiple events, ET_WEAPON_HIT included.... that's a fact.
so, simply use FTech itself.

Title: Re: Reacting to FTech events?
Post by: Mario on July 28, 2013, 03:18:20 PM
FTech is listening to multiple events only to allow the framework to function as intended. If the framework could have functioned listening to only one event it would have been done so. Remember that too much redundant code makes the code itself harder to maintain.
Title: Re: Reacting to FTech events?
Post by: Bat66wat6 on July 29, 2013, 08:42:45 AM
I have decided not to pursue implementing a custom Foundation listener to trigger my code alongside its damper onYield code.
My current implementation, although not ideal as every weapon that hits anything will trigger it, 'just works' and it would not be worth the time it would take me to learn this Foundation implementation and adapt my code.

This is not to say I like half-arsed attempts at doing things, I'm just being realistic with the real world time being put into it and the outcome.

Again thanks for all your help.