def canActivateOrDeactivateModule(module, targetID=None):
    import uix
    from common.eve.state import isItemInsideForceField
    
    moduleInfo = module.sr.moduleInfo
    
    ballpark = eve.LocalSvc("michelle").GetBallpark()
    if not ballpark:
        return (False, "No ballpark")
        
    playerBall = ballpark.GetBall(eve.session.shipid)
    
    if not playerBall:
        return (False, "Player ball nonpresent")
    elif isBallCloaked(playerBall):
        return (False, "Player is cloaked")
    elif isPlayerJumping():
        return (False, "Player is jumping")
    elif isItemInsideForceField(eve.session.shipid):
        return (False, "Player is inside a force field")
    
    if targetID:
        targetBall = ballpark.GetBall(targetID)
        if not targetBall:
            return (False, "Target ball not in ballpark")            
        elif isBallWarping(targetBall):
            return (False, "Target is warping")            
        elif isItemInsideForceField(targetBall.id):
            return (False, "Target is inside a force field")
    else:
        targetBall = None
    
    def_effect = getattr(module, "def_effect", None)
    if not def_effect:
        return (False, "passive module")
    
    if bool(getattr(module, "goingOnline", False)):
        return (False, "module going online")
    
    if bool(getattr(module, "effect_activating", False)):
        return (False, "module activating")
    
    onlineEffect = moduleInfo.effects.get("online", None)
    if onlineEffect and not onlineEffect.isActive:
        return (False, "module offline")
        
    if bool(getattr(module, "changingAmmo", False)):
        return (False, "module changing ammo")
        
    if bool(getattr(module, "reloadingAmmo", False)):
        return (False, "module reloading ammo")
        
    if getattr(module, "blockClick", 0) != 0:
        return (False, "module clicks blocked")
    
    if module.state == uix.UI_DISABLED:
        return (False, "button disabled")
    
    return None
def canActivateOrDeactivateModule(module, targetID=None):
    import uix
    from common.eve.state import isItemInsideForceField

    moduleInfo = module.sr.moduleInfo

    ballpark = eve.LocalSvc("michelle").GetBallpark()
    if not ballpark:
        return (False, "No ballpark")

    playerBall = ballpark.GetBall(eve.session.shipid)

    if not playerBall:
        return (False, "Player ball nonpresent")
    elif isBallCloaked(playerBall):
        return (False, "Player is cloaked")
    elif isPlayerJumping():
        return (False, "Player is jumping")
    elif isItemInsideForceField(eve.session.shipid):
        return (False, "Player is inside a force field")

    if targetID:
        targetBall = ballpark.GetBall(targetID)
        if not targetBall:
            return (False, "Target ball not in ballpark")
        elif isBallWarping(targetBall):
            return (False, "Target is warping")
        elif isItemInsideForceField(targetBall.id):
            return (False, "Target is inside a force field")
    else:
        targetBall = None

    def_effect = getattr(module, "def_effect", None)
    if not def_effect:
        return (False, "passive module")

    if bool(getattr(module, "goingOnline", False)):
        return (False, "module going online")

    if bool(getattr(module, "effect_activating", False)):
        return (False, "module activating")

    onlineEffect = moduleInfo.effects.get("online", None)
    if onlineEffect and not onlineEffect.isActive:
        return (False, "module offline")

    if bool(getattr(module, "changingAmmo", False)):
        return (False, "module changing ammo")

    if bool(getattr(module, "reloadingAmmo", False)):
        return (False, "module reloading ammo")

    if getattr(module, "blockClick", 0) != 0:
        return (False, "module clicks blocked")

    if module.state == uix.UI_DISABLED:
        return (False, "button disabled")

    return None
예제 #3
0
def isBallTargetable(ball):
    from common.eve.state import isItemInsideForceField
    if ball is None:
        return False
    elif isBallWarping(ball):
        return False
    elif isItemInsideForceField(ball.id):
        return False
    else:
        return True
def isBallTargetable(ball):        
    from common.eve.state import isItemInsideForceField
    if ball is None:
        return False
    elif isBallWarping(ball):
        return False
    elif isItemInsideForceField(ball.id):
        return False
    else:
        return True