Skip to content

Commit

Permalink
Added some utility functions + minor changes
Browse files Browse the repository at this point in the history
New functions: toggleLayer, distance3D, formatTime, getDevInfo
  • Loading branch information
fodi committed Oct 22, 2024
1 parent 36a2867 commit dd2943f
Show file tree
Hide file tree
Showing 9 changed files with 309 additions and 42 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "aEnemies 👾",
"name": "_aEnemies 👾",
"events": [],
"sid": 878190083165609
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,94 @@
}
]
},
{
"functionName": "toggleLayer",
"functionDescription": "",
"functionCategory": "",
"functionReturnType": "none",
"functionCopyPicked": false,
"functionIsAsync": false,
"functionParameters": [
{
"name": "layerName",
"type": "string",
"initialValue": "",
"comment": "",
"sid": 383761321401365
}
],
"eventType": "function-block",
"conditions": [],
"actions": [],
"sid": 725868792420929,
"children": [
{
"eventType": "block",
"conditions": [
{
"id": "layer-is-visible",
"objectClass": "System",
"sid": 908801748603377,
"parameters": {
"layer": "layerName"
}
}
],
"actions": [
{
"id": "set-layer-visible",
"objectClass": "System",
"sid": 281814701868354,
"parameters": {
"layer": "layerName",
"visibility": "invisible"
}
},
{
"id": "set-layer-interactive",
"objectClass": "System",
"sid": 157471086757443,
"parameters": {
"layer": "layerName",
"interactive": false
}
}
],
"sid": 922971262908364
},
{
"eventType": "block",
"conditions": [
{
"id": "else",
"objectClass": "System",
"sid": 739332937534315
}
],
"actions": [
{
"id": "set-layer-visible",
"objectClass": "System",
"sid": 137848120911428,
"parameters": {
"layer": "layerName",
"visibility": "visible"
}
},
{
"id": "set-layer-interactive",
"objectClass": "System",
"sid": 186163961158381,
"parameters": {
"layer": "layerName",
"interactive": true
}
}
],
"sid": 899862841752459
}
]
},
{
"functionName": "mapValue",
"functionDescription": "",
Expand Down Expand Up @@ -171,7 +259,7 @@
"sid": 875967104905781
},
{
"functionName": "berp",
"functionName": "expDecay",
"functionDescription": "",
"functionCategory": "",
"functionReturnType": "number",
Expand Down Expand Up @@ -279,6 +367,177 @@
"sid": 117563489929905
}
]
},
{
"functionName": "distance3D",
"functionDescription": "",
"functionCategory": "",
"functionReturnType": "number",
"functionCopyPicked": false,
"functionIsAsync": false,
"functionParameters": [
{
"name": "x1",
"type": "number",
"initialValue": "0",
"comment": "",
"sid": 590421255056591
},
{
"name": "y1",
"type": "number",
"initialValue": "0",
"comment": "",
"sid": 643921034614564
},
{
"name": "z1",
"type": "number",
"initialValue": "0",
"comment": "",
"sid": 121037892189490
},
{
"name": "x2",
"type": "number",
"initialValue": "0",
"comment": "",
"sid": 511290319926693
},
{
"name": "y2",
"type": "number",
"initialValue": "0",
"comment": "",
"sid": 988772735295340
},
{
"name": "z2",
"type": "number",
"initialValue": "0",
"comment": "",
"sid": 356084965613438
}
],
"eventType": "function-block",
"conditions": [],
"actions": [
{
"id": "set-function-return-value",
"objectClass": "Functions",
"sid": 268312568073306,
"parameters": {
"value": "sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2)"
}
}
],
"sid": 603412078347250
},
{
"functionName": "formatTime",
"functionDescription": "",
"functionCategory": "",
"functionReturnType": "string",
"functionCopyPicked": false,
"functionIsAsync": false,
"functionParameters": [
{
"name": "seconds",
"type": "number",
"initialValue": "0",
"comment": "",
"sid": 522193307353509
}
],
"eventType": "function-block",
"conditions": [],
"actions": [],
"sid": 905055554994244,
"children": [
{
"eventType": "variable",
"name": "hours",
"type": "number",
"initialValue": "0",
"comment": "",
"isStatic": false,
"isConstant": false,
"sid": 702372864472884
},
{
"eventType": "variable",
"name": "minutes",
"type": "number",
"initialValue": "0",
"comment": "",
"isStatic": false,
"isConstant": false,
"sid": 873362813365633
},
{
"eventType": "block",
"conditions": [],
"actions": [
{
"id": "set-eventvar-value",
"objectClass": "System",
"sid": 923326540158736,
"parameters": {
"variable": "hours",
"value": "seconds / 3600"
}
},
{
"id": "set-eventvar-value",
"objectClass": "System",
"sid": 790445611546321,
"parameters": {
"variable": "minutes",
"value": "seconds / 60"
}
},
{
"id": "set-function-return-value",
"objectClass": "Functions",
"sid": 454702085137188,
"parameters": {
"value": "(hours >= 1 ? int(hours) & \":\" : \"\") & (minutes >= 1 ? zeropad(int(minutes), 2) & \":\" : \"\") & zeropad((seconds % 60), 2)"
}
}
],
"sid": 456305179917809
}
]
},
{
"functionName": "getDevInfo",
"functionDescription": "",
"functionCategory": "",
"functionReturnType": "string",
"functionCopyPicked": false,
"functionIsAsync": false,
"functionParameters": [
{
"name": "divider",
"type": "string",
"initialValue": " | ",
"comment": "",
"sid": 843055132204122
}
],
"eventType": "function-block",
"conditions": [],
"actions": [
{
"id": "set-function-return-value",
"objectClass": "Functions",
"sid": 956911014940082,
"parameters": {
"value": "StringSub(\"Build {1}{0}{2} FPS{0}{3} CPU{0}{4}% GPU{0}{5}% objects\", divider, projectversion, fps, round(cpuutilisation * 100), round(gpuutilisation * 100), objectcount)"
}
}
],
"sid": 562801702725526
}
],
"sid": 622480337843055
Expand Down
Original file line number Diff line number Diff line change
@@ -1,47 +1,43 @@
{
"name": "vMacros 🗃️",
"events": [
{
"eventType": "variable",
"name": "NOTHING",
"type": "number",
"initialValue": "-1",
"comment": "",
"isStatic": false,
"isConstant": true,
"sid": 995028409310032
},
{
"eventType": "variable",
"name": "NO",
"type": "number",
"initialValue": "0",
"comment": "",
"isStatic": false,
"isConstant": true,
"sid": 346906574628140
},
{
"eventType": "variable",
"name": "YES",
"type": "number",
"initialValue": "1",
"comment": "",
"isStatic": false,
"isConstant": true,
"sid": 499582822760795
},
{
"eventType": "group",
"disabled": false,
"title": "Templates",
"description": "",
"isActiveOnStart": false,
"children": [
{
"eventType": "comment",
"text": "Basics"
},
{
"eventType": "variable",
"name": "NOTHING",
"type": "number",
"initialValue": "-1",
"comment": "",
"isStatic": false,
"isConstant": true,
"sid": 458778205145273
},
{
"eventType": "variable",
"name": "NO",
"type": "number",
"initialValue": "0",
"comment": "",
"isStatic": false,
"isConstant": true,
"sid": 714189115847289
},
{
"eventType": "variable",
"name": "YES",
"type": "number",
"initialValue": "1",
"comment": "",
"isStatic": false,
"isConstant": true,
"sid": 839259088565645
},
{
"eventType": "comment",
"text": "Animations"
Expand Down
4 changes: 4 additions & 0 deletions projectfolders/BlankTemplate/layouts/#ObjectTemplates.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
"global": false
}
],
"scene-graphs-folder-root": {
"items": [],
"subfolders": []
},
"sid": 281279063636915,
"nonworld-instances": [],
"effectTypes": [],
Expand Down
4 changes: 4 additions & 0 deletions projectfolders/BlankTemplate/layouts/Level.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
"global": false
}
],
"scene-graphs-folder-root": {
"items": [],
"subfolders": []
},
"sid": 188382131432771,
"nonworld-instances": [],
"effectTypes": [],
Expand Down
Loading

0 comments on commit dd2943f

Please sign in to comment.