wtf it works

This commit is contained in:
the me 2022-08-16 15:39:22 -07:00
parent 641ccd1065
commit aa747e8305
9 changed files with 48 additions and 14 deletions

View File

@ -51,6 +51,7 @@
{"id":{"name":"song","path":"scripts/song/song.yy",},"order":1,},
{"id":{"name":"cpp","path":"scripts/cpp/cpp.yy",},"order":1,},
{"id":{"name":"log","path":"scripts/log/log.yy",},"order":10,},
{"id":{"name":"c_fulleval","path":"scripts/c_fulleval/c_fulleval.yy",},"order":18,},
{"id":{"name":"keyboard_check_advanced","path":"scripts/keyboard_check_advanced/keyboard_check_advanced.yy",},"order":8,},
{"id":{"name":"collision_line_width","path":"scripts/collision_line_width/collision_line_width.yy",},"order":9,},
{"id":{"name":"draw_rectangle_width","path":"scripts/draw_rectangle_width/draw_rectangle_width.yy",},"order":7,},

View File

@ -4,9 +4,11 @@ var i;
c_inheritunit(2+i, 2, un.chara);
}*/
var chara = c_inheritunit(8, 5, un.chara);
c_addweapon(chara, wp.knife, false);
c_addweapon(chara, wp[$"iron sword"], true);
c_inheritunit(10, 5, un.kris);
c_addweapon(chara, wp.knife, true);
c_addweapon(chara, wp[$"iron sword"]);
var kris = c_inheritunit(10, 5, un.kris);
c_addweapon(kris, wp[$"iron sword"], true);
selectedunit = noone;
hoveredunit = noone;
global.gw = 640;
global.gh = 360;

View File

@ -1,15 +1,15 @@
if selectedunit != noone {
if hoveredunit != noone {
draw_set_color(c_black);
draw_rectangle(global.gw, global.gh, global.gw-100, global.gh-(array_length(selectedunit.inventory)-1)*32-16, false);
draw_rectangle(global.gw, global.gh, global.gw-100, global.gh-(array_length(hoveredunit.inventory)-1)*32-16, false);
draw_set_color(c_white);
var i;
draw_set_halign(fa_right);
for (i=1; i<array_length(selectedunit.inventory); i++) {
draw_text(global.gw-10, global.gh-10-i*20, (selectedunit.equippedweapon == i ? "X " : " ") + selectedunit.inventory[i].name);
for (i=1; i<array_length(hoveredunit.inventory); i++) {
draw_text(global.gw-10, global.gh-10-i*20, (hoveredunit.equippedweapon == i ? "X " : " ") + hoveredunit.inventory[i].name);
}
draw_set_halign(fa_left);
var dudes = c_getstats(selectedunit);
var dudes = c_getstats(hoveredunit);
draw_set_color(c_black);
draw_rectangle(0, 0, 100, (array_length(dudes)-1)*32+16, false);
draw_set_color(c_white);

View File

@ -25,4 +25,19 @@ if select && selectedunit == noone {
}
//draw_text(global.gw-10, global.gh-10-i*20;
}
}
var mousex = floor(mouse_x/global.tilesize.x);
var mousey = floor(mouse_y/global.tilesize.y);
//log(mousex, mousey);
hoveredunit = selectedunit;
if mousex < array_length(global.map) {
if mousey < array_length(global.map[mousex]) {
var i;
for (i=0; i<array_length(global.map[mousex][mousey].contents); i++) {
if global.map[mousex][mousey].contents[i].object_index == o_unit {
hoveredunit = (global.map[mousex][mousey].contents[i]);
}
}
}
}

View File

@ -0,0 +1,5 @@
function c_fulleval(target) {
c_modifierreset(target);
c_modeval(target, target.inventory[target.equippedweapon]);
c_modeval(target, c_gettile(target.pos.x, target.pos.y));
}

View File

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "Scripts",
"path": "folders/Scripts.yy",
},
"resourceVersion": "1.0",
"name": "c_fulleval",
"tags": [],
"resourceType": "GMScript",
}

View File

@ -3,4 +3,5 @@ function c_moveunit(targetunit, destination) {
array_push(destination.contents, targetunit);
targetunit.pos.x = destination.x;
targetunit.pos.y = destination.y;
}

View File

@ -13,6 +13,7 @@ function c_selectunit(unitobject) {
}
}
ARTICULATOR.selectedunit = unitobject;
c_fulleval(unitobject);
return unitobject;
}
@ -25,6 +26,7 @@ function c_deselectunit(unitobject) {
c_decolor_all(c_red);
c_decolor_all(c_green);
ARTICULATOR.selectedunit = noone;
c_fulleval(unitobject);
return true;
}

View File

@ -29,11 +29,7 @@ function c_addweapon(target, weapon_, equip=false) {
}
function c_equipweapon(target, weapon_) {
log(target.data.str.val);
c_modifierreset(target);
log(target.data.str.val);
c_wpeval(target, weapon_);
log(target.data.str.val);
c_fulleval(target);
}
nu weapon("nothing", "it's literally nothing", WPTYPE.NULL);
nu weapon("knife", "bleed, bleed", WPTYPE.SWORD, [new statmod(st.str, 20, add), new statmod(st.hit, 100, add)]);
@ -53,7 +49,7 @@ function c_modifierreset(target) {
}
}
function c_wpeval(target, weapon_) {
function c_modeval(target, weapon_) {
var lads = variable_struct_get_names(target.data);
var dudes = variable_struct_get_names(weapon_.modifiers);
var i;