Actually add the syntax highlighting for PyCharm..

This commit is contained in:
Casper V. Kristensen 2018-08-05 19:45:56 +02:00
parent 32852274cc
commit 7c2e925454
Signed by: caspervk
GPG key ID: B1156723DB3BDDA8
3 changed files with 119 additions and 4 deletions

115
kOS.xml Normal file
View file

@ -0,0 +1,115 @@
<filetype binary="false" description="Kerbal Operating System" name="kOS">
<highlighting>
<options>
<option name="LINE_COMMENT" value="//" />
<option name="COMMENT_START" value="" />
<option name="COMMENT_END" value="" />
<option name="HEX_PREFIX" value="" />
<option name="NUM_POSTFIXES" value="" />
<option name="HAS_BRACES" value="true" />
<option name="HAS_BRACKETS" value="true" />
<option name="HAS_PARENS" value="true" />
</options>
<!-- Keyword 1: Language syntax -->
<!--Logic Operators -->
<keywords keywords="not;and;or;true;false" ignore_case="false" />
<!-- Instructions and keywords -->
<keywords keywords="add;all;batch;break;compile;copy;declare;delete;deploy;do;else;file;for;from;function;global;if;in;is;list;local;lock;log;off;on;once;parameter;preserve;remove;rename;return;run;set;step;switch;then;to;toggle;unlock;unset;until;wait;when"/>
<!-- Directives -->
<keywords keywords="@LAZYGLOBAL" />
<!-- Keyword 2: Global variables that "belong" to the current ship -->
<!-- Flight Control -->
<keywords2 keywords="STEERING;THROTTLE;WHEELSTEERING;WHEELTHROTTLE" />
<!-- Alias shortcuts for SHIP fields -->
<keywords2 keywords="BODY;ORBIT;HEADING;PROGRADE;RETROGRADE;FACING;MAXTHRUST;VELOCITY;GEOPOSITION;LATITUDE;LONGITUDE;UP;NORTH;ANGULARMOMENTUM;ANGULARVEL;ANGULARVELOCITY;MASS;VERTICALSPEED;GROUNDSPEED;SURFACESPEED;AIRSPEED;ALTITUDE;APOAPSIS;PERIAPSIS;SENSORS;SRFPROGRADE;SRFREROGRADE;OBT;STATUS;SHIPNAME" />
<!-- Ship Systems -->
<keywords2 keywords="RCS;SAS;SASMODE;NAVMODE;LIGHTS;BRAKES;GEAR;ABORT;AG1;AG2;AG3;AG4;AG5;AG6;AG7;AG8;AG9;AG10;LEGS;CHUTES;CHUTESSAFE;PANELS;RADIATORS;LADDERS;BAYS;DEPLOYDRILLS;DRILLS;FUELCELLS;ISRU;INTAKES" />
<!-- Connectivity Managers -->
<keywords2 keywords="HOMECONNECTION;CONTROLCONNECTION" />
<!-- Listable Keywords -->
<keywords2 keywords="PROCESSORS;RESOURCES;PARTS;ENGINES;SENSORS;ELEMENTS;DOCKINGPORTS" />
<keywords2 keywords="FILES;VOLUMES" />
<!-- Keyword 3: Language functions and globals -->
<!-- Basic Functions -->
<keywords3 keywords="clearscreen;edit;print;at;reboot;shutdown" />
<!-- Basic Math Functions -->
<keywords3 keywords="CONSTANT" />
<keywords3 keywords="abs;ceiling;floor;ln;log10;mod;min;max;random;round;round;sqrt;char;unchar;sin;cos;tan;arcsin;arccos;arctan;arctan2" />
<!-- Vector Functions -->
<keywords3 keywords="v;vdot;vectordotproduct;vcrs;vectorcrossproduct;vang;vectorangle;vxcl;vectorexclude" />
<!-- Direction Functions -->
<keywords3 keywords="r;q;heading;lookdirup;angleaxis;rotatefromto" />
<!-- Geographic Coordinate Functions -->
<keywords3 keywords="latlng" />
<!-- Predictions of Flight Path Functions -->
<keywords3 keywords="positionat;velocityat;orbitat" />
<!-- File I/O Functions -->
<keywords3 keywords="path;scriptpath;volume;cd;copypath;movepath;deletepath;exists;create;createdir;open;writejson;readjson" />
<!-- Color Functions -->
<keywords3 keywords="rgb;rgba;hsv;hsva" />
<!-- Waypoint Functions -->
<keywords3 keywords="waypoint;allwaypoints" />
<!-- GUI Widget Functions -->
<keywords3 keywords="gui;clearguis" />
<!-- GUI display tool functions -->
<keywords3 keywords="vecdraw;vecdrawargs;hudtext;clearvecdraws" />
<!-- Various Functions -->
<keywords3 keywords="vessel;NODE" />
<!-- Global Structures -->
<keywords3 keywords="LEXICON;LIST;QUEUE;RANGE;STACK;UNIQUESET" />
<!-- Colors -->
<keywords3 keywords="RED;GREEN;BLUE;YELLOW;CYAN;MAGENTA;PURPLE;WHITE;BLACK" />
<!-- Keyword 4: Global meta-variables -->
<!-- Vessel -->
<keywords4 keywords="SHIP;TARGET;HASTARGET" />
<!-- Listable Keywords -->
<keywords4 keywords="BODIES;TARGETS" />
<!-- Predefined Celestial Bodies -->
<keywords4 keywords="SUN;MOHO;EVE;GILLY;KERBIN;MUN;MINMUS;DUNA;IKE;JOOL;LAYTHE;VALL;TYLO;BOP;POL;EELOO" />
<!-- System Variables -->
<keywords4 keywords="CONFIG;KUNIVERSE;TERMINAL;CORE;ARCHIVE;STAGE;NEXTNODE;HASNODE;ALLNODES;ALT;ETA;ENCOUNTER;TIME;MISSIONTIME;VERSION;MAPVIEW;WARP;WARPMODE;LOADDISTANCE;SOLARPRIMEVECTOR" />
</highlighting>
<extensionMap>
<mapping ext="ks" />
</extensionMap>
</filetype>

