Follow specified rules in .editorconfig
, or use an extension to automatically apply them.
Don't type a new line for a curly bracket. Don't put semicolons on curly brackets.
Long generic type parameter lists & class extend clauses can be on a new line to be readable.
When adding files to a folder such as codeblocks
or core/types
for example, check for an index.ts
file that might
contain export some stuff to be usable by the user when importing the sparkscript package.
For creating new values/codeblocks, you have you append it's type into the respective file in the types
folder..
Files that are prefixed with "DF
" or "MC
" are all located in the core/types/
folder.
Firstly go to DFValueCodename
and DFValueType
and append the value's codename and class type there.
Registering new values is a bit complicated but makes sense.
- In
DFValueDataType
add the type of value's data structure,
for example: DiamondFire's text value has the type of{ name: string }
as it's data structure. - You can finally go to the
mapperUtils
file found at thecommon
folder, find thevalueMap
object and add your own constructor there based on the input,
the type of the input isRawDFValueDataRecord<T>
where you replaceT
with the value's type of data structure that added toDFValueDataType
at step 1. - You can take example from the already made values if you didn't understand (i don't blame you).
You must select a block with an ID of block
because the bracket
block is already implemented..
- Put the block's codename in
DFBlockCodename
. - Identify the type of the block,
if it has adata
property then it is aDataBlock
,
if it hassubAction
andaction
properties then it is aSubActionBlock
,
otherwise it's anActionBlock
or aConditionalBlock
.
All ofDataBlock
,ActionBlock
,SubActionBlock
&ConditionalBlock
can be found atcore/components/
. - Implement the codeblock using the appropriate block type and codename with the respective type parameters.
- Go to the
mapperUtils
file found at thecommon
folder, find theblockMap
object and add your own constructor based on the input,
you can take examples from the already implemented and mapped blocks..
You can always open an issue for any problems you encounter or questions.