SoprachevAK 64 Posted May 5, 2020 (edited) Я шарю в программирование, но для танков пишу что от впервые. Движок декомпилировал, что то общее поизучал. Возникает риторический вопрос, если у нас есть сигнатуры всех функций, то почему нет никакого фан Scripting API, где каждый мог бы добавить своё описание? Как правильно сделать создание 3д модельки танка? Пока что рабочая идея tutorial.control.battle.functional.StaticObjectMarker3D({'path': r'vehicles/russian/R56_T-127/normal/lod4/Hull.model'}, (0, 0, 0)) Однако части танка (корпус башня пушка) это разные модельки, так ещё и не во всех лодах они есть. То есть корпус может быть в 0, 2 и 4 лоде, а у другого танка только в 3. И перебирать не очень круто. Ещё проблема в том, что pivot у башни и корпуса в разных точках, то есть нельзя просто так взять и заспавнить все чатси танка в одной координате. Ещё нашел scripts/client/vehicle_systems/model_assembler.py, но пока что не смог его применить никак. У такого способа создание модельки можно задать position и yaw, но как же наклоны в других плоскостях, или же можно как то прилепить модельку к террейну (пока что пытаюсь создать просто в своих координатах) Исходник мода теней пропавших из засвета танков помог бы, но такого я не нашел Ещё вопрос как сделать обводку этой созданной модельки, это должно быть возможно, тк во время ивентов в ангаре обводятся интерактивные модельки Как создать 2д маркер в 3д пространстве _StaticWorldMarker2D(self, objectID, markers2D, data, position, distance) принимает непонятные мне параметры. Если ткнёте в пример буду очень благодарен Если обобщить все вопросы, то с технической точки зрения мне пока что нужно сделать тень своего танка которая будет например с небольшим оффсетом повторять действия моего танка в бою, будет обведена и обладать маркером Ну а нафига мне это надо Хочу создать конструктор окружения для фан режима аля гоночки в трене. Добавить например эффект танкового биатлона со стрельбой. В идеале было бы круто сделать PVE фан режим. Что то типа большого босса танка. Заранее очень благодарен за ответы! Самому разбираться в исходниках сложновато Edited May 5, 2020 by SoprachevAK Quote Share this post Link to post Short link Share on other sites
StranikS_Scan 4,210 #482031 Posted May 6, 2020 (edited) 05.05.2020 в 05:40, SoprachevAK сказал: Самому разбираться в исходниках сложновато Пока не разберетесь в исходиках - ни чего не запилите. 05.05.2020 в 05:40, SoprachevAK сказал: Возникает риторический вопрос, если у нас есть сигнатуры всех функций, то почему нет никакого фан Scripting API, где каждый мог бы добавить своё описание? Он не нужен, весь основной код в пайтон файлах, они легко декомпилируются. Затем подключаете их к какому-нибудь pyCharm-у и гуляете по исходникам. 05.05.2020 в 05:40, SoprachevAK сказал: Как правильно сделать создание 3д модельки танка? В бою? Через BigWorld.Model(путь к *.model файлу) поищите примеры этого кода в исходниках. 05.05.2020 в 05:40, SoprachevAK сказал: position и yaw Через операции над матрицами модели можно задать и position и pitch и roll rotMatrix.setRotateYPR((entity.yaw, entity.pitch, entity.roll)) 05.05.2020 в 05:40, SoprachevAK сказал: Исходник мода теней пропавших из засвета танков помог бы, но такого я не нашел Если вы про мод, где именно тени, то не помог бы, т.к. эти тени нативные аля StippleModel и из пайтона с ними ни чего сделать нельзя, только вкл/выкл. Если же вы про тени сделанные из обычных моделек, то есть вот такой завалявшийся исходник 5 летней давности чего-то там: import os import BigWorld import GUI import Math import Keys import ResMgr from debug_utils import* from helpers import getClientVersion from Avatar import PlayerAvatar from Vehicle import Vehicle from VehicleAppearance import VehicleAppearance,StippleManager,_VEHICLE_DISAPPEAR_TIME from AvatarInputHandler.DynamicCameras.SniperCamera import SniperCamera from gui.WindowsManager import g_windowsManager PlayerAvatar.Key_Chams=Keys.KEY_U PlayerAvatar.chamsActive=True PlayerAvatar.Key_Edge=iIIii1IIi PlayerAvatar.edgeActive=False PlayerAvatar.edgeColor=Math.Vector4(0.5,0.5,0.5,1) PlayerAvatar.disappearDelayEnabled=True PlayerAvatar.disappearCaption=True PlayerAvatar.disappearDelay=5 PlayerAvatar.enableInSniper=False PlayerAvatar.chamsEnabled=True PlayerAvatar.edgeEnabled=True if ResMgr.openSection('scripts/client/mods/chams.xml'): if ResMgr.openSection('scripts/client/mods/chams.xml').has_key('ChamsEnabled'): PlayerAvatar.chamsEnabled=ResMgr.openSection('scripts/client/mods/chams.xml').readBool('ChamsEnabled') if ResMgr.openSection('scripts/client/mods/chams.xml').has_key('ChamsEnableInSniper'): PlayerAvatar.enableInSniper=ResMgr.openSection('scripts/client/mods/chams.xml').readBool('ChamsEnableInSniper') if ResMgr.openSection('scripts/client/mods/chams.xml').has_key('ChamsKey'): PlayerAvatar.Key_Chams=getattr(Keys,ResMgr.openSection('scripts/client/mods/chams.xml').readString('ChamsKey'),Keys.KEY_U) if ResMgr.openSection('scripts/client/mods/chams.xml').has_key('ChamsDefaultActive'): PlayerAvatar.chamsActive=ResMgr.openSection('scripts/client/mods/chams.xml').readBool('ChamsDefaultActive',True) if ResMgr.openSection('scripts/client/mods/chams.xml').has_key('EdgeEnabled'): PlayerAvatar.edgeEnabled=ResMgr.openSection('scripts/client/mods/chams.xml').readBool('EdgeEnabled') if ResMgr.openSection('scripts/client/mods/chams.xml').has_key('EdgeKey'): PlayerAvatar.Key_Edge=getattr(Keys,ResMgr.openSection('scripts/client/mods/chams.xml').readString('EdgeKey'),Keys.KEY_T) if ResMgr.openSection('scripts/client/mods/chams.xml').has_key('EdgeDefaultActive'): PlayerAvatar.edgeActive=ResMgr.openSection('scripts/client/mods/chams.xml').readBool('EdgeDefaultActive',False) if ResMgr.openSection('scripts/client/mods/chams.xml').has_key('EdgeColor'): PlayerAvatar.edgeColor=ResMgr.openSection('scripts/client/mods/chams.xml').readVector4('EdgeColor',Math.Vector4(0.5,0.5,0.5,1)) if ResMgr.openSection('scripts/client/mods/chams.xml').has_key('DisappearDelayEnabled'): PlayerAvatar.disappearDelayEnabled=ResMgr.openSection('scripts/client/mods/chams.xml').readBool('DisappearDelayEnabled',True) if ResMgr.openSection('scripts/client/mods/chams.xml').has_key('DisappearDelayText'): PlayerAvatar.disappearCaption=ResMgr.openSection('scripts/client/mods/chams.xml').readBool('DisappearDelayText') if ResMgr.openSection('scripts/client/mods/chams.xml').has_key('DisappearDelay'): PlayerAvatar.disappearDelay=ResMgr.openSection('scripts/client/mods/chams.xml').readFloat('DisappearDelay',5) PlayerAvatar.chamsPrevState=PlayerAvatar.chamsActive def ViAppStart(self,vehicle,prereqs=None): old_ViAppStart(self,vehicle,prereqs) self.chamsLoaded=True self.modifiedModelsDesc={'chassis': {'model': None,\ 'visibility': (True,True),\ '_node': None,\ '_stateFunc': lambda a,b: a.typeDescriptor.chassis['models']\ },\ 'hull': {'model': None,\ 'visibility': (True,True),\ '_node': None,\ '_stateFunc': lambda a,b: a.typeDescriptor.hull['models']\ },\ 'turret': {'model': None,\ 'visibility': (True,True),\ '_node': None,\ '_stateFunc': lambda a,b: a.typeDescriptor.turret['models']\ },\ 'gun': {'model': None,\ 'visibility': (True,True),\ '_node': None,\ '_stateFunc': lambda a,b: a.typeDescriptor.gun['models']\ }\ } for value in self.modifiedModelsDesc.itervalues(): model=value['_stateFunc'](vehicle,'undamaged') model=model.replace('normal/lod0/','collision/') try: value['model']=BigWorld.Model(model) value['model'].visible=False except Exception: self.chamsLoaded=False LOG_WARNING('Chams mod: can not load modified model from %s for vehicle %s'%(model,vehicle.typeDescriptor.name)) if self.chamsLoaded: chassis=self.modelsDesc['chassis'] hull=self.modelsDesc['hull'] turret=self.modelsDesc['turret'] gun=self.modelsDesc['gun'] new_chassis=self.modifiedModelsDesc['chassis'] new_hull=self.modifiedModelsDesc['hull'] new_turret=self.modifiedModelsDesc['turret'] new_gun=self.modifiedModelsDesc['gun'] try: chassis['model'].root.attach(new_chassis['model']) hull['_node'].attach(new_hull['model']) turret['_node'].attach(new_turret['model']) gun['_node'].attach(new_gun['model']) except Exception: LOG_ERROR('Chams mod: can not assemble models for %s.'%vehicle.typeDescriptor.name) raise if PlayerAvatar.chamsActive and vehicle.publicInfo['team'] is not BigWorld.player().team and vehicle.isAlive(): self.modelsDesc['chassis']['model'].visible=False self.modelsDesc['hull']['model'].visible=False self.modelsDesc['turret']['model'].visible=False self.modelsDesc['gun']['model'].visible=False self.modifiedModelsDesc['chassis']['model'].visible=True self.modifiedModelsDesc['hull']['model'].visible=True self.modifiedModelsDesc['turret']['model'].visible=True self.modifiedModelsDesc['gun']['model'].visible=True else: self.modelsDesc['chassis']['model'].visible=True self.modelsDesc['hull']['model'].visible=True self.modelsDesc['turret']['model'].visible=True self.modelsDesc['gun']['model'].visible=True self.modifiedModelsDesc['chassis']['model'].visible=False self.modifiedModelsDesc['hull']['model'].visible=False self.modifiedModelsDesc['turret']['model'].visible=False self.modifiedModelsDesc['gun']['model'].visible=False def reloadModels(): import Vehicle for vehicle in BigWorld.player().arena.vehicles.iterkeys(): entiti=BigWorld.entities.get(vehicle) if type(entiti)is Vehicle.Vehicle: if entiti.isAlive()and entiti.publicInfo['team']is not BigWorld.player().team: try:iI=entiti.appearance.chamsLoaded except:return if entiti.appearance.chamsLoaded: chassis=entiti.appearance.modelsDesc['chassis'] hull=entiti.appearance.modelsDesc['hull'] turret=entiti.appearance.modelsDesc['turret'] gun=entiti.appearance.modelsDesc['gun'] new_chassis=entiti.appearance.modifiedModelsDesc['chassis'] new_hull=entiti.appearance.modifiedModelsDesc['hull'] new_turret=entiti.appearance.modifiedModelsDesc['turret'] new_gun=entiti.appearance.modifiedModelsDesc['gun'] if PlayerAvatar.chamsActive: if new_chassis['model']is not None: chassis['model'].visible=False new_chassis['model'].visible=True if new_hull['model']is not None: hull['model'].visible=False new_hull['model'].visible=True if new_turret['model']is not None: turret['model'].visible=False new_turret['model'].visible=True if new_gun['model']is not None: gun['model'].visible=False new_gun['model'].visible=True else: if new_chassis['model']is not None: chassis['model'].visible=True new_chassis['model'].visible=False if new_hull['model']is not None: hull['model'].visible=True new_hull['model'].visible=False if new_turret['model']is not None: turret['model'].visible=True new_turret['model'].visible=False if new_gun['model']is not None: gun['model'].visible=True new_gun['model'].visible=False return def ii1(color): #SetEdgeColor from account_helpers.SettingsCore import g_settingsCore Colors=dict() ColorsSchema=ResMgr.openSection('scripts_config.xml/silhouetteColors') if ColorsSchema: if g_settingsCore.getSetting('isColorBlind'): blind='colorBlind/' else: blind='common/' Colors['self']=ColorsSchema.readVector4(blind+'self',Math.Vector4(0.2,0.2,0.2,0.5)) Colors['enemy']=ColorsSchema.readVector4(blind+'enemy',Math.Vector4(1,0,0,0.5)) Colors['friend']=ColorsSchema.readVector4(blind+'friend',Math.Vector4(0,1,0,0.5)) BigWorld.wgSetEdgeDetectColors((color,Colors['enemy'],Colors['friend'])) return def ApplyEdgeEntiti(): global EdgeModActive import Vehicle for entiti in BigWorld.entities.values(): if type(entiti)is Vehicle.Vehicle: if entiti.isAlive(): if entiti.publicInfo['team']is not BigWorld.player().team: target=BigWorld.target() if target is not None and target.id==entiti.id: pass else: BigWorld.wgDelEdgeDetectEntity(entiti) BigWorld.wgAddEdgeDetectEntity(entiti,0,False) return def DeleteEdgeEntiti(): global EdgeModActive import Vehicle for entiti in BigWorld.entities.values(): if type(entiti)is Vehicle.Vehicle: if entiti.isAlive(): if entiti.publicInfo['team']is not BigWorld.player().team: target=BigWorld.target() if target is not None and target.id==entiti.id: pass else: BigWorld.wgDelEdgeDetectEntity(entiti) return def new_targetFocus(self,entity): #NewTarrgetFocus import Vehicle if not isinstance(entity,Vehicle.Vehicle): return if PlayerAvatar.edgeActive: BigWorld.wgDelEdgeDetectEntity(entity) old_targetFocus(self,entity) return def new_targetBlur(self,prevEntity): import Vehicle old_targetBlur(self,prevEntity) if PlayerAvatar.edgeActive: if type(prevEntity)is Vehicle.Vehicle: if prevEntity.isAlive(): if prevEntity.publicInfo['team']is not BigWorld.player().team: BigWorld.wgAddEdgeDetectEntity(prevEntity,0,False) return def onVechKillEdge(targetID,attackerID,reason): entiti=BigWorld.entities.get(targetID) BigWorld.wgDelEdgeDetectEntity(entiti) return def SetEdgeEntiti(vehicle): if PlayerAvatar.edgeActive: ApplyEdgeEntiti() return def DelEdgeEntity(vehicle): BigWorld.wgDelEdgeDetectEntity(vehicle) return def new_handleKey(self,isDown,key,mods): if key==PlayerAvatar.Key_Chams and mods==0 and isDown and PlayerAvatar.chamsEnabled: if PlayerAvatar.chamsActive: PlayerAvatar.chamsActive=False PlayerAvatar.chamsPrevState=False g_windowsManager.battleWindow.call('battle.PlayerMessagesPanel.ShowMessage',['0','Recolor off','red']) reloadModels() else: PlayerAvatar.chamsActive=True PlayerAvatar.chamsPrevState=True g_windowsManager.battleWindow.call('battle.PlayerMessagesPanel.ShowMessage',['0','Recolor on','gold']) reloadModels() self.soundNotifications.play('chat_shortcut_common_fx') if key==PlayerAvatar.Key_Edge and mods==0 and isDown: if PlayerAvatar.edgeActive: PlayerAvatar.edgeActive=False g_windowsManager.battleWindow.call('battle.PlayerMessagesPanel.ShowMessage',['0','Edge mod off','red']) DeleteEdgeEntiti() else: PlayerAvatar.edgeActive=True g_windowsManager.battleWindow.call('battle.PlayerMessagesPanel.ShowMessage',['0','Edge mod on','gold']) ApplyEdgeEntiti() self.soundNotifications.play('chat_shortcut_common_fx') old_handleKey(self,isDown,key,mods) return def new_onEnterWorld(self,prereqs): old_onEnterWorld(self,prereqs) if PlayerAvatar.edgeEnabled: ii1(PlayerAvatar.edgeColor) self.arena.onVehicleKilled+=onVechKillEdge self.onVehicleEnterWorld+=SetEdgeEntiti self.onVehicleLeaveWorld+=DelEdgeEntity return if PlayerAvatar.chamsEnabled: reloadModels(); def new_onLeaveWorld(self): if PlayerAvatar.edgeEnabled: self.arena.onVehicleKilled-=onVechKillEdge self.onVehicleEnterWorld-=SetEdgeEntiti self.onVehicleLeaveWorld-=DelEdgeEntity old_onLeaveWorld(self) return times=[] def new_addStippleModel(self,vehID): from functools import partial stippleModel=self._StippleManager__stippleToAddDescs[vehID][0] if stippleModel.attached: CallAddStippleMode=BigWorld.callback(0.0,partial(self._StippleManager__addStippleModel,vehID)) self._StippleManager__stippleToAddDescs[vehID]=(stippleModel,CallAddStippleMode) return del self._StippleManager__stippleToAddDescs[vehID] BigWorld.player().addModel(stippleModel) vehicle=BigWorld.player().arena.vehicles.get(vehID) if PlayerAvatar.disappearDelayEnabled and BigWorld.player().team!=vehicle['team']: if PlayerAvatar.disappearCaption: vehicleType=unicode(vehicle['vehicleType'].type.shortUserString,'utf-8') TransBoundingBox=GUI.BoundingBox('objects/transparent.dds') TransBoundingBox.size=(0.05,0.05) o0='\cBFBFBFFF;'+vehicleType TransBoundingBox.my_string=GUI.Text(o0) TransBoundingBox.my_string.colourFormatting=True TransBoundingBox.my_string.font='default_small.font' TransBoundingBox.my_string.horizontalPositionMode=TransBoundingBox.my_string.verticalPositionMode='CLIP' TransBoundingBox.my_string.widthMode=TransBoundingBox.my_string.heightMode='PIXEL' TransBoundingBox.my_string.verticalAnchor='CENTER' TransBoundingBox.my_string.horizontalAnchor='CENTER' TransBoundingBox.source=stippleModel.bounds TransBoundingBox.my_string.position=(0.5,0.75,0) GUI.addRoot(TransBoundingBox) times.append({'time':BigWorld.time(),'bb':TransBoundingBox}) BigWorld.callback(PlayerAvatar.disappearDelay,delBoundingBox) CallAddStippleMode=BigWorld.callback(PlayerAvatar.disappearDelay,partial(self._StippleManager__removeStippleModel,vehID)) else: CallAddStippleMode=BigWorld.callback(_VEHICLE_DISAPPEAR_TIME,partial(self._StippleManager__removeStippleModel,vehID)) self._StippleManager__stippleDescs[vehID]=(stippleModel,CallAddStippleMode) def delBoundingBox(): for value in times: if BigWorld.time()-value['time']>=PlayerAvatar.disappearDelay: GUI.delRoot(value['bb']) times.remove(value) def new_SnipeCamEnable(self,targetPos,saveZoom): old_SnipeCamEnable(self,targetPos,saveZoom) if PlayerAvatar.enableInSniper: PlayerAvatar.chamsPrevState=PlayerAvatar.chamsActive PlayerAvatar.chamsActive=True if not PlayerAvatar.chamsPrevState: reloadModels() def new_SnipeCamDisable(self): old_SnipeCamDisable(self) if PlayerAvatar.enableInSniper: if PlayerAvatar.chamsActive!=PlayerAvatar.chamsPrevState: PlayerAvatar.chamsActive=PlayerAvatar.chamsPrevState reloadModels() old_onEnterWorld=PlayerAvatar.onEnterWorld old_onLeaveWorld=PlayerAvatar.onLeaveWorld old_handleKey=PlayerAvatar.handleKey old_ViAppStart=VehicleAppearance.start old_targetFocus=PlayerAvatar.targetFocus old_targetBlur=PlayerAvatar.targetBlur oo0oOo=StippleManager._StippleManager__addStippleModel old_SnipeCamEnable=SniperCamera.enable old_SnipeCamDisable=SniperCamera.disable PlayerAvatar.onEnterWorld=new_onEnterWorld PlayerAvatar.onLeaveWorld=new_onLeaveWorld PlayerAvatar.handleKey=new_handleKey if PlayerAvatar.chamsEnabled: VehicleAppearance.start=ViAppStart SniperCamera.enable=new_SnipeCamEnable SniperCamera.disable=new_SnipeCamDisable if PlayerAvatar.edgeEnabled: PlayerAvatar.targetFocus=new_targetFocus PlayerAvatar.targetBlur=new_targetBlur if PlayerAvatar.disappearDelayEnabled: StippleManager._StippleManager__addStippleModel=new_addStippleModel 05.05.2020 в 05:40, SoprachevAK сказал: щё вопрос как сделать обводку этой созданной модельки, это должно быть возможно, тк во время ивентов в ангаре обводятся интерактивные модельки Надо в исходник искать и изучать такую штуку как BigWorld.wgAddEdgeDetectEntity и BigWorld.wgDelEdgeDetectEntity или все что со словом edge. 05.05.2020 в 05:40, SoprachevAK сказал: Как создать 2д маркер в 3д пространстве В исходниках в репо на гитхаб в поиске вбить _StaticWorldMarker2D и поизучать пример вызова - тыц 05.05.2020 в 05:40, SoprachevAK сказал: Если обобщить все вопросы, то с технической точки зрения мне пока что нужно сделать тень своего танка которая будет например с небольшим оффсетом повторять действия моего танка в бою, будет обведена и обладать маркером Нифига не понял, зачем это нужно. Edited May 6, 2020 by StranikS_Scan Quote Share this post Link to post Short link Share on other sites
SoprachevAK 64 #482034 Posted May 6, 2020 (edited) @StranikS_Scan , Спасибо большое! Пойду изучать 47 minutes ago, StranikS_Scan said: Он не нужен, весь основной код в пайтон файлах, они легко декомпилируются. Затем подключаете их к какому-нибудь pyCharm-у и гуляете по исходникам. Так и поступил, однако в нетипизированном языке сигнатура функции говорит не очень много. А Scripting Api подразумевают к каждой сигнатуре ещё и небольшое описание, хотя бы что делает и что принимает, не всегда это очевидно по названию Как пример тот же StaticObjectMarker3D и BigWorld.Model Ещё раз благодарю за такой подробный и развёрнутый ответ. 47 minutes ago, StranikS_Scan said: В исходниках в репо на гитхаб в поиске вбить _StaticWorldMarker2D и поизучать пример вызова - тыц Через MarkerFactory уже пробовал создавать, но в бою ничего не отображается, ошибок в консоле тоже нет import BigWorld from gui.Scaleform.daapi.view.battle.event.markers import MarkerFactory, EventAreaPointUIMarkerController RADIUS = 10000 markerID = 0 ctrl = EventAreaPointUIMarkerController() ctrl.init() marker = MarkerFactory.createMarker((0, 10, 0), RADIUS, isVisible=True) ctrl.addMarker(markerID, marker, RADIUS) ctrl.showMarkersByObjId(markerID) Через _StaticWorldMarker2D как в MarkerFactory тоже не работает import BigWorld from bootcamp.BootcampMarkers import _StaticWorldMarker2D RADIUS = 0 markerID = 1 DefaultMarkerStyle = {'offset': (0, 10, 0), 'shape': 'arrow', 'blindShape': 'arrow'} marker2d = _StaticWorldMarker2D(markerID, DefaultMarkerStyle, (0, 0, 0), RADIUS) Edited May 6, 2020 by SoprachevAK Quote Share this post Link to post Short link Share on other sites
SoprachevAK 64 #482053 Posted May 7, 2020 8 hours ago, StranikS_Scan said: Если вы про мод, где именно тени, то не помог бы, т.к. эти тени нативные аля StippleModel и из пайтона с ними ни чего сделать нельзя, только вкл/выкл. Если же вы про тени сделанные из обычных моделек, то есть вот такой завалявшийся исходник 5 летней давности чего-то там: Reveal hidden contents import os import BigWorld import GUI import Math import Keys import ResMgr from debug_utils import* from helpers import getClientVersion from Avatar import PlayerAvatar from Vehicle import Vehicle from VehicleAppearance import VehicleAppearance,StippleManager,_VEHICLE_DISAPPEAR_TIME from AvatarInputHandler.DynamicCameras.SniperCamera import SniperCamera from gui.WindowsManager import g_windowsManager PlayerAvatar.Key_Chams=Keys.KEY_U PlayerAvatar.chamsActive=True PlayerAvatar.Key_Edge=iIIii1IIi PlayerAvatar.edgeActive=False PlayerAvatar.edgeColor=Math.Vector4(0.5,0.5,0.5,1) PlayerAvatar.disappearDelayEnabled=True PlayerAvatar.disappearCaption=True PlayerAvatar.disappearDelay=5 PlayerAvatar.enableInSniper=False PlayerAvatar.chamsEnabled=True PlayerAvatar.edgeEnabled=True if ResMgr.openSection('scripts/client/mods/chams.xml'): if ResMgr.openSection('scripts/client/mods/chams.xml').has_key('ChamsEnabled'): PlayerAvatar.chamsEnabled=ResMgr.openSection('scripts/client/mods/chams.xml').readBool('ChamsEnabled') if ResMgr.openSection('scripts/client/mods/chams.xml').has_key('ChamsEnableInSniper'): PlayerAvatar.enableInSniper=ResMgr.openSection('scripts/client/mods/chams.xml').readBool('ChamsEnableInSniper') if ResMgr.openSection('scripts/client/mods/chams.xml').has_key('ChamsKey'): PlayerAvatar.Key_Chams=getattr(Keys,ResMgr.openSection('scripts/client/mods/chams.xml').readString('ChamsKey'),Keys.KEY_U) if ResMgr.openSection('scripts/client/mods/chams.xml').has_key('ChamsDefaultActive'): PlayerAvatar.chamsActive=ResMgr.openSection('scripts/client/mods/chams.xml').readBool('ChamsDefaultActive',True) if ResMgr.openSection('scripts/client/mods/chams.xml').has_key('EdgeEnabled'): PlayerAvatar.edgeEnabled=ResMgr.openSection('scripts/client/mods/chams.xml').readBool('EdgeEnabled') if ResMgr.openSection('scripts/client/mods/chams.xml').has_key('EdgeKey'): PlayerAvatar.Key_Edge=getattr(Keys,ResMgr.openSection('scripts/client/mods/chams.xml').readString('EdgeKey'),Keys.KEY_T) if ResMgr.openSection('scripts/client/mods/chams.xml').has_key('EdgeDefaultActive'): PlayerAvatar.edgeActive=ResMgr.openSection('scripts/client/mods/chams.xml').readBool('EdgeDefaultActive',False) if ResMgr.openSection('scripts/client/mods/chams.xml').has_key('EdgeColor'): PlayerAvatar.edgeColor=ResMgr.openSection('scripts/client/mods/chams.xml').readVector4('EdgeColor',Math.Vector4(0.5,0.5,0.5,1)) if ResMgr.openSection('scripts/client/mods/chams.xml').has_key('DisappearDelayEnabled'): PlayerAvatar.disappearDelayEnabled=ResMgr.openSection('scripts/client/mods/chams.xml').readBool('DisappearDelayEnabled',True) if ResMgr.openSection('scripts/client/mods/chams.xml').has_key('DisappearDelayText'): PlayerAvatar.disappearCaption=ResMgr.openSection('scripts/client/mods/chams.xml').readBool('DisappearDelayText') if ResMgr.openSection('scripts/client/mods/chams.xml').has_key('DisappearDelay'): PlayerAvatar.disappearDelay=ResMgr.openSection('scripts/client/mods/chams.xml').readFloat('DisappearDelay',5) PlayerAvatar.chamsPrevState=PlayerAvatar.chamsActive def ViAppStart(self,vehicle,prereqs=None): old_ViAppStart(self,vehicle,prereqs) self.chamsLoaded=True self.modifiedModelsDesc={'chassis': {'model': None,\ 'visibility': (True,True),\ '_node': None,\ '_stateFunc': lambda a,b: a.typeDescriptor.chassis['models']\ },\ 'hull': {'model': None,\ 'visibility': (True,True),\ '_node': None,\ '_stateFunc': lambda a,b: a.typeDescriptor.hull['models']\ },\ 'turret': {'model': None,\ 'visibility': (True,True),\ '_node': None,\ '_stateFunc': lambda a,b: a.typeDescriptor.turret['models']\ },\ 'gun': {'model': None,\ 'visibility': (True,True),\ '_node': None,\ '_stateFunc': lambda a,b: a.typeDescriptor.gun['models']\ }\ } for value in self.modifiedModelsDesc.itervalues(): model=value['_stateFunc'](vehicle,'undamaged') model=model.replace('normal/lod0/','collision/') try: value['model']=BigWorld.Model(model) value['model'].visible=False except Exception: self.chamsLoaded=False LOG_WARNING('Chams mod: can not load modified model from %s for vehicle %s'%(model,vehicle.typeDescriptor.name)) if self.chamsLoaded: chassis=self.modelsDesc['chassis'] hull=self.modelsDesc['hull'] turret=self.modelsDesc['turret'] gun=self.modelsDesc['gun'] new_chassis=self.modifiedModelsDesc['chassis'] new_hull=self.modifiedModelsDesc['hull'] new_turret=self.modifiedModelsDesc['turret'] new_gun=self.modifiedModelsDesc['gun'] try: chassis['model'].root.attach(new_chassis['model']) hull['_node'].attach(new_hull['model']) turret['_node'].attach(new_turret['model']) gun['_node'].attach(new_gun['model']) except Exception: LOG_ERROR('Chams mod: can not assemble models for %s.'%vehicle.typeDescriptor.name) raise if PlayerAvatar.chamsActive and vehicle.publicInfo['team'] is not BigWorld.player().team and vehicle.isAlive(): self.modelsDesc['chassis']['model'].visible=False self.modelsDesc['hull']['model'].visible=False self.modelsDesc['turret']['model'].visible=False self.modelsDesc['gun']['model'].visible=False self.modifiedModelsDesc['chassis']['model'].visible=True self.modifiedModelsDesc['hull']['model'].visible=True self.modifiedModelsDesc['turret']['model'].visible=True self.modifiedModelsDesc['gun']['model'].visible=True else: self.modelsDesc['chassis']['model'].visible=True self.modelsDesc['hull']['model'].visible=True self.modelsDesc['turret']['model'].visible=True self.modelsDesc['gun']['model'].visible=True self.modifiedModelsDesc['chassis']['model'].visible=False self.modifiedModelsDesc['hull']['model'].visible=False self.modifiedModelsDesc['turret']['model'].visible=False self.modifiedModelsDesc['gun']['model'].visible=False def reloadModels(): import Vehicle for vehicle in BigWorld.player().arena.vehicles.iterkeys(): entiti=BigWorld.entities.get(vehicle) if type(entiti)is Vehicle.Vehicle: if entiti.isAlive()and entiti.publicInfo['team']is not BigWorld.player().team: try:iI=entiti.appearance.chamsLoaded except:return if entiti.appearance.chamsLoaded: chassis=entiti.appearance.modelsDesc['chassis'] hull=entiti.appearance.modelsDesc['hull'] turret=entiti.appearance.modelsDesc['turret'] gun=entiti.appearance.modelsDesc['gun'] new_chassis=entiti.appearance.modifiedModelsDesc['chassis'] new_hull=entiti.appearance.modifiedModelsDesc['hull'] new_turret=entiti.appearance.modifiedModelsDesc['turret'] new_gun=entiti.appearance.modifiedModelsDesc['gun'] if PlayerAvatar.chamsActive: if new_chassis['model']is not None: chassis['model'].visible=False new_chassis['model'].visible=True if new_hull['model']is not None: hull['model'].visible=False new_hull['model'].visible=True if new_turret['model']is not None: turret['model'].visible=False new_turret['model'].visible=True if new_gun['model']is not None: gun['model'].visible=False new_gun['model'].visible=True else: if new_chassis['model']is not None: chassis['model'].visible=True new_chassis['model'].visible=False if new_hull['model']is not None: hull['model'].visible=True new_hull['model'].visible=False if new_turret['model']is not None: turret['model'].visible=True new_turret['model'].visible=False if new_gun['model']is not None: gun['model'].visible=True new_gun['model'].visible=False return def ii1(color): #SetEdgeColor from account_helpers.SettingsCore import g_settingsCore Colors=dict() ColorsSchema=ResMgr.openSection('scripts_config.xml/silhouetteColors') if ColorsSchema: if g_settingsCore.getSetting('isColorBlind'): blind='colorBlind/' else: blind='common/' Colors['self']=ColorsSchema.readVector4(blind+'self',Math.Vector4(0.2,0.2,0.2,0.5)) Colors['enemy']=ColorsSchema.readVector4(blind+'enemy',Math.Vector4(1,0,0,0.5)) Colors['friend']=ColorsSchema.readVector4(blind+'friend',Math.Vector4(0,1,0,0.5)) BigWorld.wgSetEdgeDetectColors((color,Colors['enemy'],Colors['friend'])) return def ApplyEdgeEntiti(): global EdgeModActive import Vehicle for entiti in BigWorld.entities.values(): if type(entiti)is Vehicle.Vehicle: if entiti.isAlive(): if entiti.publicInfo['team']is not BigWorld.player().team: target=BigWorld.target() if target is not None and target.id==entiti.id: pass else: BigWorld.wgDelEdgeDetectEntity(entiti) BigWorld.wgAddEdgeDetectEntity(entiti,0,False) return def DeleteEdgeEntiti(): global EdgeModActive import Vehicle for entiti in BigWorld.entities.values(): if type(entiti)is Vehicle.Vehicle: if entiti.isAlive(): if entiti.publicInfo['team']is not BigWorld.player().team: target=BigWorld.target() if target is not None and target.id==entiti.id: pass else: BigWorld.wgDelEdgeDetectEntity(entiti) return def new_targetFocus(self,entity): #NewTarrgetFocus import Vehicle if not isinstance(entity,Vehicle.Vehicle): return if PlayerAvatar.edgeActive: BigWorld.wgDelEdgeDetectEntity(entity) old_targetFocus(self,entity) return def new_targetBlur(self,prevEntity): import Vehicle old_targetBlur(self,prevEntity) if PlayerAvatar.edgeActive: if type(prevEntity)is Vehicle.Vehicle: if prevEntity.isAlive(): if prevEntity.publicInfo['team']is not BigWorld.player().team: BigWorld.wgAddEdgeDetectEntity(prevEntity,0,False) return def onVechKillEdge(targetID,attackerID,reason): entiti=BigWorld.entities.get(targetID) BigWorld.wgDelEdgeDetectEntity(entiti) return def SetEdgeEntiti(vehicle): if PlayerAvatar.edgeActive: ApplyEdgeEntiti() return def DelEdgeEntity(vehicle): BigWorld.wgDelEdgeDetectEntity(vehicle) return def new_handleKey(self,isDown,key,mods): if key==PlayerAvatar.Key_Chams and mods==0 and isDown and PlayerAvatar.chamsEnabled: if PlayerAvatar.chamsActive: PlayerAvatar.chamsActive=False PlayerAvatar.chamsPrevState=False g_windowsManager.battleWindow.call('battle.PlayerMessagesPanel.ShowMessage',['0','Recolor off','red']) reloadModels() else: PlayerAvatar.chamsActive=True PlayerAvatar.chamsPrevState=True g_windowsManager.battleWindow.call('battle.PlayerMessagesPanel.ShowMessage',['0','Recolor on','gold']) reloadModels() self.soundNotifications.play('chat_shortcut_common_fx') if key==PlayerAvatar.Key_Edge and mods==0 and isDown: if PlayerAvatar.edgeActive: PlayerAvatar.edgeActive=False g_windowsManager.battleWindow.call('battle.PlayerMessagesPanel.ShowMessage',['0','Edge mod off','red']) DeleteEdgeEntiti() else: PlayerAvatar.edgeActive=True g_windowsManager.battleWindow.call('battle.PlayerMessagesPanel.ShowMessage',['0','Edge mod on','gold']) ApplyEdgeEntiti() self.soundNotifications.play('chat_shortcut_common_fx') old_handleKey(self,isDown,key,mods) return def new_onEnterWorld(self,prereqs): old_onEnterWorld(self,prereqs) if PlayerAvatar.edgeEnabled: ii1(PlayerAvatar.edgeColor) self.arena.onVehicleKilled+=onVechKillEdge self.onVehicleEnterWorld+=SetEdgeEntiti self.onVehicleLeaveWorld+=DelEdgeEntity return if PlayerAvatar.chamsEnabled: reloadModels(); def new_onLeaveWorld(self): if PlayerAvatar.edgeEnabled: self.arena.onVehicleKilled-=onVechKillEdge self.onVehicleEnterWorld-=SetEdgeEntiti self.onVehicleLeaveWorld-=DelEdgeEntity old_onLeaveWorld(self) return times=[] def new_addStippleModel(self,vehID): from functools import partial stippleModel=self._StippleManager__stippleToAddDescs[vehID][0] if stippleModel.attached: CallAddStippleMode=BigWorld.callback(0.0,partial(self._StippleManager__addStippleModel,vehID)) self._StippleManager__stippleToAddDescs[vehID]=(stippleModel,CallAddStippleMode) return del self._StippleManager__stippleToAddDescs[vehID] BigWorld.player().addModel(stippleModel) vehicle=BigWorld.player().arena.vehicles.get(vehID) if PlayerAvatar.disappearDelayEnabled and BigWorld.player().team!=vehicle['team']: if PlayerAvatar.disappearCaption: vehicleType=unicode(vehicle['vehicleType'].type.shortUserString,'utf-8') TransBoundingBox=GUI.BoundingBox('objects/transparent.dds') TransBoundingBox.size=(0.05,0.05) o0='\cBFBFBFFF;'+vehicleType TransBoundingBox.my_string=GUI.Text(o0) TransBoundingBox.my_string.colourFormatting=True TransBoundingBox.my_string.font='default_small.font' TransBoundingBox.my_string.horizontalPositionMode=TransBoundingBox.my_string.verticalPositionMode='CLIP' TransBoundingBox.my_string.widthMode=TransBoundingBox.my_string.heightMode='PIXEL' TransBoundingBox.my_string.verticalAnchor='CENTER' TransBoundingBox.my_string.horizontalAnchor='CENTER' TransBoundingBox.source=stippleModel.bounds TransBoundingBox.my_string.position=(0.5,0.75,0) GUI.addRoot(TransBoundingBox) times.append({'time':BigWorld.time(),'bb':TransBoundingBox}) BigWorld.callback(PlayerAvatar.disappearDelay,delBoundingBox) CallAddStippleMode=BigWorld.callback(PlayerAvatar.disappearDelay,partial(self._StippleManager__removeStippleModel,vehID)) else: CallAddStippleMode=BigWorld.callback(_VEHICLE_DISAPPEAR_TIME,partial(self._StippleManager__removeStippleModel,vehID)) self._StippleManager__stippleDescs[vehID]=(stippleModel,CallAddStippleMode) def delBoundingBox(): for value in times: if BigWorld.time()-value['time']>=PlayerAvatar.disappearDelay: GUI.delRoot(value['bb']) times.remove(value) def new_SnipeCamEnable(self,targetPos,saveZoom): old_SnipeCamEnable(self,targetPos,saveZoom) if PlayerAvatar.enableInSniper: PlayerAvatar.chamsPrevState=PlayerAvatar.chamsActive PlayerAvatar.chamsActive=True if not PlayerAvatar.chamsPrevState: reloadModels() def new_SnipeCamDisable(self): old_SnipeCamDisable(self) if PlayerAvatar.enableInSniper: if PlayerAvatar.chamsActive!=PlayerAvatar.chamsPrevState: PlayerAvatar.chamsActive=PlayerAvatar.chamsPrevState reloadModels() old_onEnterWorld=PlayerAvatar.onEnterWorldold_onLeaveWorld=PlayerAvatar.onLeaveWorldold_handleKey=PlayerAvatar.handleKeyold_ViAppStart=VehicleAppearance.startold_targetFocus=PlayerAvatar.targetFocusold_targetBlur=PlayerAvatar.targetBluroo0oOo=StippleManager._StippleManager__addStippleModelold_SnipeCamEnable=SniperCamera.enableold_SnipeCamDisable=SniperCamera.disable PlayerAvatar.onEnterWorld=new_onEnterWorldPlayerAvatar.onLeaveWorld=new_onLeaveWorldPlayerAvatar.handleKey=new_handleKey if PlayerAvatar.chamsEnabled: VehicleAppearance.start=ViAppStart SniperCamera.enable=new_SnipeCamEnable SniperCamera.disable=new_SnipeCamDisableif PlayerAvatar.edgeEnabled: PlayerAvatar.targetFocus=new_targetFocus PlayerAvatar.targetBlur=new_targetBlurif PlayerAvatar.disappearDelayEnabled: StippleManager._StippleManager__addStippleModel=new_addStippleModel А где такие исходники заваливаются?) я бы там остальные посмотрел. Это не совсем то что надо, тут переопределяют модельки для созданного экземпляра Vehicle, а мне надо из моделек собрать свой, ну и чтоб башня располагалась на корпусе, а пушка в башне. Были такие модики которые рисовали модельки за кругом отрисовки, и были которые рисовали модельки в месте где противник пропал из засвета. Quote Share this post Link to post Short link Share on other sites