Difference between revisions of "HowTo:Edit Missions:Python:Bindings:Python"
(added categories) |
m |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{parent_link|parent=[[HowTo:Edit_Missions:Python:Bindings|Bindings]]}} |
− | |||
− | |||
− | |||
− | }} | ||
---- | ---- | ||
− | |||
<pre> | <pre> | ||
Line 639: | Line 634: | ||
</pre> | </pre> | ||
− | + | [[Category:HowTos|Edit Missions:Python:Bindings:Python]] | |
− | + | [[Category:Development|Edit Missions:Python:Bindings:Python]] | |
− | |||
− | |||
− | |||
− | |||
− | [[Category: |
Latest revision as of 19:17, 28 May 2005
Bindings |
class Unit: #don't call this one :-) it's just there in the stub ... really make units with the VS.launch above def __init__(self): print 'Unit constructor called with (self)' # 1 "python_unit_wrap.h" 1 #make this unit warp to "un" and possibly ignore friendly targets. when computing if allowed def AutoPilotTo(self,un,ignore_friendlies): print "AutoPilotTo" return 0 #sets the turret AI to actually fire a turret def SetTurretAI(self): print "SetTurretAI" #tells teh turret AI never to fire def DisableTurretAI(self): print "DisableTurretAI" #drains power of a unit def leach(self,XshieldPercent,YrechargePercent,ZenergyPercent): print "leach" #figures out what rank in the flightgroup is the unit (-1 if no flightgroup or unit dead) def getFgSubnumber(self): print "getFgSubnumber" return -1 #gets the ID of the flightgroup def getFgID(self): print "getFgID" return string() #sets the unit's nickname def setFullname(self,name): print "setFullname" #gets the unit's nickname def getFullname(self): print "getFullname" return string() #debug def getFullAIDescription(self): print "getFullAIDescription" return string() #not sure!! def setTargetFg(self,primary,secondary,tertiary): print "setTargetFg" #not sure again..perhaps targets a flihgtgroup? probably slow def ReTargetFg(self,which_target): print "ReTargetFg" #if self is a starship as opposed to planet, asteroid, etc def isStarShip(self): print "isStarShip" return 0 #if the self is a planet def isPlanet(self): print "isPlanet" return 0 #if the self is a jump point def isJumppoint(self): print "isJumppoint" return 0 #if the other is an enemey def isEnemy(self,other): print "isEnemy" return 0 #if the enemy is a friend def isFriend(self,other): print "isFriend" return 0 #if enemy is neutral def isNeutral(self,other): print "isNeutral" return 0 #get the numerical relation btw -1 and 1 of this with other (may not be the same as other and this) def getRelation(self,other): print "getRelation" return 0 #switches missile def ToggleWeapon(self,Missile): print "ToggleWeapon" #turns on all missiles def SelectAllWeapon(self,Missile): print "SelectAllWeapon" #splits a unit into many shrapnel... not 100% sure this works def Split(self,level): print "Split" #don't call def Init(self): print "Init" #turns on the jump drive (provided energy) this will cause the unit to teleport upon hitting a jump point #this also causes the default AI to go for targetted jump points like there's no tomorrow. #Desintation should be 0 for now def ActivateJumpDrive(self,destination): print "ActivateJumpDrive" #this turns off an active jump drive def DeactivateJumpDrive(self): print "DeactivateJumpDrive" #destroys this unit with explosion...preferrable to deliver damage or to just plain call Kill() def Destroy(self): print "Destroy" #finds the local coordinates of another unit in this unit's space def LocalCoordinates(self,un): print "LocalCoordinates" return (0,0,0) #is another unit in range of this def InRange(self,target,cone,cap): print "InRange" return 0 #is this unit visible? def CloakVisible(self): print "CloakVisible" return 0 #Please cloak this unit def Cloak(self,cloak): print "Cloak" #debug I think!! def RemoveFromSystem(self): print "RemoveFromSystem" #find this unit's position if a unit at local_posit fired a shot at speed "speed" def PositionITTS(self,local_posit,speed): print "PositionITTS" return (0,0,0) #the actual position of this unit def Position(self): print "Position" return (0,0,0) #position of this unit based on its owning unit (i.e. if it is a turret) or else space for most units def LocalPosition(self): print "LocalPosition" return (0,0,0) #the unit that is threatening this unit def Threat(self): print "Threat" return Unit() #set the turrets to target the target passed in def TargetTurret(self,targ): print "TargetTurret" #get an iterator to the subunits def getSubUnits(self): print "getSubUnits" return 0 #threaten the target (placing this unit in the Threat() variable) def Threaten(self,targ,danger): print "Threaten" #set the threat level to zero def ResetThreatLevel(self): print "ResetThreatLevel" #fire guns or (if missile is 1) missiles def Fire(self,Missile): print "Fire" #turn off beams def UnFire(self): print "UnFire" #how far have our missiles locked def computeLockingPercent(self): print "computeLockingPercent" return 0 #what percent is our shield def FShieldData(self): print "FShieldData" return 0 def RShieldData(self): print "RShieldData" return 0 def LShieldData(self): print "LShieldData" return 0 def BShieldData(self): print "BShieldData" return 0 #how much fuel have we def FuelData(self): print "FuelData" return 0 #how much energy def EnergyData(self): print "EnergyData" return 0 #how much hull def GetHull(self): print "GetHull" return 0 #how big is this unit def rSize(self): print "rSize" return 0 #how far away is this unit from a point def getMinDis(self,pnt): print "getMinDis" return 0 #is a beam (starting at start, ending at end) going through a bubble around this unit def querySphere(self,start,end,my_unit_radius): print "querySphere" return 0 #is a beam starting at origin with direction going through this unit def queryBoundingBox(self,origin,direction,err): print "queryBoundingBox" return 0 #reset all orders to "sitting duck" def PrimeOrders(self): print "PrimeOrders" #load an AI script given the name def LoadAIScript(self,aiscript): print "LoadAIScript" #load the last script that was constructed from VS.PythonAI def LoadLastPythonAIScript(self): print "LoadLastPythonAIScript" return 0 #enqueue that script into the end of the given scripts def EnqueueLastPythonAIScript(self): print "EnqueueLastPythonAIScript" return 0 #set the position to be pos def SetPosition(self,pos): print "SetPosition" #set the current position (causing the unit to streak over to that position in a number of frames) def SetCurPosition(self,pos): print "SetCurPosition" #sets all positions to be that position def SetPosAndCumPos(self,pos): print "SetPosAndCumPos" #rotation on that axis def Rotate(self,axis): print "Rotate" def ApplyForce(self,Vforce): print "ApplyForce" def ApplyLocalForce(self,Vforce): print "ApplyLocalForce" def Accelerate(self,Vforce): print "Accelerate" def ApplyTorque(self,Vforce,Location): print "ApplyTorque" def ApplyBalancedLocalTorque(self,Vforce,Location): print "ApplyBalancedLocalTorque" def ApplyLocalTorque(self,torque): print "ApplyLocalTorque" #deals damage to the hull based on a local coordinate point def DealDamageToHull(self,pnt,Damage): print "DealDamageToHull" return 0 #finds a thrust vector based on the thrust passed in (given the fact that thrusters are finite powered) def ClampThrust(self,thrust,afterburn): print "ClampThrust" return (0,0,0) #thrust in a direction def Thrust(self,amt,afterburn): print "Thrust" #give lateral thrust def LateralThrust(self,amt): print "LateralThrust" def VerticalThrust(self,amt): print "VerticalThrust" def LongitudinalThrust(self,amt): print "LongitudinalThrust" #clamp the velocity of a unit to its max speed def ClampVelocity(self,velocity,afterburn): print "ClampVelocity" return (0,0,0) #clamp a rotation of the unit to max yaw/pitch/roll def ClampAngVel(self,vel): print "ClampAngVel" return (0,0,0) #clamp angular acceleration to a vector def ClampTorque(self,torque): print "ClampTorque" return (0,0,0) #sets the orientation given the up and fore vector (q and r respectiveoly) def SetOrientation(self,q,r): print "SetOrientation" #translate from the previous space to this space (without translation) def UpCoordinateLevel(self,v): print "UpCoordinateLevel" return (0,0,0) #translate from this space down to the world space (without translation) def DownCoordinateLevel(self,v): print "DownCoordinateLevel" return (0,0,0) #goes from world space to this coordinates including translation_ def ToLocalCoordinates(self,v): print "ToLocalCoordinates" return (0,0,0) #goes from this coordinates to world coordinates including translation def ToWorldCoordinates(self,v): print "ToWorldCoordinates" return (0,0,0) #gets the angular velocity def GetAngularVelocity(self): print "GetAngularVelocity" return (0,0,0) #gets velocity def GetVelocity(self): print "GetVelocity" return (0,0,0) def SetVelocity(self,v): print "SetVelocity" def SetAngularVelocity(self,v): print "SetAngularVelocity" def GetMoment(self): print "GetMoment" return 0 def GetMass(self): print "GetMass" return 0 #is a missile locked? def LockMissile(self): print "LockMissile" return 0 #enject cargo with that index (-1 is ejector seat) def EjectCargo(self,index): print "EjectCargo" #what would this unti pay for the cargo string passed in) def PriceCargo(self,s): print "PriceCargo" return 0 #how cargos does this unit have def numCargo(self): print "numCargo" return 0 #is the docking unit cleared with this one def IsCleared(self,dockingunit): print "IsCleared" return 0 #get an entire category from teh master part list and add it to the hold def ImportPartList(self,category,price,pricedev,quantity,quantdev): print "ImportPartList" #docking unit wants to request clearence to self def RequestClearance(self,dockingunit): print "RequestClearance" return 0 #is the unit docked already? def isDocked(self,dockingUnit): print "isDocked" return 0 #try to dock (if in white square) with the unittoDockWith otherwise return false def Dock(self,unitToDockWith): print "Dock" return 0 #try to undock with the unitToDockWith...on success return 1 def UnDock(self,unitToDockWith): print "UnDock" return 0 #get number of gunso n this ship (and missiles) def GetNumMounts(self): print "GetNumMounts" return 0 #teleport to that other system (as a string) loads if necessary def JumpTo(self,systemstring): print "JumpTo" return 0 #gets the faction name of this unit def getFactionName(self): print "getFactionName" return '' #gets the faciton index def getFactionIndex(self); print "getFactionIndex" return 0 #sets the faction name (who ownz this unit) def setFactionName(self,strname): print "setFactionName" #who owns this def setFactionIndex(self,factionindex): print "setFactionIndex" def getName(self): print "getName" return '' def getFlightgroupName(self): print "getFlightgroupName" return '' def getFgDirective(self): print "getFgDirective" return '' #gets a unit who is the leader of this flightgroup...returns this if no flightgroup def getFlightgroupLeader(self): print "getFlightgroupLeader" return Unit() #gimme (this unit) money (can be negative) def addCredits(self,floatcache): print "addCredits" #switch to another lfightgroup def switchFg(self,fgname): print "switchFg" #how much cache do I have (money) def getCredits(self): print "getCredits" return 0 #set the leader def setFlightgroupLeader(self,leader): print "setFlightgroupLeader" return 0 #not sure def setFgDirective(a=None,b=None,c=None,d=None,e=None,f=None,g=None,h=None,i=None,j=None): print "setFgDirective" return 0 #how leaderful am I def getFgSubnumber(self): print "getFgSubnumber" return -1 #is this unit a significant object (base, jump point, planet) def isSignificant(self): print "isSignificant" return 0 def isSun(self): print "isSun" return 0 #communicate to other unit def communicateTo(self,other): print "communicateTo" return 0 #maek comm animation appear on screen of target def commAnimation(self, stringanimation): print "commAnimation" return 0 #remove a crago from this unit def removeCargo(self, stringcargo,quantity): print "removeCargo" return 0 #add another units stats to my own... in the upgrades/unitfile/unitfile def upgrade(self, unitfile,force, subunitoffset, mountoffset): print "upgrade" return 0 #add cargo to my unit def addCargo(self,Cargo carg): print "addCargo" return 0 #get distance (minus radii) between self and other def getDistance(self, other): print "getDistance" return 0 #increment random cargo def incrementCargo(a=None,b=None,c=None,d=None,e=None,f=None,g=None,h=None,i=None,j=None): print "incrementCargo" return 0 #decrement random cargo def decrementCargo(a=None,b=None,c=None,d=None,e=None,f=None,g=None,h=None,i=None,j=None): print "decrementCargo" return 0 #get distance plus atmospheric size if large planet (to prevent players from coming too close #to surface when leaving autopilot def getSignificantDistance(self,other): print "getSignificantDistance" return 0 #is this unit a player starship...if not return -1 else return player number (starting at 0) def isPlayerStarship(a=None,b=None,c=None,d=None,e=None,f=None,g=None,h=None,i=None,j=None): print "isPlayerStarship" return -1 #does this unit have some cargo def hasCargo(self,mycarg): print "hasCargo" return 0 #retuns cargo if the unit has it by that name else returns cargo with 0 quantity def GetCargo(self,cargoname): print "GetCargo" return Cargo("","",1,1,1,1) # 351 "unit_wrapper.cpp" 2 #is this unti equal to another def __eq__(self,oth): print "__eq__" return 0; #is this unit notequal def __ne__(self,oth): print "__ne__" return 1; #remove unit from game the correct way def Kill(self): print "Kill"; #set this unit to be null (doesnt' affect unit itself, only this pointer) def setNull(self): print "setNull"; #is this unit not null def __nonzero__(self): print "__nonzero__" return random.randrange(0,2); #is this unit NULL (i.e. dead or killed) def isNull(self): print "isNull" return random.randrange(0,2); #set this units' target to un def SetTarget(self,un): print "SetTarget"; #get this unit's current target def GetTarget(self): print "GetTarget" return Unit(); #get the unit that this unit is matching speed with def GetVelocityReference(self): print "GetVelocityReference" return Unit() #set the unit this unit is matching speed with def SetVelocityReference(self,un): print "SetVelocityReference"; #get orientation of this unit def GetOrientation(self): print "GetOrientation" return ((1,0,0),(0,1,0),(0,0,1)) #is the beam inside this ship def queryBSP(self,start,end): print "queryBSP" return (un,(0,0,1),0) #how far off is this unit to another unit with guns that have speed and range) (returns a tuple #with a cosine and a range normalized between 0 and 1) def cosAngleToITTS(self,un,speed,range): print "cosAngleToITTS" return (.95,10000) #same as above but assuming guns are instant def cosAngleTo(self,un): print "cosAngleTo" return (.93,10000) #more specific to this ship and very slow def cosAngleFromMountTo(self,un): print "cosAngleFromMountTo" return (.93,10000) #gets the gun speed of this ship def getAverageGunSpeed(self): print "getAverageGunSpeed" return (200,10000) #is another unit inside this unit def InsideCollideTree(self,un): print "InsideCollideTree" return ((0,0,0),(0,0,1),(0,0,0),(0,1,0)) #get a particular turret def getSubUnit(self,which): print "getSubUnit" return Unit() #this is the unit iterator class... it is returned in a number of functions... DO NOT keep this #across a frame (i.e. save it after Execute() class un_iter: #dont' call this...stub only def __init__(self): print 'un_iter constructor called with (self)' #the unit this iterator is pointing to (may well be null...that's how you know to stop checking) def current(self): print "current" return Unit() #advance this iterator (check to see if null first!!) def advance(self): print "advance" #remove this unit from the collection in wchih it is in def remove(self): print "remove" #add a unit to this collection def preinsert(self,un): print "preinsert" class Cargo: def __init__ (self,a,b,c,d,e,f): print 'Cargo constructor called with (self,%s,%s,%f,%d,%f,%f)' % (a,b,c,d,e,f) def SetPrice(self,price): print "SetPrice" def GetPrice(self): print "GetPrice" return 1 def SetMass(self,mass): print "SetMass" def GetMass(self): print "GetMass" return 1 def SetVolume(self,volume): print "SetVolume" def GetVolume(self): print "GetVolume" return 1 def SetQuantity(self,quantity): print "SetQuantity" def GetQuantity(self): print "GetQuantity" return 1 def SetContent(self,content): print "SetContent" def GetContent(self): print "GetContent" return "weapons" def SetCategory(self,category): print "SetCategory" def GetCategory(self): print "GetCategory" return "contraband" def SetMissionFlag(self,flag): print "SetMissionFlag" def GetMissionFlag(self): print "GetMissionFlag" return 0 def GetCategory(self): print "GetCategory" return "contraband" def GetDescription(self): print "GetDescription" return "" class PythonAI: def init(self,un): print "init" def Execute(self): print "Execute" def GetParent(self): print "GetParent" return Unit() def __init__(self): print 'PythonAI constructor called with (self)' self.init(Unit()) def AddReplaceLastOrder(self,replace): print "AddReplaceLastOrder" def ExecuteLastScriptFor(self,time): print "ExecuteLastScriptFor" def FaceTarget(self,end): print "FaceTarget" def FaceTargetITTS(self,end): print "FaceTargetITTS" def MatchLinearVelocity(self,terminate,vec,afterburn,local): print "MatchLinearVelocity" def MatchAngularVelocity(self,terminate,vec,local): print "MatchAngularVelocity" def ChangeHeading(self,vec): print "ChangeHeading" def ChangeLocalDirection(self,vec): print "ChangeLocalDirection" def MoveTo(self,Targ,afterburn): print "MoveTo" def MatchVelocity(self,terminate,vec,angvel,afterburn,local): print "MatchVelocity" def Cloak(self,enable,seconds): print "Cloak" def FormUp(self,pos): print "FormUp" def FaceDirection(self,distToMatchFacing,finish): print "FaceDirection" def XMLScript(self,script): print "XMLScript" def LastPythonScript(self): print "LastPythonScript"