Pixel-Composer/scripts/node_array_reverse/node_array_reverse.gml

32 lines
912 B
Text
Raw Normal View History

2023-02-28 09:43:01 +01:00
function Node_Array_Reverse(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
2024-03-28 14:18:02 +01:00
name = "Array Reverse";
setDimension(96, 32 + 24);
2023-02-14 02:48:33 +01:00
2024-08-20 10:15:53 +02:00
newInput(0, nodeValue("Array", self, CONNECT_TYPE.input, VALUE_TYPE.any, 0))
2023-02-14 02:48:33 +01:00
.setVisible(true, true);
2024-08-08 06:57:51 +02:00
outputs[0] = nodeValue_Output("Array", self, VALUE_TYPE.any, 0);
2023-02-14 02:48:33 +01:00
2023-10-09 16:07:33 +02:00
static update = function(frame = CURRENT_FRAME) {
var _arr = getInputData(0);
2023-02-14 02:48:33 +01:00
2024-08-08 06:57:51 +02:00
inputs[0].setType(VALUE_TYPE.any);
outputs[0].setType(VALUE_TYPE.any);
2023-02-14 02:48:33 +01:00
if(!is_array(_arr)) return;
2024-08-08 06:57:51 +02:00
if(inputs[0].value_from != noone) {
var type = inputs[0].value_from.type;
inputs[0].setType(type);
outputs[0].setType(type);
2023-02-14 02:48:33 +01:00
}
2023-09-14 16:29:39 +02:00
_arr = array_reverse(_arr);
2024-08-08 06:57:51 +02:00
outputs[0].setValue(_arr);
2023-02-14 02:48:33 +01:00
}
2023-03-05 07:16:44 +01:00
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
2023-02-14 02:48:33 +01:00
var bbox = drawGetBbox(xx, yy, _s);
draw_sprite_fit(s_node_array_reverse, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
}
}