@adatechnology/game-test-room 0.28.1 → 0.28.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.global.js +122 -10
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.global.js
CHANGED
|
@@ -51106,6 +51106,8 @@ void main(){
|
|
|
51106
51106
|
{ id: "shallow_water", water: { liquid: "water", depth: 0.3, drag: 0.65, blowShare: WATER_BLOW_SHARE }, strata: [{ material: "mud", thickness: 0.15 }, { material: "soil", thickness: 1.5 }, { material: "stone", thickness: 0.5 }] }
|
|
51107
51107
|
];
|
|
51108
51108
|
var DEFAULT_BAR_YIELD_JOULES = 24e5;
|
|
51109
|
+
var DEFAULT_BAR_DIAMETER = 0.01;
|
|
51110
|
+
var DEFAULT_BAR_YIELD_PA = 5e8;
|
|
51109
51111
|
var DEFAULT_PROFILE = "concrete_slab";
|
|
51110
51112
|
function createRandom(seed) {
|
|
51111
51113
|
let state = seed | 0;
|
|
@@ -51387,6 +51389,7 @@ void main(){
|
|
|
51387
51389
|
var RIGID_WIDENING = 2.5;
|
|
51388
51390
|
var COLLAPSE_DEPTH_SHARE = 0.75;
|
|
51389
51391
|
var COLLAPSE_SPREAD_BEND = 0.5;
|
|
51392
|
+
var BARS_SHARE_REACH = 0.6;
|
|
51390
51393
|
var RIM_REACH = 1.45;
|
|
51391
51394
|
var FLAME_MINIMUM = 200;
|
|
51392
51395
|
var FLAME_REACH = 0.6;
|
|
@@ -51906,19 +51909,95 @@ void main(){
|
|
|
51906
51909
|
}
|
|
51907
51910
|
}
|
|
51908
51911
|
}
|
|
51909
|
-
if (collapsed)
|
|
51910
|
-
|
|
51911
|
-
|
|
51912
|
-
|
|
51913
|
-
|
|
51914
|
-
|
|
51915
|
-
|
|
51916
|
-
|
|
51917
|
-
|
|
51912
|
+
if (collapsed) giveWay({ x, z, reach, profile });
|
|
51913
|
+
return collapsed;
|
|
51914
|
+
}
|
|
51915
|
+
function giveWay(spec) {
|
|
51916
|
+
const { x, z, reach, profile } = spec;
|
|
51917
|
+
emitDeform(x, z, reach);
|
|
51918
|
+
if (profile.drop === void 0) return;
|
|
51919
|
+
const limit = maxDepthOfProfile(profile);
|
|
51920
|
+
const column0 = clampIndex(Math.floor((x - reach - x0) / cellSize), columns);
|
|
51921
|
+
const column1 = clampIndex(Math.ceil((x + reach - x0) / cellSize), columns);
|
|
51922
|
+
const row0 = clampIndex(Math.floor((z - reach - z0) / cellSize), rows);
|
|
51923
|
+
const row1 = clampIndex(Math.ceil((z + reach - z0) / cellSize), rows);
|
|
51924
|
+
for (let row = row0; row <= row1; row++) {
|
|
51925
|
+
for (let column = column0; column <= column1; column++) {
|
|
51926
|
+
const index = row * stride + column;
|
|
51927
|
+
if (barBend[index] >= COLLAPSE_SPREAD_BEND && dug[index] < limit + profile.drop) {
|
|
51928
|
+
dug[index] = limit + profile.drop;
|
|
51929
|
+
touchVertex(column, row);
|
|
51918
51930
|
}
|
|
51919
51931
|
}
|
|
51920
51932
|
}
|
|
51921
|
-
|
|
51933
|
+
}
|
|
51934
|
+
function barsOf(profile) {
|
|
51935
|
+
const bars = profile.strata.find((stratum) => stratum.reinforcement);
|
|
51936
|
+
if (!bars?.reinforcement) return null;
|
|
51937
|
+
let cover = bars.reinforcement.cover;
|
|
51938
|
+
for (const stratum of profile.strata) {
|
|
51939
|
+
if (stratum === bars) break;
|
|
51940
|
+
cover += stratum.thickness;
|
|
51941
|
+
}
|
|
51942
|
+
return { stratum: bars, cover };
|
|
51943
|
+
}
|
|
51944
|
+
function bearAll(loads) {
|
|
51945
|
+
const bends = /* @__PURE__ */ new Map();
|
|
51946
|
+
const touched2 = [];
|
|
51947
|
+
for (const load of loads) {
|
|
51948
|
+
const spread2 = spreadLoad(load, bends);
|
|
51949
|
+
if (spread2) touched2.push({ load, ...spread2 });
|
|
51950
|
+
}
|
|
51951
|
+
let opened = false;
|
|
51952
|
+
for (const [index, bend] of bends) {
|
|
51953
|
+
if (barBend[index] >= bend) continue;
|
|
51954
|
+
barBend[index] = bend;
|
|
51955
|
+
const column = index % stride;
|
|
51956
|
+
const row = (index - column) / stride;
|
|
51957
|
+
touchVertex(column, row);
|
|
51958
|
+
const profile = profileList[profileIndex[index]];
|
|
51959
|
+
const limit = maxDepthOfProfile(profile);
|
|
51960
|
+
if (bend >= 1 && profile.drop !== void 0 && dug[index] >= limit * COLLAPSE_DEPTH_SHARE && dug[index] < limit + profile.drop) {
|
|
51961
|
+
dug[index] = limit + profile.drop;
|
|
51962
|
+
opened = true;
|
|
51963
|
+
}
|
|
51964
|
+
}
|
|
51965
|
+
if (opened) for (const { load, reach, profile } of touched2) giveWay({ x: load.x, z: load.z, reach, profile });
|
|
51966
|
+
return opened;
|
|
51967
|
+
}
|
|
51968
|
+
function spreadLoad(load, bends) {
|
|
51969
|
+
if (!contains(load.x, load.z) || load.newtons <= 0) return null;
|
|
51970
|
+
const profile = profileList[profileIndex[vertexOf(load.x, load.z).index]];
|
|
51971
|
+
const bars = barsOf(profile);
|
|
51972
|
+
if (!bars) return null;
|
|
51973
|
+
const reinforcement = bars.stratum.reinforcement;
|
|
51974
|
+
const moment = (reinforcement.yieldPa ?? DEFAULT_BAR_YIELD_PA) * (reinforcement.diameter ?? DEFAULT_BAR_DIAMETER) ** 3 / 6;
|
|
51975
|
+
const holds2 = 8 * moment / reinforcement.spacing;
|
|
51976
|
+
const footprint = load.radius * Math.SQRT2 + cellSize;
|
|
51977
|
+
const reach = Math.max(footprint, BARS_SHARE_REACH);
|
|
51978
|
+
const column0 = clampIndex(Math.floor((load.x - reach - x0) / cellSize), columns);
|
|
51979
|
+
const column1 = clampIndex(Math.ceil((load.x + reach - x0) / cellSize), columns);
|
|
51980
|
+
const row0 = clampIndex(Math.floor((load.z - reach - z0) / cellSize), rows);
|
|
51981
|
+
const row1 = clampIndex(Math.ceil((load.z + reach - z0) / cellSize), rows);
|
|
51982
|
+
const bare = [];
|
|
51983
|
+
let under = 0;
|
|
51984
|
+
let onBars = 0;
|
|
51985
|
+
for (let row = row0; row <= row1; row++) {
|
|
51986
|
+
for (let column = column0; column <= column1; column++) {
|
|
51987
|
+
const distance4 = Math.hypot(x0 + column * cellSize - load.x, z0 + row * cellSize - load.z);
|
|
51988
|
+
if (distance4 >= reach) continue;
|
|
51989
|
+
const index = row * stride + column;
|
|
51990
|
+
const isBare = dug[index] >= bars.cover;
|
|
51991
|
+
if (isBare) bare.push(index);
|
|
51992
|
+
if (distance4 >= footprint) continue;
|
|
51993
|
+
under++;
|
|
51994
|
+
if (isBare) onBars++;
|
|
51995
|
+
}
|
|
51996
|
+
}
|
|
51997
|
+
if (onBars === 0) return null;
|
|
51998
|
+
const bend = load.newtons * (onBars / under) / holds2;
|
|
51999
|
+
for (const index of bare) bends.set(index, (bends.get(index) ?? 0) + bend);
|
|
52000
|
+
return { reach, profile };
|
|
51922
52001
|
}
|
|
51923
52002
|
const maxDepthOfProfile = (profile) => maxDepthOf[indexOfProfile.get(profile.id)];
|
|
51924
52003
|
function rebarShowing(profile, depth) {
|
|
@@ -52193,6 +52272,7 @@ void main(){
|
|
|
52193
52272
|
strike,
|
|
52194
52273
|
burn,
|
|
52195
52274
|
applyHit,
|
|
52275
|
+
bear: bearAll,
|
|
52196
52276
|
onDeform(listener) {
|
|
52197
52277
|
deformListeners.add(listener);
|
|
52198
52278
|
return () => deformListeners.delete(listener);
|
|
@@ -53652,6 +53732,7 @@ ${SURFACE_GLSL}`).replace("#include <color_fragment>", "#include <color_fragment
|
|
|
53652
53732
|
"act.throw": "Threw {name} at {speed} m/s",
|
|
53653
53733
|
"ground.name": "Ground",
|
|
53654
53734
|
"act.landing": "{name} landed at {speed} m/s: {energy} J",
|
|
53735
|
+
"act.ground_gave_way": "the bare bars could not hold the weight on them: the slab gave way",
|
|
53655
53736
|
"act.player_land": "You landed at {speed} m/s",
|
|
53656
53737
|
"act.bench_failed": "{name} failed: {error}",
|
|
53657
53738
|
"loading.working": "Working\u2026",
|
|
@@ -54021,6 +54102,7 @@ ${SURFACE_GLSL}`).replace("#include <color_fragment>", "#include <color_fragment
|
|
|
54021
54102
|
"act.throw": "Arremessou {name} a {speed} m/s",
|
|
54022
54103
|
"ground.name": "Ch\xE3o",
|
|
54023
54104
|
"act.landing": "{name} caiu a {speed} m/s: {energy} J",
|
|
54105
|
+
"act.ground_gave_way": "os vergalh\xF5es expostos n\xE3o aguentaram o peso: a laje cedeu",
|
|
54024
54106
|
"act.player_land": "Voc\xEA aterrissou a {speed} m/s",
|
|
54025
54107
|
"act.bench_failed": "{name} falhou: {error}",
|
|
54026
54108
|
"loading.working": "Trabalhando\u2026",
|
|
@@ -55541,6 +55623,11 @@ ${SURFACE_GLSL}`).replace("#include <color_fragment>", "#include <color_fragment
|
|
|
55541
55623
|
var TERRAIN_CELL = 0.1;
|
|
55542
55624
|
var GROUND_SPLASH_MAX_LITRES = 3;
|
|
55543
55625
|
var WATER_ENTRY_SPEED = 1.5;
|
|
55626
|
+
var LOAD_EVERY = 0.2;
|
|
55627
|
+
var RESTING_GAP = 0.06;
|
|
55628
|
+
var PLAYER_FOOTPRINT = 0.25;
|
|
55629
|
+
var RESTING_SPEED = 0.3;
|
|
55630
|
+
var GRAVITY_EARTH = 9.81;
|
|
55544
55631
|
var TERRAIN_MAX_CELLS = 1e3;
|
|
55545
55632
|
var GROUND_BURST_MAX = 28;
|
|
55546
55633
|
var GROUND_BURST_PER_METRE = 30;
|
|
@@ -57981,6 +58068,30 @@ ${SURFACE_GLSL}`).replace("#include <color_fragment>", "#include <color_fragment
|
|
|
57981
58068
|
for (const p of loose) floatPiece(p, dt);
|
|
57982
58069
|
};
|
|
57983
58070
|
const footprints = createFootprints(terrain);
|
|
58071
|
+
let loadClock = 0;
|
|
58072
|
+
const restingLoad = (piece) => {
|
|
58073
|
+
if (piece.held || Math.hypot(piece.velocity[0], piece.velocity[1], piece.velocity[2]) > RESTING_SPEED) return null;
|
|
58074
|
+
const box2 = tmpBox.setFromObject(piece.root);
|
|
58075
|
+
const centre = box2.getCenter(tmpV2);
|
|
58076
|
+
return { x: centre.x, z: centre.z, radius: Math.max(piece.halfExtents[0], piece.halfExtents[2]), newtons: piece.mass * GRAVITY_EARTH };
|
|
58077
|
+
};
|
|
58078
|
+
const updateLoads = (dt) => {
|
|
58079
|
+
loadClock += dt;
|
|
58080
|
+
if (loadClock < LOAD_EVERY) return;
|
|
58081
|
+
loadClock = 0;
|
|
58082
|
+
const loads = [];
|
|
58083
|
+
const [px, py, pz] = player.position;
|
|
58084
|
+
if (py - terrain.heightAt(px, pz) <= RESTING_GAP) loads.push({ x: px, z: pz, radius: PLAYER_FOOTPRINT, newtons: playerMass * GRAVITY_EARTH });
|
|
58085
|
+
for (const e of entries2.values()) {
|
|
58086
|
+
const load = e.piece ? restingLoad(e.piece) : null;
|
|
58087
|
+
if (load) loads.push(load);
|
|
58088
|
+
}
|
|
58089
|
+
for (const p of loose) {
|
|
58090
|
+
const load = restingLoad(p);
|
|
58091
|
+
if (load) loads.push(load);
|
|
58092
|
+
}
|
|
58093
|
+
if (loads.length > 0 && terrain.bear(loads)) action("ground_gave_way", t("act.ground_gave_way"));
|
|
58094
|
+
};
|
|
57984
58095
|
const prevVy = /* @__PURE__ */ new Map();
|
|
57985
58096
|
const tmpBox = new THREE.Box3();
|
|
57986
58097
|
const onKey = (code, down, e) => {
|
|
@@ -58279,6 +58390,7 @@ ${SURFACE_GLSL}`).replace("#include <color_fragment>", "#include <color_fragment
|
|
|
58279
58390
|
vfx.update(dt);
|
|
58280
58391
|
updateImpacts();
|
|
58281
58392
|
updateWater(dt);
|
|
58393
|
+
updateLoads(dt);
|
|
58282
58394
|
if (player.position[1] <= terrain.footAt(player.position[0], player.position[2]) + 0.15) footprints.update(player.position[0], player.position[2]);
|
|
58283
58395
|
fluidView.update(dt);
|
|
58284
58396
|
filmBridge.update(dt);
|