Jump to content
Korean Random
Sign in to follow this  
ahwa

The changed API

Recommended Posts

from gui.WindowsManager import g_windowsManager

from AvatarInputHandler.control_modes import _FlashGunMarker

 

Will these changes to the API

 

ImportError: No module named?

Share this post


Link to post

Short link
Share on other sites

I only have to find one

from AvatarInputHandler.control_modes import _FlashGunMarker   change 

 

---------------------------------------------------------------------------------------

from AvatarInputHandler import gun_marker_ctrl

_MARKER_TYPE = aih_constants.GUN_MARKER_TYPE
_MARKER_FLAG = aih_constants.GUN_MARKER_FLAG
_SHOT_RESULT = aih_constants.SHOT_RESULT

 

 

def New_getShotResult(hitPoint, collision, excludeTeam = 0):
    Old_getShotResult(hitPoint, collision, excludeTeam = 0)

    if collision is None:
        return _SHOT_RESULT.UNDEFINED
    else:
        entity = collision.entity
        if entity.health <= 0 or entity.publicInfo['team'] == excludeTeam:
            return _SHOT_RESULT.UNDEFINED
        player = BigWorld.player()
        if player is None:
            return _SHOT_RESULT.UNDEFINED

        vDesc = player.getVehicleDescriptor()
        ppDesc = vDesc.shot['piercingPower']
        maxDist = vDesc.shot['maxDistance']
        dist = (hitPoint - player.getOwnVehiclePosition()).length
        if dist <= 100.0:
            piercingPower = ppDesc[0]
        elif maxDist > dist:
            p100, p500 = ppDesc
            piercingPower = p100 + (p500 - p100) * (dist - 100.0) / 400.0
            if piercingPower < 0.0:
                piercingPower = 0.0
        else:
            piercingPower = 0.0
        piercingPercent = 1000.0
        if piercingPower > 0.0:
            armor = collision.armor
            piercingPercent = 100.0 + (armor - piercingPower) / piercingPower * 100.0
        if piercingPercent >= 150:
            result = _SHOT_RESULT.NOT_PIERCED
            type = 'not_pierced'
        elif 90 < piercingPercent < 150:
            result = _SHOT_RESULT.LITTLE_PIERCED
            type = 'little_pierced'
        else:
            result = _SHOT_RESULT.GREAT_PIERCED
            type = 'great_pierced'
        AimData['__Type__'] = type
        return result

 

 

Old_getShotResult = gun_marker_ctrl.getShotResult

gun_marker_ctrl.getShotResult = New_getShotResult

--------------------------------------------------------------------------------------

No method found

 

from gui.WindowsManager import g_windowsManager

g_windowsManager.onInitBattleGUI += OnInitBattleGUI
g_windowsManager.onDestroyBattleGUI += OnDestroyBattleGUI

Share this post


Link to post

Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...