Files
VOREStation/code/modules/scripting/Options.dm
Cadyn cc05d51b69 Garbage collection, asset delivery, icon2html revolution, and general fixes (515) (#15739)
* Making it compileable

* Adds Tracy & Fixed missing compat in sorting code

* CI workflow using "Stable" beta version

* Tracy define

* Fixes

* Update GC from TGStation

* fixes

* Appease linter

* begone custom_items.txt

* Making it compileable

* Adds Tracy & Fixed missing compat in sorting code

* CI workflow using "Stable" beta version

* Tracy define

* Fixes

* Build dependencies at 514

* Asset delivery/GC/515 megapatch

* fix runtime

* Appease integration tests

* More runtime fixes

* Attempting to resolve runtime

* Update spacemanDMM

* icon2html revolution

* icon2html part 2

* fixes

* Attempt to appease linter

* More fixes

* Final fixes (hopefully)

* operator keyword moment

* minor fixes and additions

* undo extra tgui files

* switch to QDEL_IN_STOPPABLE where necessary

* Pain

* GPS runtime

* dropped(null) fix, + chompedit the fixes just incase.

* Fix chat tags

* Update _build_dependencies.sh

* runtime in orebag, duplicate in computer/ship/proc/look, runtime in zoom

* tweak zoom change

* another registersignal override runtime

* 1

* Revert "1"

This reverts commit 43f619ca6c216c2bc41b8f7a346069f99591261b.

* various qdel ref fixes

* newplayer and observer harddels

* disposalholder logging remove, gargoyle hard del + typo

* retouch atom/movable destroy to be TG-like

* potential edge case ref in manualfollow

* extra following potential ref

* global list refs tweak, new_player undo a thing

* /mob/new_player qdel fixes

* undo some things

* revert atoms/movable/destroy

* revert mind and new_player panel changes

* atoms and atom/movable reversions

* bring back datum/mind and panel fixes

* projectile optimisation

* Reverts useless edits, clothing hood runtime, projectile runtime

I tried a lot of things which do not help, and i reverted a lot of it here.

* a few more reversions of useless changes

* Begin getting rid of CHOMPedit comments

* Nuke remaining chompedit comments

* Revert "undo extra tgui files"

This reverts commit f3bdcde8cb.

* fixing oops

* line ending shenanigans

* More GC cleanup

* Optimisations to test/trace projectile, turrets. Tweaks.

Turrets now only trace when they are absolutely sure they want to shoot. disposalholder, effect master and artefact qdel refs changes.

* bad usage of the check_trajectory proc

check_trajectory returns a list of objects hit along it's path to it's target, not a boolean of the target being hittable. a couple places in code assume this, so here they are fixed.

* puts legacy globals into GLOB datum for debug use

* fix upport oopsie

* fix

* Move recursive listening to component

* Minor fixes and cleanup

* undo my temp solution

* tweaks + a missed thing

* recursive_move sanity checks and safety cases

* Catch null initialisation cases + fix borg creation

VV edit spawns the object in nullspace then directly sets it's loc, which means the movement is unregistered. The spawn(0) delay should hopefully mean that setup_parents happens AFTER any unregistered movement.

* circular inventory check, make checks better

* better handling of safety reset cases

* Add logging to safety checks

---------

Co-authored-by: Selis <selis@xynolabs.com>
Co-authored-by: Selis <sirlionfur@hotmail.de>
Co-authored-by: Raeschen <rycoop29@gmail.com>
2024-03-10 09:39:33 +10:00

101 lines
3.3 KiB
Plaintext

/*
File: Options
*/
var/const //Ascii values of characters
ascii_A =65
ascii_Z =90
ascii_a =97
ascii_z =122
ascii_DOLLAR = 36 // $
ascii_ZERO=48
ascii_NINE=57
ascii_UNDERSCORE=95 // _
/*
Class: n_scriptOptions
*/
/n_scriptOptions/proc/CanStartID(char) //returns true if the character can start a variable, function, or keyword name (by default letters or an underscore)
if(!isnum(char))char=text2ascii(char)
return (char in ascii_A to ascii_Z) || (char in ascii_a to ascii_z) || char==ascii_UNDERSCORE || char==ascii_DOLLAR
/n_scriptOptions/proc/IsValidIDChar(char) //returns true if the character can be in the body of a variable, function, or keyword name (by default letters, numbers, and underscore)
if(!isnum(char))char=text2ascii(char)
return CanStartID(char) || IsDigit(char)
/n_scriptOptions/proc/IsDigit(char)
if(!isnum(char))char=text2ascii(char)
return char in ascii_ZERO to ascii_NINE
/n_scriptOptions/proc/IsValidID(id) //returns true if all the characters in the string are okay to be in an identifier name
if(!CanStartID(id)) //don't need to grab first char in id, since text2ascii does it automatically
return 0
if(length(id)==1) return 1
for(var/i=2 to length(id))
if(!IsValidIDChar(copytext(id, i, i+1)))
return 0
return 1
/*
Class: nS_Options
An implementation of <n_scriptOptions> for the n_Script language.
*/
/n_scriptOptions/nS_Options
var/list/symbols = list("(", ")", "\[", "]", ";", ",", "{", "}") //scanner - Characters that can be in symbols
/*
Var: keywords
An associative list used by the parser to parse keywords. Indices are strings which will trigger the keyword when parsed and the
associated values are <nS_Keyword> types of which the <n_Keyword.Parse()> proc will be called.
*/
var/list/keywords = list(
"if" = /n_Keyword/nS_Keyword/kwIf,
"else" = /n_Keyword/nS_Keyword/kwElse,
"while" = /n_Keyword/nS_Keyword/kwWhile,
"break" = /n_Keyword/nS_Keyword/kwBreak,
"continue" = /n_Keyword/nS_Keyword/kwContinue,
"return" = /n_Keyword/nS_Keyword/kwReturn,
"def" = /n_Keyword/nS_Keyword/kwDef
)
var/list/assign_operators = list(
"=" = null,
"&=" = "&",
"|=" = "|",
"`=" = "`",
"+=" = "+",
"-=" = "-",
"*=" = "*",
"/=" = "/",
"^=" = "^",
"%=" = "%"
)
var/list/unary_operators =list(
"!" = /node/expression/op/unary/LogicalNot,
"~" = /node/expression/op/unary/BitwiseNot,
"-" = /node/expression/op/unary/Minus
)
var/list/binary_operators=list(
"==" = /node/expression/op/binary/Equal,
"!=" = /node/expression/op/binary/NotEqual,
">" = /node/expression/op/binary/Greater,
"<" = /node/expression/op/binary/Less,
">=" = /node/expression/op/binary/GreaterOrEqual,
"<=" = /node/expression/op/binary/LessOrEqual,
"&&" = /node/expression/op/binary/LogicalAnd,
"||" = /node/expression/op/binary/LogicalOr,
"&" = /node/expression/op/binary/BitwiseAnd,
"|" = /node/expression/op/binary/BitwiseOr,
"`" = /node/expression/op/binary/BitwiseXor,
"+" = /node/expression/op/binary/Add,
"-" = /node/expression/op/binary/Subtract,
"*" = /node/expression/op/binary/Multiply,
"/" = /node/expression/op/binary/Divide,
"^" = /node/expression/op/binary/Power,
"%" = /node/expression/op/binary/Modulo)
/n_scriptOptions/nS_Options/New()
.=..()
for(var/O in assign_operators+binary_operators+unary_operators)
if(!symbols.Find(O)) symbols+=O