This commit is contained in:
MakhamDev 2023-10-01 13:37:54 +07:00
parent ff566da654
commit ccaee3ae36
2 changed files with 17 additions and 10 deletions

View File

@ -24,9 +24,10 @@ function __part(_node) constructor {
turning = 0;
turnSpd = 0;
accel = 0;
wig = 0;
spVec = [ 0, 0 ];
accel = 0;
spVec = [ 0, 0 ];
wig_pos = 0;
boundary_data = -1;
@ -77,7 +78,7 @@ function __part(_node) constructor {
node.onPartCreate(self);
}
static setPhysic = function(_sx, _sy, _ac, _g, _gDir, _wig, _turn, _turnSpd) {
static setPhysic = function(_sx, _sy, _ac, _g, _gDir, _wig_pos, _turn, _turnSpd) {
speedx = _sx;
speedy = _sy;
accel = _ac;
@ -89,7 +90,7 @@ function __part(_node) constructor {
turning = _turn;
turnSpd = _turnSpd;
wig = _wig;
wig_pos = _wig_pos;
spVec[0] = point_distance(0, 0, speedx, speedy);
spVec[1] = point_direction(0, 0, speedx, speedy);
@ -146,8 +147,8 @@ function __part(_node) constructor {
diss = max(0, diss + accel);
if(speedx != 0 || speedy != 0) {
if(wig != 0)
dirr += random_range(-wig, wig);
if(wig_pos != 0)
dirr += random_range(-wig_pos, wig_pos);
if(turning != 0) {
var trn = turnSpd? turning * diss : turning;

View File

@ -501,7 +501,7 @@ function Node_Vector_Split(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
previewable = false;
w = 96;
min_h = 32 + 24 * 4;
min_h = 32;
draw_padding = 4;
inputs[| 0] = nodeValue("Vector", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0, 0 ])
@ -520,7 +520,7 @@ function Node_Vector_Split(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
type = VALUE_TYPE.integer;
inputs[| 0].type = type;
for( var i = 0; i < 4; i++ )
for( var i = 0; i < 4; i++ )
outputs[| i].type = type;
}
@ -530,7 +530,13 @@ function Node_Vector_Split(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
draw_set_text(f_h1, fa_center, fa_center, COLORS._main_text);
var str = $"{outputs[| 0].getValueCached()}\n{outputs[| 1].getValueCached()}\n{outputs[| 2].getValueCached()}\n{outputs[| 3].getValueCached()}";
var str = "";
for( var i = 0; i < 4; i++ ) {
if(outputs[| i].visible)
str += $"{outputs[| 0].getValueCached()}\n";
}
str = string_trim(str);
var bbox = drawGetBbox(xx, yy, _s);
var ss = string_scale(str, bbox.w, bbox.h);
draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0);