Difference between revisions of "Cabal Common Library Doc OXPStrength"
m (part VI) |
m (part VII) |
||
Line 29: | Line 29: | ||
All profiled times are only for gathering infos for a fully equipped player ship. |
All profiled times are only for gathering infos for a fully equipped player ship. |
||
=== checkPower() === |
=== checkPower() === |
||
− | {{CodeEx|codeex=worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkPower(entity,logging); }} |
+ | {{CodeEx|codeex=worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkPower( entity, logging, coef, location ); }} |
{{CodeExTime|native=0.001295|extension=0.000488|js=0.000807}} |
{{CodeExTime|native=0.001295|extension=0.000488|js=0.000807}} |
||
Checks entities and returns the gathered coefficient. This is the main entry point for OXPs. |
Checks entities and returns the gathered coefficient. This is the main entry point for OXPs. |
||
− | For NPCs the standard range is < |
+ | For NPCs the standard range is <500, but OXP entities can have a lot higher value based on their settings. A standard Cobra MkIII has a value of ~100 in the beginning and gets up to >500 if fully equipped with standard weaponry, missiles and other standard equipment. The Boa Class Cruiser has even a bit more. |
− | + | *See [[#checkSpaceLane()|checkSpaceLane()]], [[#Table of Player Ships|Table of Player Ships]]. |
|
'''Parameters:''' |
'''Parameters:''' |
||
:;entity:Entity. If specified only this entity will be checked, otherwise all entities in the system (except the player). |
:;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. |
::Optional. |
||
+ | :;logging:Boolean. If true a verbose list will be logged to <tt>Latest.log</tt>. This is useful while writing OXPs. |
||
+ | ::Optional. |
||
+ | :;coef:Number. If specified the minimum threshold for returned coef. Unused if <tt>entity</tt> is specified. |
||
+ | ::Optional. Default 400. |
||
+ | :;location:Number - Bitmask. If used distance calculations are based on set bits. |
||
+ | ::Optional. Default 7. |
||
+ | :::Values: |
||
+ | :::*1 - Main Station, default |
||
+ | :::*2 - Witchpoint, default |
||
+ | :::*4 - Lane W->P, default |
||
+ | :::*8 - Lane P->S |
||
+ | :::*16 - Lane W->S |
||
'''Returns:''' |
'''Returns:''' |
||
:;coef:Number. Calculated coefficient. |
:;coef:Number. Calculated coefficient. |
||
− | ::If entity was specified the value for this specific entity, otherwise the highest |
+ | ::If <tt>entity</tt> was specified the value for this specific entity, otherwise the highest value in the system. |
=== checkEQs() === |
=== checkEQs() === |
||
− | {{CodeEx|codeex=worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkEQs(entity); }} |
+ | {{CodeEx|codeex=worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkEQs( entity ); }} |
{{CodeExTime|native=0.000423|extension=0.000032|js=0.000083}} |
{{CodeExTime|native=0.000423|extension=0.000032|js=0.000083}} |
||
− | Returns weighted |
+ | Returns weighted sum of installed equipment. |
'''Paramerters:''' |
'''Paramerters:''' |
||
Line 66: | Line 76: | ||
=== checkMissiles() === |
=== checkMissiles() === |
||
− | {{CodeEx|codeex=worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkMissiles(entity); }} |
+ | {{CodeEx|codeex=worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkMissiles( entity ); }} |
{{CodeExTime|native=0.000168|extension=0.000064|js=0.000124}} |
{{CodeExTime|native=0.000168|extension=0.000064|js=0.000124}} |
||
− | Returns weighted |
+ | Returns weighted sum of pylon mounted weapons. |
'''Parameters:''' |
'''Parameters:''' |
||
Line 84: | Line 94: | ||
=== checkSpaceLane() === |
=== checkSpaceLane() === |
||
− | {{CodeEx|codeex=worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkSpaceLane(entity); }} |
+ | {{CodeEx|codeex=worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkSpaceLane( entity, location ); }} |
{{CodeExTime|native=0.000550|extension=0.000260|js=0.000545}} |
{{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). |
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. |
||
+ | *See [[#checkPower()|checkPower()]]. |
||
'''Parameters:''' |
'''Parameters:''' |
||
:;entity:Entity. |
:;entity:Entity. |
||
+ | :;location:Number. |
||
+ | ::Optional. |
||
'''Returns:''' |
'''Returns:''' |
||
− | :;array:Array with the format [ID,distMS,distWP,distLWP,distLPS,distLWS]. |
+ | :;array:Array with the format [ID,distMS,distWP,distLWP,distLPS,distLWS]. Distances >50000 will be -1. |
::ID is |
::ID is |
||
− | :::* |
+ | :::*-2 - Nova system |
− | :::* |
+ | :::*-1 - Interstellar space |
− | :::* |
+ | :::*0 - standard system |
− | :::* |
+ | :::*1 - interstellar space, entities close to [0,0,0] |
− | + | :::*2 - standard system, entities close to checked locations |
|
=== checkWeapons() === |
=== checkWeapons() === |
||
Line 120: | Line 132: | ||
=== checkSubWeapons() === |
=== checkSubWeapons() === |
||
− | {{CodeEx|codeex=worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkSubWeapons(entity); }} |
+ | {{CodeEx|codeex=worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkSubWeapons( entity ); }} |
{{CodeExTime|native=0.000180|extension=0.000077|js=0.000132}} |
{{CodeExTime|native=0.000180|extension=0.000077|js=0.000132}} |
||
Returns array with values for weapons in subEntites. |
Returns array with values for weapons in subEntites. |
||
Line 141: | Line 153: | ||
Suggested classes: |
Suggested classes: |
||
− | * 1 = coef < |
+ | * 1 = coef < 300 |
− | * 2 = coef < |
+ | * 2 = coef < 400 - This is the default threshold for entities if <tt>logging</tt> is used. |
− | * 3 = coef < |
+ | * 3 = coef < 600 |
− | * 4 = coef < |
+ | * 4 = coef < 800 |
− | * 5 = coef < |
+ | * 5 = coef < 1000 |
− | * 6 = coef < |
+ | * 6 = coef < 1500 |
− | * 7 = coef < |
+ | * 7 = coef < 3000 |
− | * 8 = coef < |
+ | * 8 = coef < 5000 |
− | * 9 = otherwise, default setting for <tt> |
+ | * 9 = otherwise, default setting for <tt>CCL_OXPStrength</tt>. |
Line 158: | Line 170: | ||
− | == |
+ | == Table of Player Ships == |
A short overview about the values for native Oolite player-ships if fully equipped. OXP equipment and weaponry may add to the values and changed native ships (like in replacement sets) may change these values as well. The table is meant as rough orientation if OXPs want to base decisions on players strength. |
A short overview about the values for native Oolite player-ships if fully equipped. OXP equipment and weaponry may add to the values and changed native ships (like in replacement sets) may change these values as well. The table is meant as rough orientation if OXPs want to base decisions on players strength. |
||
Line 164: | Line 176: | ||
|-valign="top" bgcolor="#e7e7ff" |
|-valign="top" bgcolor="#e7e7ff" |
||
! valign="center" style="width: 150px;"|Ship |
! valign="center" style="width: 150px;"|Ship |
||
+ | ! valign="center" style="width: 150px;"|Standard (only Pulse Laser) |
||
! valign="center" style="width: 150px;"|Hardheads |
! valign="center" style="width: 150px;"|Hardheads |
||
! valign="center" style="width: 150px;"|QC-Mines |
! valign="center" style="width: 150px;"|QC-Mines |
||
|- |
|- |
||
|Adder |
|Adder |
||
− | |345 |
||
+ | |108 |
||
− | |350 |
||
+ | |375 |
||
+ | |380 |
||
|- |
|- |
||
|Anaconda |
|Anaconda |
||
− | |440 |
||
+ | |44 |
||
− | |572 |
||
+ | |335 |
||
+ | |417 |
||
|- |
|- |
||
|Asp Mark II |
|Asp Mark II |
||
− | |436 |
||
+ | |107 |
||
− | |441 |
||
+ | |400 |
||
+ | |404 |
||
|- |
|- |
||
|Boa |
|Boa |
||
− | |411 |
||
+ | |114 |
||
− | |492 |
||
+ | |428 |
||
+ | |479 |
||
|- |
|- |
||
|Boa Class Cruiser |
|Boa Class Cruiser |
||
− | |505 |
||
+ | |122 |
||
− | |580 |
||
+ | |516 |
||
+ | |590 |
||
|- |
|- |
||
|Cobra Mark I |
|Cobra Mark I |
||
− | |341 |
||
+ | |88 |
||
− | |346 |
||
+ | |298 |
||
+ | |306 |
||
|- |
|- |
||
|Cobra Mark III |
|Cobra Mark III |
||
− | |476 |
||
+ | |105 |
||
− | |527 |
||
+ | |470 |
||
+ | |517 |
||
|- |
|- |
||
|Fer-de-lance |
|Fer-de-lance |
||
− | |438 |
||
+ | |116 |
||
− | |483 |
||
+ | |482 |
||
+ | |499 |
||
|- |
|- |
||
|Moray Medical |
|Moray Medical |
||
− | |368 |
||
+ | |112 |
||
|384 |
|384 |
||
+ | |400 |
||
|- |
|- |
||
|Moray Star Boat |
|Moray Star Boat |
||
− | |439 |
||
+ | |112 |
||
− | |485 |
||
+ | |467 |
||
+ | |483 |
||
|- |
|- |
||
|Python |
|Python |
||
− | |351 |
||
+ | |85 |
||
− | |367 |
||
+ | |343 |
||
+ | |357 |
||
|} |
|} |
||
Revision as of 21:08, 8 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
- MaxPitch (v1.7.1)
- MaxRoll (v1.7.1)
- MaxSpeed
- MaxThrust
- Missiles
- PrimaryRole
- ShieldRechargeRates
- Subent laser
- Turrets
Functions
All profiled times are only for gathering infos for a fully equipped player ship.
checkPower()
worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkPower( entity, logging, coef, location ); |
Profiler | |
---|---|
Native | 0.001295s |
Extension | 0.000488s |
JS | 0.000807s |
Checks entities and returns the gathered coefficient. This is the main entry point for OXPs.
For NPCs the standard range is <500, but OXP entities can have a lot higher value based on their settings. A standard Cobra MkIII has a value of ~100 in the beginning and gets up to >500 if fully equipped with standard weaponry, missiles and other standard equipment. The Boa Class Cruiser has even a bit more.
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 list will be logged to Latest.log. This is useful while writing OXPs.
- Optional.
- coef
- Number. If specified the minimum threshold for returned coef. Unused if entity is specified.
- Optional. Default 400.
- location
- Number - Bitmask. If used distance calculations are based on set bits.
- Optional. Default 7.
- Values:
- 1 - Main Station, default
- 2 - Witchpoint, default
- 4 - Lane W->P, default
- 8 - Lane P->S
- 16 - Lane W->S
- Values:
Returns:
- coef
- Number. Calculated coefficient.
- If entity was specified the value for this specific entity, otherwise the highest value in the system.
checkEQs()
worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkEQs( entity ); |
Profiler | |
---|---|
Native | 0.000423s |
Extension | 0.000032s |
JS | 0.000083s |
Returns weighted sum of installed equipment.
Paramerters:
- entity
- Entity.
Returns:
- value
- Number. Summed value for all installed equipment.
- Every equipment adds based on tokens
- 35 - naval, military, jammer, laser
- 30 - energy, shield, boost, cloak
- 25 - turret, missile, mine
- 20 - hide, eeu, rack
- 10 - ecm, target
checkMissiles()
worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkMissiles( entity ); |
Profiler | |
---|---|
Native | 0.000168s |
Extension | 0.000064s |
JS | 0.000124s |
Returns weighted sum of pylon mounted weapons.
Parameters:
- entity
- Entity.
Returns:
- value
- Number. Summed value for all mounted pylons.
- Every pylon mounted missile or mine adds based on tokens
- 5 - naval, boost, military, cascade
- 4 - harpoon, intercept, nuke, law, frag, bomb
- 3 - mine, stun, override, jammer, drone, guard, field
- 2 - hard, ecm, rack, launcher, ams
- 1 - otherwise
checkSpaceLane()
worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkSpaceLane( entity, location ); |
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).
- See checkPower().
Parameters:
- entity
- Entity.
- location
- Number.
- Optional.
Returns:
- array
- Array with the format [ID,distMS,distWP,distLWP,distLPS,distLWS]. Distances >50000 will be -1.
- ID is
- -2 - Nova system
- -1 - Interstellar space
- 0 - standard system
- 1 - interstellar space, entities close to [0,0,0]
- 2 - standard system, entities close to checked locations
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
checkSubWeapons()
worldScripts.Cabal_Common_OXPStrength.checkOXPStrength.checkSubWeapons( entity ); |
Profiler | |
---|---|
Native | 0.000180s |
Extension | 0.000077s |
JS | 0.000132s |
Returns array with values for weapons in subEntites.
Parameters:
- entity
- Entity.
Returns:
- array
- Array with the format [Number of Turrets, Number of slots, sum, typestring]. typestring is concatenated string of sum, but exclusive turrets (e.g. "1111").
- See checkWeapons()
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 < 300
- 2 = coef < 400 - This is the default threshold for entities if logging is used.
- 3 = coef < 600
- 4 = coef < 800
- 5 = coef < 1000
- 6 = coef < 1500
- 7 = coef < 3000
- 8 = coef < 5000
- 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;} |
Table of Player Ships
A short overview about the values for native Oolite player-ships if fully equipped. OXP equipment and weaponry may add to the values and changed native ships (like in replacement sets) may change these values as well. The table is meant as rough orientation if OXPs want to base decisions on players strength.
Ship | Standard (only Pulse Laser) | Hardheads | QC-Mines |
---|---|---|---|
Adder | 108 | 375 | 380 |
Anaconda | 44 | 335 | 417 |
Asp Mark II | 107 | 400 | 404 |
Boa | 114 | 428 | 479 |
Boa Class Cruiser | 122 | 516 | 590 |
Cobra Mark I | 88 | 298 | 306 |
Cobra Mark III | 105 | 470 | 517 |
Fer-de-lance | 116 | 482 | 499 |
Moray Medical | 112 | 384 | 400 |
Moray Star Boat | 112 | 467 | 483 |
Python | 85 | 343 | 357 |