Difference between revisions of "Cabal Common Library Doc OXPStrength"
m |
m (part II) |
||
Line 40: | Line 40: | ||
:;coef:Number. Calculated coefficient. |
:;coef:Number. Calculated coefficient. |
||
::If entity was specified the value for this specific entity, otherwise the highest gathered coefficient in the system. |
::If entity was specified the value for this specific entity, otherwise the highest gathered coefficient in the system. |
||
+ | |||
+ | |||
+ | === checkSpaceLane() === |
||
+ | {{CodeEx|codeex=worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkSpaceLane(entity); }} |
||
+ | {{CodeExTime|native=0.000550|extension=0.000260|js=0.000545}} |
||
+ | Returns array with distances to the main station, witchpoint and lanes (witchpoint->planet, planet->sun, witchpoint->sun). |
||
+ | In interstellar space or nova systems all distances will be zero. |
||
+ | |||
+ | '''Parameters:''' |
||
+ | :;entity:Entity. |
||
+ | |||
+ | '''Returns:''' |
||
+ | :;array:Array with the format [ID,distMS,distWP,distLWP,distLPS,distLWS]. |
||
+ | ::ID is |
||
+ | :::* -1 for interstellar space. |
||
+ | :::* 0 for standard systems if at least one of the distances < 50000. |
||
+ | :::* 1 for nova systems. |
||
+ | :::* 2 for standard systems if none of the distances < 50000. |
||
+ | |||
+ | |||
+ | === checkWeapons() === |
||
+ | {{CodeEx|codeex=worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkWeapons(entity); }} |
||
+ | {{CodeExTime|native=0.000176|extension=0.000067|js=0.000152}} |
||
+ | Returns array with values for weapons in standard weapon slots (forward, aft, port, starboard). |
||
+ | |||
+ | '''Parameters:''' |
||
+ | :;entity:Entity. |
||
+ | |||
+ | '''Returns:''' |
||
+ | :;array:Array with the format [number of slots,sum,typestring]. typestring is concatenated string of sum (e.g. "5311"). |
||
+ | ::sum is the sum of all weapons |
||
+ | :::* 1 - Pulse Laser |
||
+ | :::* 3 - Beam Laser |
||
+ | :::* 4 - Mining Laser, Twin Plasma Cannon |
||
+ | :::* 5 - Military Laser |
||
+ | :::* 8 - Thargoid Laser |
||
Revision as of 14:21, 7 February 2013
Contents
Overview
This is the main class for the OXPStrength with its members and part of the Cabal_Common_Library.
It is a helper tool specially for mission OXPs to check the environment and helps to determine the players strength. The script is meant for OXP developers only.
The underlaying API calculates a checksum (coef) for entities. This checksum can be gathered by scripts for specific entities (Player and NPCs). Factors are:
- Accuracy (v1.7.1)
- Distance to the hotspots (MainStation,WP and lanes WP,WS,PS)
- Equipment
- Escorts / Defense ships
- Laser
- Mass (v1.7.1)
- MaxEnergy
- MaxSpeed
- MaxThrust
- Missiles
- PrimaryRole
- ShieldRechargeRates
- Subent laser
- Turrets
Functions
checkPower()
worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkPower(entity,logging); |
Checks entities and returns the gathered coefficient. This is the main entry point for OXPs.
For NPCs the standard range is 0..192, but OXP entities can have a lot higher value based on their settings. Playerships are treated different and are getting higher values. A standard Cobra MkIII has a value of 110 in the beginning and gets up to 307 if fully equipped with standard weaponry, missiles and other standard equipment. The Boa Class Cruiser even gets 314.
Parameters:
- entity
- Entity. If specified only this entity will be checked, otherwise all entities in the system (except the player).
- Optional.
- logging
- Boolean. If true a verbose lits will be logged to Latest.log. This is useful while writing OXPs.
- Optional.
Returns:
- coef
- Number. Calculated coefficient.
- If entity was specified the value for this specific entity, otherwise the highest gathered coefficient in the system.
checkSpaceLane()
worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkSpaceLane(entity); |
Profiler | |
---|---|
Native | 0.000550s |
Extension | 0.000260s |
JS | 0.000545s |
Returns array with distances to the main station, witchpoint and lanes (witchpoint->planet, planet->sun, witchpoint->sun). In interstellar space or nova systems all distances will be zero.
Parameters:
- entity
- Entity.
Returns:
- array
- Array with the format [ID,distMS,distWP,distLWP,distLPS,distLWS].
- ID is
- -1 for interstellar space.
- 0 for standard systems if at least one of the distances < 50000.
- 1 for nova systems.
- 2 for standard systems if none of the distances < 50000.
checkWeapons()
worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkWeapons(entity); |
Profiler | |
---|---|
Native | 0.000176s |
Extension | 0.000067s |
JS | 0.000152s |
Returns array with values for weapons in standard weapon slots (forward, aft, port, starboard).
Parameters:
- entity
- Entity.
Returns:
- array
- Array with the format [number of slots,sum,typestring]. typestring is concatenated string of sum (e.g. "5311").
- sum is the sum of all weapons
- 1 - Pulse Laser
- 3 - Beam Laser
- 4 - Mining Laser, Twin Plasma Cannon
- 5 - Military Laser
- 8 - Thargoid Laser
Properties
CCL_OXPStrength
The script can set a property to be used for strong entities.
worldScripts.Cabal_Common_OXPStrength.CCL_OXPStrength = 5; |
Main purpose is to prevent the spawning by the populator. OXPs can use it in condition scripts. Default is 9.
Suggested classes:
- 1 = coef < 100
- 2 = coef < 200 - This is the default threshold for native Oolite NPCs if logging is used.
- 3 = coef < 300
- 4 = coef < 400
- 5 = coef < 600
- 6 = coef < 900
- 7 = coef < 1000
- 8 = coef < 3000
- 9 = otherwise, default setting for .CCL_OXPStrength.
scriptInfo
ccl_missionShip
Missionships can also use a script_info key to indicate that this entity has to be handled with care by other scripts.
script_info = {ccl_missionShip = true;} |