Merge pull request #50 from SenjuZoro/patch-6

Tag Animation code block
This commit is contained in:
Ayush Saini 2022-06-30 01:03:31 +05:30 committed by GitHub
commit 236df55e1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,8 @@
from playersData import pdata from playersData import pdata
import ba, setting import ba, setting
from stats import mystats
sett = setting.get_settings_data()
def addtag(node,player): def addtag(node,player):
session_player=player.sessionplayer session_player=player.sessionplayer
account_id=session_player.get_v1_account_id() account_id=session_player.get_v1_account_id()
@ -22,7 +24,7 @@ def addtag(node,player):
if tag: if tag:
Tag(node,tag,col) Tag(node,tag,col)
from stats import mystats
def addrank(node,player): def addrank(node,player):
session_player=player.sessionplayer session_player=player.sessionplayer
account_id=session_player.get_v1_account_id() account_id=session_player.get_v1_account_id()
@ -33,7 +35,6 @@ def addrank(node,player):
def addhp(node): def addhp(node):
hp = node.hitpoints hp = node.hitpoints
_set = setting.get_settings_data()
def showHP(): def showHP():
HitPoint(owner=node,prefix=str(int(hp)),position=(0,0.75,0),shad = 1.4) HitPoint(owner=node,prefix=str(int(hp)),position=(0,0.75,0),shad = 1.4)
if hp: t = ba.Timer(100,ba.Call(showHP),repeat = True, timetype=ba.TimeType.SIM, timeformat=ba.TimeFormat.MILLISECONDS) if hp: t = ba.Timer(100,ba.Call(showHP),repeat = True, timetype=ba.TimeType.SIM, timeformat=ba.TimeFormat.MILLISECONDS)
@ -41,6 +42,7 @@ def addhp(node):
class Tag(object): class Tag(object):
def __init__(self,owner=None,tag="somthing",col=(1,1,1)): def __init__(self,owner=None,tag="somthing",col=(1,1,1)):
self.node=owner self.node=owner
mnode = ba.newnode('math', mnode = ba.newnode('math',
owner=self.node, owner=self.node,
attrs={ attrs={
@ -79,7 +81,16 @@ class Tag(object):
'h_align': 'center' 'h_align': 'center'
}) })
mnode.connectattr('output', self.tag_text, 'position') mnode.connectattr('output', self.tag_text, 'position')
if sett["enableTagAnimation"]:
ba.animate_array(node=self.tag_text, attr='color', size=3, keys={
0.2: (2,0,2),
0.4: (2,2,0),
0.6: (0,2,2),
0.8: (2,0,2),
1.0: (1,1,0),
1.2: (0,1,1),
1.4: (1,0,1)
}, loop=True)
class Rank(object): class Rank(object):
def __init__(self,owner=None,rank=99): def __init__(self,owner=None,rank=99):
self.node=owner self.node=owner
@ -105,8 +116,7 @@ class Rank(object):
class HitPoint(object): class HitPoint(object):
def __init__(self,position = (0,1.5,0),owner = None,prefix = 'ADMIN',shad = 1.2): def __init__(self,position = (0,1.5,0),owner = None,prefix = 'ADMIN',shad = 1.2):
_set = setting.get_settings_data() if not sett['enablehptag']: return
if not _set['enablehptag']: return
self.position = position self.position = position
self.owner = owner self.owner = owner
m = ba.newnode('math', owner=self.owner, attrs={'input1': self.position, 'operation': 'add'}) m = ba.newnode('math', owner=self.owner, attrs={'input1': self.position, 'operation': 'add'})