HollowBond/Public/ecma/Models/RoomModel.ecma.js

30 lines
1.2 KiB
JavaScript

"use strict";
const RoomModel = (function(){
const RoomModel = function(hollow_bond, inputs = {}){
const self = this;
this.x = Common.get_value("x", inputs, 0);
this.y = Common.get_value("y", inputs, 0);
this.z = Common.get_value("z", inputs, 0);
this.width = Common.get_value("width", inputs, 2);
this.height = hollow_bond.settings.get(["height", "room_height"], inputs, 3);
this.depth = Common.get_value("depth", inputs, 2);
this.id = RoomModel.get_id(self.x, self.y, self.z, self.width, self.height, self.depth);
this.padding = hollow_bond.settings.get(["padding", "room_padding"], inputs, .1);
this.frames = Common.get_value("frames", inputs, []);
this.holes = Common.get_value("holes", inputs, []);
this.elevators = Common.get_value("elevators", inputs, []);
// Orificios que atraviesan de suelo a techo la habitación: [{ x, z, width, depth }]
this.voids = Common.get_value("voids", inputs, []);
};
RoomModel.get_id = (x, y, z, width, height, depth) => `room_${x}_${y}_${z}_${width}_${height}_${depth}`;
return RoomModel;
})();