"use strict"; const HashManager = (function(){ const HashManager = function(hollow_bond){ const self = this; let hash_prime_xf = hollow_bond.settings.get("hash_prime_xf", null, 0x1B873593), hash_prime_yf = hollow_bond.settings.get("hash_prime_yf", null, 0x85EBCA6B), hash_prime_zf = hollow_bond.settings.get("hash_prime_zf", null, 0xC2B2AE35), hash_prime_xt = hollow_bond.settings.get("hash_prime_xt", null, 0x3C6EF372), hash_prime_yt = hollow_bond.settings.get("hash_prime_yt", null, 0xBB67AE85), hash_prime_zt = hollow_bond.settings.get("hash_prime_zt", null, 0xEECE660D), hash_prime_channel = hollow_bond.settings.get("hash_prime_channel", null, 0x9E3779B9), hash_channel_chunk = hollow_bond.settings.get("hash_channel_chunk", null, 101), hash_channel_chunk_presence = hollow_bond.settings.get("hash_channel_chunk_presence", null, 105), hash_channel_seam_horizontal = hollow_bond.settings.get("hash_channel_seam_horizontal", null, 102), hash_channel_seam_vertical_x = hollow_bond.settings.get("hash_channel_seam_vertical_x", null, 103), hash_channel_seam_vertical_z = hollow_bond.settings.get("hash_channel_seam_vertical_z", null, 104), hash_channel_elevator = hollow_bond.settings.get("hash_channel_elevator", null, 201), hash_channel_hole = hollow_bond.settings.get("hash_channel_hole", null, 202), hash_channel_hole_internal = hollow_bond.settings.get("hash_channel_hole_internal", null, 203), hash_channel_room = hollow_bond.settings.get("hash_channel_room", null, 301), hash_channel_frame = hollow_bond.settings.get("hash_channel_frame", null, 401), hash_channel_stairs = hollow_bond.settings.get("hash_channel_stairs", null, 501), hash_channel_room_cut_direction = hollow_bond.settings.get("hash_channel_room_cut_direction", null, 601); /** * Reduce una caja ortoédrica y un canal a un número pseudoaleatorio [0, 1) determinista. * @param {!number} xf * @param {!number} yf * @param {!number} zf * @param {!number} xt * @param {!number} yt * @param {!number} zt * @param {!number} channel * @param {number} [i = 0] * @returns {number} */ this.box = (xf, yf, zf, xt, yt, zt, channel, i = 0) => Common.random(hollow_bond.seed, ( Math.imul(xf | 0, hash_prime_xf) ^ Math.imul(yf | 0, hash_prime_yf) ^ Math.imul(zf | 0, hash_prime_zf) ^ Math.imul(xt | 0, hash_prime_xt) ^ Math.imul(yt | 0, hash_prime_yt) ^ Math.imul(zt | 0, hash_prime_zt) ^ Math.imul(channel | 0, hash_prime_channel) ^ (i | 0) ) | 0); // Métodos semánticos directos this.chunk = (xf, yf, zf, xt, yt, zt, i = 0) => self.box(xf, yf, zf, xt, yt, zt, hash_channel_chunk, i); this.chunk_presence = (cx, cy, cz, i = 0) => self.box(cx, cy, cz, cx, cy, cz, hash_channel_chunk_presence, i); this.seam_horizontal = (xf, y, zf, xt, zt, i = 0) => self.box(xf, y, zf, xt, y, zt, hash_channel_seam_horizontal, i); this.seam_vertical_x = (x, yf, zf, yt, zt, i = 0) => self.box(x, yf, zf, x, yt, zt, hash_channel_seam_vertical_x, i); this.seam_vertical_z = (xf, yf, z, xt, yt, i = 0) => self.box(xf, yf, z, xt, yt, z, hash_channel_seam_vertical_z, i); this.elevator = (xf, yf, zf, xt, yt, zt, i = 0) => self.box(xf, yf, zf, xt, yt, zt, hash_channel_elevator, i); this.seam_elevator = (xf, y, zf, xt, zt, i = 0) => self.box(xf, y, zf, xt, y, zt, hash_channel_elevator, i); this.hole = (xf, yf, zf, xt, yt, zt, i = 0) => self.box(xf, yf, zf, xt, yt, zt, hash_channel_hole, i); this.hole_internal = (xf, yf, zf, xt, yt, zt, i = 0) => self.box(xf, yf, zf, xt, yt, zt, hash_channel_hole_internal, i); this.room = (xf, yf, zf, xt, yt, zt, i = 0) => self.box(xf, yf, zf, xt, yt, zt, hash_channel_room, i); this.rooms = (a, b, c, d = 0, e = null, f = null, g = 0) => ( e === null || f === null ? self.box(a, b, c, a, b, c, hash_channel_room, d) : self.box(a, b, c, d, e, f, hash_channel_room, g)); this.frame = (xf, yf, zf, xt, yt, zt, i = 0) => self.box(xf, yf, zf, xt, yt, zt, hash_channel_frame, i); this.stairs = (xf, yf, zf, xt, yt, zt, i = 0) => self.box(xf, yf, zf, xt, yt, zt, hash_channel_stairs, i); this.room_cut_axis = (py, a, b) => self.box(a[0] == "z" ? 71 : 70, a[1], py, b[0] == "z" ? 91 : 90, b[1], py, hash_channel_room_cut_direction, (1 << a[2]) | (1 << b[2])); }; return HashManager; })();