Pixel-Composer/scripts/node_smoke_update/node_smoke_update.gml

38 lines
1.1 KiB
Text
Raw Normal View History

2024-03-19 15:49:29 +07:00
function Node_Smoke_Update(_x, _y, _group = noone) : Node_Smoke(_x, _y, _group) constructor {
2023-02-14 08:48:33 +07:00
name = "Update Fluid";
2023-11-10 17:32:46 +07:00
color = COLORS.node_blend_smoke;
icon = THEME.smoke_sim;
2024-03-28 20:18:02 +07:00
setDimension(96, 96);
2023-02-14 08:48:33 +07:00
manual_ungroupable = false;
2024-08-20 15:15:53 +07:00
newInput(0, nodeValue("Domain", self, CONNECT_TYPE.input, VALUE_TYPE.sdomain, noone))
2023-02-14 08:48:33 +07:00
.setVisible(true, true);
2024-08-18 11:16:20 +07:00
newInput(1, nodeValue_Bool("Active", self, true));
2023-02-14 08:48:33 +07:00
input_display_list = [
["Domain", false], 0,
["Update", false], 1,
]
2024-09-04 08:57:11 +07:00
newOutput(0, nodeValue_Output("Domain", self, VALUE_TYPE.sdomain, noone));
2023-02-14 08:48:33 +07:00
2023-10-09 21:07:33 +07:00
static update = function(frame = CURRENT_FRAME) {
2023-07-06 19:49:16 +02:00
if(!PROJECT.animator.is_playing) return;
2023-03-02 13:59:14 +07:00
2024-08-08 11:57:51 +07:00
var _dom = inputs[0].getValue(frame);
var _act = inputs[1].getValue(frame);
2023-10-07 14:09:18 +07:00
2024-11-21 18:07:07 +07:00
SMOKE_DOMAIN_CHECK
2024-08-08 11:57:51 +07:00
outputs[0].setValue(_dom);
2023-02-14 08:48:33 +07:00
2024-11-21 18:07:07 +07:00
if(_act) _dom.update();
2023-02-14 08:48:33 +07:00
}
2023-03-05 13:16:44 +07:00
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
2023-02-14 08:48:33 +07:00
var bbox = drawGetBbox(xx, yy, _s);
var _act = getInputData(1);
2023-11-10 17:32:46 +07:00
draw_sprite_fit(_act? s_node_smokeSim_update : s_node_smokeSim_update_paused, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
2023-02-14 08:48:33 +07:00
}
}