@adatechnology/game-floorplan-structure 1.2.3 → 1.3.1

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.js CHANGED
@@ -3121,7 +3121,24 @@ var assemblySpec = (part, capacity) => {
3121
3121
  }
3122
3122
  return spec;
3123
3123
  };
3124
- var partSpecOf = (part, capacity, detailed) => detailed && part.assembly ? assemblySpec(part, capacity) : boxSpec(part, capacity);
3124
+ var MEMBER_CAGE = { spacing: 0.1, diameter: 8e-3, unit: 0.1 };
3125
+ var CAGED_ROLES = /* @__PURE__ */ new Set(["beam", "column"]);
3126
+ var caged = (spec, part, rebar) => {
3127
+ if (!rebar || part.material !== "concrete" || !CAGED_ROLES.has(part.role) || spec.reinforcement) return spec;
3128
+ const size = spec.shape.kind === "box" ? spec.shape.size : null;
3129
+ if (!size) return spec;
3130
+ const thin = Math.min(...size);
3131
+ return {
3132
+ ...spec,
3133
+ reinforcement: { material: rebar, spacing: MEMBER_CAGE.spacing, diameter: MEMBER_CAGE.diameter },
3134
+ units: { size: [MEMBER_CAGE.unit, MEMBER_CAGE.unit, thin], bond: "stack", mortar: "concrete" }
3135
+ };
3136
+ };
3137
+ var partSpecOf = (part, capacity, detailed, rebar) => {
3138
+ if (detailed && part.assembly) return assemblySpec(part, capacity);
3139
+ const spec = boxSpec(part, capacity);
3140
+ return detailed ? caged(spec, part, rebar) : spec;
3141
+ };
3125
3142
  function toDestructibleSpec(structure, options = {}) {
3126
3143
  const { safety = 0.65, redundancy = 0.97, safetyOthers = 0.45 } = options;
3127
3144
  const kept = structure.parts.filter((part) => !options.filter || options.filter(part));
@@ -3138,7 +3155,7 @@ function toDestructibleSpec(structure, options = {}) {
3138
3155
  const sizing = { safety, redundancy, safetyOthers };
3139
3156
  const sized = { ...panels, capacities: options.sized === false ? /* @__PURE__ */ new Map() : sizeCapacities(panels.parts, panels.supports, sizing) };
3140
3157
  const { parts, supports, capacities } = detail === "units" ? applyUnits(sized, structure) : sized;
3141
- const specs = parts.map((part) => partSpecOf(part, capacities.get(part.id), detail !== "coarse"));
3158
+ const specs = parts.map((part) => partSpecOf(part, capacities.get(part.id), detail !== "coarse", structure.construction.frame.rebar));
3142
3159
  const margin = options.terrainMargin ?? TERRAIN_MARGIN;
3143
3160
  const x0 = Math.min(...parts.map((part) => part.aabb[0]));
3144
3161
  const z0 = Math.min(...parts.map((part) => part.aabb[1]));
@@ -3937,6 +3954,7 @@ export {
3937
3954
  FLAT_ROOF_DEFAULTS,
3938
3955
  GROUND,
3939
3956
  MECHANICAL_DEFAULTS,
3957
+ MEMBER_CAGE,
3940
3958
  PILE_AREA,
3941
3959
  PILE_DEFAULTS,
3942
3960
  PLATE_DEFAULTS,