View file

@ -91,7 +91,7 @@ function launch {
// Create maneuver node that will circularize the orbit.
// NOTE: Potential errors in the inclination are not fixed, since we are most likely going to change our orbit, which will make the inclination change cheaper later on.
local node is node(TIME:SECONDS + ETA:APOAPSIS, 0, 0, 0).
local node is NODE(TIME:SECONDS + ETA:APOAPSIS, 0, 0, 0).
// Burn magnitude in the prograde direction is the difference between the required velocity to acheive circular orbit at apoapsis altitude and our velocity at apoapsis
local required_velocity is orbital_velocity_from_ap_pe(APOAPSIS, APOAPSIS, target_orbit_altitude).

View file

@ -35,17 +35,17 @@ function execute_node {
wait until vang(SHIP:facing:vector, node:deltav) < 0.5.
print "Initializing warp".
warp_for(MAX(0, node:eta - (burn_duration/2) - 5)). // warp until 5s before node
warp_for(max(0, node:eta - (burn_duration/2) - 5)). // warp until 5s before node
print "Approaching".
wait until node:eta <= CEILING(burn_duration/2). // CEILING instead of ROUND, since we'd rather start the burn too soon to have time for perfecting the burn
wait until node:eta <= ceiling(burn_duration/2). // CEILING instead of ROUND, since we'd rather start the burn too soon to have time for perfecting the burn
print "Burn!".
lock THROTTLE to 1.0.
// Decrease throttle linearly when the burn duration is less than 1 second
wait until estimated_burn_duration(node) <= 1.
lock THROTTLE to MAX(0.01, estimated_burn_duration(node)). // ensure we always finish by burning with at least 1% power
lock THROTTLE to max(0.01, estimated_burn_duration(node)). // ensure we always finish by burning with at least 1% power
// The burn vector will start to drift once we have very little left to burn. Therefore, take a "snapshot" of the burn vector as it is right now, and lock steering to it, instead of the dynamic vector
local dv0 is node:deltav.