armory/Sources/armory/logicnode/WriteStorageNode.hx

22 lines
402 B
Haxe
Raw Normal View History

2017-08-16 19:33:49 +02:00
package armory.logicnode;
class WriteStorageNode extends LogicNode {
2019-12-19 23:54:08 +01:00
public function new(tree: LogicTree) {
2017-08-16 19:33:49 +02:00
super(tree);
}
2019-12-19 23:54:08 +01:00
override function run(from: Int) {
var key: String = inputs[1].get();
var value: Dynamic = inputs[2].get();
2017-08-16 19:33:49 +02:00
var data = iron.system.Storage.data;
2017-12-30 12:14:36 +01:00
if (data == null) return;
2017-08-16 19:33:49 +02:00
Reflect.setField(data, key, value);
iron.system.Storage.save();
2018-10-22 10:10:33 +02:00
runOutput(0);
2017-08-16 19:33:49 +02:00
}
}