weapons probably work
This commit is contained in:
parent
a537ea5cf2
commit
48c1a3af7a
2 changed files with 42 additions and 3 deletions
|
@ -1,9 +1,13 @@
|
|||
global.weapons = {};
|
||||
#macro wp global.weapons
|
||||
function weapon(name_, description_, statmod_) constructor {
|
||||
function weapon(name_, description_, statmods) constructor {
|
||||
name = name_;
|
||||
description = description_;
|
||||
statmod = statmod_;
|
||||
modifiers = {};
|
||||
var i;
|
||||
for (i=0; i<array_length(statmods); i++) {
|
||||
modifiers[$statmods[i].name] = statmods[i];
|
||||
}
|
||||
}
|
||||
|
||||
function c_addweapon(target, weapon_) {
|
||||
|
@ -24,5 +28,17 @@ function c_modifierreset(target) {
|
|||
}
|
||||
|
||||
function c_wpeval(target, weapon_) {
|
||||
|
||||
var lads = variable_struct_get_names(target.data);
|
||||
var dudes = variable_struct_get_names(weapon_.modifiers);
|
||||
var i;
|
||||
for (i=0; i<array_length(dudes); i++) {
|
||||
if array_contains(lads, dudes[i]) {
|
||||
target.data[$dudes[i]].val = weapon_[$dudes[i]].operation(target.data[$dudes[i]].val, weapon_[$dudes[i]].val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function c_statexists(target, statstring) {
|
||||
var dudes = variable_struct_get_names(target.data);
|
||||
return array_contains(dudes, statstring);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue