@adatechnology/game-items-goods 0.4.7 → 0.6.0

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.
@@ -45,9 +45,12 @@ var GameItemsGoods = (() => {
45
45
  POOL_PLACES: () => POOL_PLACES,
46
46
  checkGoodsItems: () => checkGoodsItems,
47
47
  createGoodsFindsProvider: () => createGoodsFindsProvider,
48
+ createGoodsItemUse: () => createGoodsItemUse,
48
49
  createGoodsItems: () => createGoodsItems,
49
50
  createGoodsKinds: () => createGoodsKinds,
50
51
  createItemContracts: () => createItemContracts,
52
+ drinkHydrationOf: () => drinkHydrationOf,
53
+ goodsItemUse: () => goodsItemUse,
51
54
  goodsPack: () => goodsPack,
52
55
  goodsText: () => goodsText,
53
56
  lootCategoriesOf: () => lootCategoriesOf,
@@ -159,6 +162,12 @@ var GameItemsGoods = (() => {
159
162
  }
160
163
  return { ok: problems.length === 0, problems, warnings };
161
164
  };
165
+ var sealBlock = (seal, state) => {
166
+ if (seal.spoilsWhenBreached && state.breached) return "breached";
167
+ if (seal.spoilsWhenBreached && state.leaked) return "leaked";
168
+ if (!state.opened) return "sealed";
169
+ return void 0;
170
+ };
162
171
  var DEFERRED_QUEUE_ID = {
163
172
  DESTRUCTION_EVENTS: "destruction.events",
164
173
  BREACH_PAINT: "floorplan.breach-paint",
@@ -662,6 +671,30 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
662
671
  byTag: (tag) => [...byTag.get(tag) ?? []]
663
672
  };
664
673
  };
674
+ var FRESH_NUTRITION = { satietyFactor: 1, poisonChance: 0, morale: 0, isEdible: true };
675
+ var nutritionOf = (item, context, rules) => {
676
+ const state = context.freshness ?? "fresh";
677
+ const effect = state === "fresh" ? FRESH_NUTRITION : rules.use.freshness[state];
678
+ const poisonShare = context.isCooked ? rules.use.cookedPoisonFactor : 1;
679
+ return {
680
+ satiety: (item.nutrition?.satiety ?? 0) * effect.satietyFactor,
681
+ hydration: item.nutrition?.hydration ?? 0,
682
+ morale: effect.morale,
683
+ poisonChance: effect.poisonChance * poisonShare,
684
+ isEdible: effect.isEdible
685
+ };
686
+ };
687
+ var findEffect = (item, effects) => effects.find((entry) => entry.items?.includes(item.id)) ?? effects.find((entry) => entry.category?.includes(item.category));
688
+ var resolveUse = (item, effects, context = {}, rules = DEFAULT_RULES) => {
689
+ const def = findEffect(item, effects);
690
+ if (!def) return void 0;
691
+ const base = { useId: def.id, effect: def.effect, params: def.params ?? {}, consumes: def.consumes };
692
+ if (def.effect !== "consume_nutrition") return base;
693
+ const nutrition = nutritionOf(item, context, rules);
694
+ const blocked = item.seal && context.seal ? sealBlock(item.seal, context.seal) : void 0;
695
+ if (blocked) return { ...base, consumes: false, nutrition: { ...nutrition, isEdible: false }, blocked };
696
+ return { ...base, consumes: def.consumes && nutrition.isEdible, nutrition };
697
+ };
665
698
  var depletionFactor = (place, day, rules) => {
666
699
  if (day <= 0) return 1;
667
700
  const rule = rules.finds.depletion.find((entry) => entry.places.includes(place));
@@ -14581,6 +14614,12 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
14581
14614
  impact: {
14582
14615
  response: "dent",
14583
14616
  pushImpulse: true
14617
+ },
14618
+ use: {
14619
+ clip: "use_hygiene",
14620
+ sounds: [
14621
+ "scrub"
14622
+ ]
14584
14623
  }
14585
14624
  }
14586
14625
  }
@@ -18430,6 +18469,22 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
18430
18469
  items: [
18431
18470
  "alcohol_70",
18432
18471
  "povidone_iodine"
18472
+ ],
18473
+ params: {
18474
+ clip: "apply_dressing"
18475
+ }
18476
+ },
18477
+ {
18478
+ id: "wash",
18479
+ effect: "wash",
18480
+ consumes: false,
18481
+ items: [
18482
+ "soap",
18483
+ "shampoo",
18484
+ "toothpaste",
18485
+ "toothbrush",
18486
+ "deodorant",
18487
+ "towel"
18433
18488
  ]
18434
18489
  },
18435
18490
  {
@@ -18451,7 +18506,44 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
18451
18506
  consumes: false,
18452
18507
  items: [
18453
18508
  "flashlight"
18454
- ]
18509
+ ],
18510
+ params: {
18511
+ clip: "toggle_flashlight"
18512
+ }
18513
+ },
18514
+ {
18515
+ id: "ignite",
18516
+ effect: "ignite",
18517
+ consumes: false,
18518
+ items: [
18519
+ "lighter"
18520
+ ],
18521
+ params: {
18522
+ clip: "light_lighter"
18523
+ }
18524
+ },
18525
+ {
18526
+ id: "radio_call",
18527
+ effect: "radio_call",
18528
+ consumes: false,
18529
+ items: [
18530
+ "portable_radio",
18531
+ "walkie_talkies"
18532
+ ],
18533
+ params: {
18534
+ clip: "use_radio"
18535
+ }
18536
+ },
18537
+ {
18538
+ id: "turn_key",
18539
+ effect: "turn_key",
18540
+ consumes: false,
18541
+ category: [
18542
+ "keys"
18543
+ ],
18544
+ params: {
18545
+ clip: "turn_key"
18546
+ }
18455
18547
  },
18456
18548
  {
18457
18549
  id: "swap_bag",
@@ -19797,6 +19889,720 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
19797
19889
  var GOODS_STRINGS = { en: en_default, "pt-BR": pt_BR_default };
19798
19890
  var pickGoodsLocale = (locale) => locale?.toLowerCase().startsWith("pt") ? "pt-BR" : "en";
19799
19891
  var goodsText = (key, locale) => GOODS_STRINGS[pickGoodsLocale(locale)][key] ?? key;
19892
+
19893
+ // ../game-fluids/dist/index.js
19894
+ var liquids_default = [
19895
+ {
19896
+ id: "water",
19897
+ color: 11064558,
19898
+ opacity: 0.35,
19899
+ stainColor: 7309206,
19900
+ viscosity: 1,
19901
+ density: 1e3,
19902
+ dryTime: 180,
19903
+ gloss: 0.9,
19904
+ drink: {
19905
+ thirst: 100,
19906
+ effects: []
19907
+ },
19908
+ tags: [
19909
+ "drink",
19910
+ "clear"
19911
+ ]
19912
+ },
19913
+ {
19914
+ id: "coffee",
19915
+ color: 3875604,
19916
+ opacity: 0.95,
19917
+ stainColor: 2824202,
19918
+ viscosity: 1.5,
19919
+ density: 1005,
19920
+ dryTime: 900,
19921
+ gloss: 0.8,
19922
+ leavesMark: true,
19923
+ steamC: 60,
19924
+ drink: {
19925
+ thirst: 80,
19926
+ effects: [
19927
+ "caffeine"
19928
+ ]
19929
+ },
19930
+ tags: [
19931
+ "drink",
19932
+ "hot"
19933
+ ]
19934
+ },
19935
+ {
19936
+ id: "tea",
19937
+ color: 9063188,
19938
+ opacity: 0.8,
19939
+ stainColor: 6961682,
19940
+ viscosity: 1.4,
19941
+ density: 1005,
19942
+ dryTime: 800,
19943
+ gloss: 0.8,
19944
+ leavesMark: true,
19945
+ steamC: 60,
19946
+ drink: {
19947
+ thirst: 90,
19948
+ effects: []
19949
+ },
19950
+ tags: [
19951
+ "drink",
19952
+ "hot"
19953
+ ]
19954
+ },
19955
+ {
19956
+ id: "milk",
19957
+ color: 16052712,
19958
+ opacity: 0.98,
19959
+ stainColor: 14473160,
19960
+ viscosity: 2,
19961
+ density: 1030,
19962
+ dryTime: 900,
19963
+ gloss: 0.5,
19964
+ leavesMark: true,
19965
+ drink: {
19966
+ thirst: 70,
19967
+ effects: []
19968
+ },
19969
+ tags: [
19970
+ "drink"
19971
+ ]
19972
+ },
19973
+ {
19974
+ id: "soda",
19975
+ color: 3808530,
19976
+ opacity: 0.85,
19977
+ stainColor: 2757901,
19978
+ viscosity: 1.3,
19979
+ density: 1040,
19980
+ dryTime: 1200,
19981
+ gloss: 0.85,
19982
+ leavesMark: true,
19983
+ drink: {
19984
+ thirst: 60,
19985
+ effects: []
19986
+ },
19987
+ tags: [
19988
+ "drink",
19989
+ "sticky"
19990
+ ]
19991
+ },
19992
+ {
19993
+ id: "juice",
19994
+ color: 15239467,
19995
+ opacity: 0.9,
19996
+ stainColor: 12741916,
19997
+ viscosity: 2,
19998
+ density: 1045,
19999
+ dryTime: 1100,
20000
+ gloss: 0.8,
20001
+ leavesMark: true,
20002
+ drink: {
20003
+ thirst: 75,
20004
+ effects: []
20005
+ },
20006
+ tags: [
20007
+ "drink",
20008
+ "sticky"
20009
+ ]
20010
+ },
20011
+ {
20012
+ id: "beer",
20013
+ color: 14259740,
20014
+ opacity: 0.8,
20015
+ stainColor: 11039764,
20016
+ viscosity: 1.4,
20017
+ density: 1010,
20018
+ dryTime: 900,
20019
+ gloss: 0.8,
20020
+ drink: {
20021
+ thirst: 50,
20022
+ effects: [
20023
+ "alcohol"
20024
+ ]
20025
+ },
20026
+ tags: [
20027
+ "drink",
20028
+ "alcohol"
20029
+ ]
20030
+ },
20031
+ {
20032
+ id: "wine",
20033
+ color: 7016223,
20034
+ opacity: 0.9,
20035
+ stainColor: 5048854,
20036
+ viscosity: 1.6,
20037
+ density: 990,
20038
+ dryTime: 800,
20039
+ gloss: 0.85,
20040
+ leavesMark: true,
20041
+ drink: {
20042
+ thirst: 40,
20043
+ effects: [
20044
+ "alcohol"
20045
+ ]
20046
+ },
20047
+ tags: [
20048
+ "drink",
20049
+ "alcohol"
20050
+ ]
20051
+ },
20052
+ {
20053
+ id: "spirits",
20054
+ color: 13214042,
20055
+ opacity: 0.6,
20056
+ stainColor: 10320959,
20057
+ viscosity: 1.8,
20058
+ density: 940,
20059
+ dryTime: 200,
20060
+ gloss: 0.85,
20061
+ flammable: true,
20062
+ drink: {
20063
+ thirst: 5,
20064
+ effects: [
20065
+ "alcohol"
20066
+ ]
20067
+ },
20068
+ tags: [
20069
+ "drink",
20070
+ "alcohol"
20071
+ ]
20072
+ },
20073
+ {
20074
+ id: "fuel",
20075
+ color: 14926682,
20076
+ opacity: 0.6,
20077
+ stainColor: 7232298,
20078
+ viscosity: 0.6,
20079
+ density: 740,
20080
+ dryTime: 60,
20081
+ gloss: 0.95,
20082
+ leavesMark: false,
20083
+ flammable: true,
20084
+ drink: {
20085
+ thirst: 0,
20086
+ effects: [
20087
+ "poison"
20088
+ ]
20089
+ },
20090
+ tags: [
20091
+ "fuel",
20092
+ "gasoline"
20093
+ ]
20094
+ },
20095
+ {
20096
+ id: "diesel",
20097
+ color: 12098094,
20098
+ opacity: 0.8,
20099
+ stainColor: 5917208,
20100
+ viscosity: 3,
20101
+ density: 830,
20102
+ dryTime: 3600,
20103
+ gloss: 0.95,
20104
+ leavesMark: true,
20105
+ flammable: true,
20106
+ drink: {
20107
+ thirst: 0,
20108
+ effects: [
20109
+ "poison"
20110
+ ]
20111
+ },
20112
+ tags: [
20113
+ "fuel"
20114
+ ]
20115
+ },
20116
+ {
20117
+ id: "motor_oil",
20118
+ color: 3877388,
20119
+ opacity: 0.95,
20120
+ stainColor: 1840134,
20121
+ viscosity: 100,
20122
+ density: 880,
20123
+ dryTime: 0,
20124
+ gloss: 1,
20125
+ leavesMark: true,
20126
+ flammable: true,
20127
+ drink: {
20128
+ thirst: 0,
20129
+ effects: [
20130
+ "poison"
20131
+ ]
20132
+ },
20133
+ tags: [
20134
+ "oil"
20135
+ ]
20136
+ },
20137
+ {
20138
+ id: "cooking_oil",
20139
+ color: 14267708,
20140
+ opacity: 0.85,
20141
+ stainColor: 11110698,
20142
+ viscosity: 60,
20143
+ density: 920,
20144
+ dryTime: 0,
20145
+ gloss: 1,
20146
+ leavesMark: true,
20147
+ flammable: true,
20148
+ drink: {
20149
+ thirst: 0,
20150
+ effects: [
20151
+ "poison"
20152
+ ]
20153
+ },
20154
+ tags: [
20155
+ "oil",
20156
+ "food"
20157
+ ]
20158
+ },
20159
+ {
20160
+ id: "blood",
20161
+ color: 7997964,
20162
+ opacity: 0.92,
20163
+ stainColor: 3874068,
20164
+ viscosity: 4,
20165
+ density: 1060,
20166
+ dryTime: 600,
20167
+ gloss: 0.75,
20168
+ leavesMark: true,
20169
+ drink: {
20170
+ thirst: 10,
20171
+ effects: [
20172
+ "disgust"
20173
+ ]
20174
+ },
20175
+ tags: [
20176
+ "organic"
20177
+ ]
20178
+ },
20179
+ {
20180
+ id: "old_blood",
20181
+ color: 7085078,
20182
+ opacity: 0.92,
20183
+ stainColor: 2758158,
20184
+ viscosity: 4,
20185
+ density: 1060,
20186
+ dryTime: 360,
20187
+ gloss: 0.7,
20188
+ leavesMark: true,
20189
+ drink: {
20190
+ thirst: 10,
20191
+ effects: [
20192
+ "disgust"
20193
+ ]
20194
+ },
20195
+ tags: [
20196
+ "organic"
20197
+ ]
20198
+ },
20199
+ {
20200
+ id: "bile",
20201
+ color: 9083434,
20202
+ opacity: 0.9,
20203
+ stainColor: 4080160,
20204
+ viscosity: 6,
20205
+ density: 1020,
20206
+ dryTime: 900,
20207
+ gloss: 0.75,
20208
+ leavesMark: true,
20209
+ drink: {
20210
+ thirst: 0,
20211
+ effects: [
20212
+ "disgust"
20213
+ ]
20214
+ },
20215
+ tags: [
20216
+ "organic"
20217
+ ]
20218
+ },
20219
+ {
20220
+ id: "sap",
20221
+ color: 13146940,
20222
+ opacity: 0.8,
20223
+ stainColor: 10122282,
20224
+ viscosity: 200,
20225
+ density: 1100,
20226
+ dryTime: 3600,
20227
+ gloss: 0.8,
20228
+ leavesMark: true,
20229
+ drink: {
20230
+ thirst: 20,
20231
+ effects: []
20232
+ },
20233
+ tags: [
20234
+ "organic",
20235
+ "sticky"
20236
+ ]
20237
+ },
20238
+ {
20239
+ id: "acid",
20240
+ color: 10146378,
20241
+ opacity: 0.6,
20242
+ stainColor: 7313970,
20243
+ viscosity: 1.5,
20244
+ density: 1200,
20245
+ dryTime: 900,
20246
+ gloss: 0.9,
20247
+ leavesMark: true,
20248
+ drink: {
20249
+ thirst: 0,
20250
+ effects: [
20251
+ "poison"
20252
+ ]
20253
+ },
20254
+ tags: [
20255
+ "corrosive"
20256
+ ]
20257
+ },
20258
+ {
20259
+ id: "paint",
20260
+ color: 11740715,
20261
+ opacity: 0.98,
20262
+ stainColor: 9050655,
20263
+ viscosity: 300,
20264
+ density: 1300,
20265
+ dryTime: 1800,
20266
+ gloss: 0.6,
20267
+ leavesMark: true,
20268
+ drink: {
20269
+ thirst: 0,
20270
+ effects: [
20271
+ "poison"
20272
+ ]
20273
+ },
20274
+ tags: [
20275
+ "paint"
20276
+ ]
20277
+ },
20278
+ {
20279
+ id: "bleach",
20280
+ color: 15134688,
20281
+ opacity: 0.7,
20282
+ stainColor: 13621446,
20283
+ viscosity: 1.2,
20284
+ density: 1100,
20285
+ dryTime: 900,
20286
+ gloss: 0.85,
20287
+ leavesMark: true,
20288
+ drink: {
20289
+ thirst: 0,
20290
+ effects: [
20291
+ "poison"
20292
+ ]
20293
+ },
20294
+ tags: [
20295
+ "corrosive"
20296
+ ]
20297
+ },
20298
+ {
20299
+ id: "sewage",
20300
+ color: 5921582,
20301
+ opacity: 0.92,
20302
+ stainColor: 3093273,
20303
+ viscosity: 4,
20304
+ density: 1010,
20305
+ dryTime: 1800,
20306
+ gloss: 0.8,
20307
+ leavesMark: true,
20308
+ drink: {
20309
+ thirst: 0,
20310
+ effects: [
20311
+ "disgust",
20312
+ "poison"
20313
+ ]
20314
+ },
20315
+ tags: [
20316
+ "organic",
20317
+ "waste"
20318
+ ]
20319
+ },
20320
+ {
20321
+ id: "honey",
20322
+ color: 14193162,
20323
+ opacity: 0.9,
20324
+ stainColor: 12089350,
20325
+ viscosity: 3e3,
20326
+ density: 1420,
20327
+ dryTime: 14400,
20328
+ gloss: 0.95,
20329
+ leavesMark: true,
20330
+ drink: {
20331
+ thirst: 10,
20332
+ effects: []
20333
+ },
20334
+ tags: [
20335
+ "drink",
20336
+ "sticky"
20337
+ ]
20338
+ },
20339
+ {
20340
+ id: "mud",
20341
+ color: 4008988,
20342
+ opacity: 0.95,
20343
+ stainColor: 3811866,
20344
+ viscosity: 40,
20345
+ density: 1600,
20346
+ dryTime: 900,
20347
+ gloss: 0.4,
20348
+ tags: [
20349
+ "dirty"
20350
+ ]
20351
+ },
20352
+ {
20353
+ id: "coolant",
20354
+ color: 3455050,
20355
+ opacity: 0.7,
20356
+ stainColor: 2783796,
20357
+ viscosity: 4,
20358
+ density: 1070,
20359
+ dryTime: 1200,
20360
+ gloss: 0.85,
20361
+ leavesMark: true,
20362
+ drink: {
20363
+ thirst: 0,
20364
+ effects: [
20365
+ "poison"
20366
+ ]
20367
+ },
20368
+ tags: [
20369
+ "coolant"
20370
+ ]
20371
+ },
20372
+ {
20373
+ id: "brake_fluid",
20374
+ color: 13145646,
20375
+ opacity: 0.8,
20376
+ stainColor: 9069600,
20377
+ viscosity: 8,
20378
+ density: 1050,
20379
+ dryTime: 3600,
20380
+ gloss: 0.9,
20381
+ leavesMark: true,
20382
+ drink: {
20383
+ thirst: 0,
20384
+ effects: [
20385
+ "poison"
20386
+ ]
20387
+ },
20388
+ tags: [
20389
+ "brake_fluid"
20390
+ ]
20391
+ }
20392
+ ];
20393
+ var LIQUIDS = liquids_default;
20394
+ var SAMPLES = 16;
20395
+ var COS = [];
20396
+ var SIN = [];
20397
+ for (let i = 0; i < SAMPLES; i++) {
20398
+ COS.push(Math.cos(i / SAMPLES * Math.PI * 2));
20399
+ SIN.push(Math.sin(i / SAMPLES * Math.PI * 2));
20400
+ }
20401
+ var RUNOFF_TILT = 6 * Math.PI / 180;
20402
+ var RUNOFF_TILT_MAX = 60 * Math.PI / 180;
20403
+ function hashCell(x, y) {
20404
+ let value = x * 374761393 + y * 668265263 | 0;
20405
+ value = (value ^ value >>> 13) * 1274126177 | 0;
20406
+ return ((value ^ value >>> 16) >>> 0) / 4294967296;
20407
+ }
20408
+ function valueNoise(x, y) {
20409
+ const xi = Math.floor(x);
20410
+ const yi = Math.floor(y);
20411
+ const xf = x - xi;
20412
+ const yf = y - yi;
20413
+ const u = xf * xf * (3 - 2 * xf);
20414
+ const v = yf * yf * (3 - 2 * yf);
20415
+ const a = hashCell(xi, yi);
20416
+ const b = hashCell(xi + 1, yi);
20417
+ const c = hashCell(xi, yi + 1);
20418
+ const d = hashCell(xi + 1, yi + 1);
20419
+ return a + (b - a) * u + (c - a) * v + (a - b - c + d) * u * v;
20420
+ }
20421
+ var REGION_NAMES = ["wall", "sidewalk", "curb", "road"];
20422
+ var dot3 = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
20423
+ function impactOf(region, position, velocity, cellSize) {
20424
+ const local = [position[0] - region.origin[0], position[1] - region.origin[1], position[2] - region.origin[2]];
20425
+ return {
20426
+ row: region.firstRow + dot3(local, region.rowAxis) / cellSize,
20427
+ column: dot3(local, region.columnAxis) / cellSize,
20428
+ along: [dot3(velocity, region.columnAxis), dot3(velocity, region.rowAxis)],
20429
+ normalSpeed: -dot3(velocity, region.normal)
20430
+ };
20431
+ }
20432
+ function cellToWorldOf(regions, cellSize, row, column) {
20433
+ let region = regions[regions.length - 1];
20434
+ for (const candidate of regions) {
20435
+ if (row < candidate.firstRow + candidate.rowCount) {
20436
+ region = candidate;
20437
+ break;
20438
+ }
20439
+ }
20440
+ const across = column * cellSize;
20441
+ const down = (row - region.firstRow) * cellSize;
20442
+ return [
20443
+ region.origin[0] + region.columnAxis[0] * across + region.rowAxis[0] * down,
20444
+ region.origin[1] + region.columnAxis[1] * across + region.rowAxis[1] * down,
20445
+ region.origin[2] + region.columnAxis[2] * across + region.rowAxis[2] * down
20446
+ ];
20447
+ }
20448
+ function createFoldedLayout(params) {
20449
+ const { columns, cellSize, originX, wallRows, sidewalkRows, curbRows, roadRows, wallTopY, sidewalkY, roadY, wallZ, rules } = params;
20450
+ const curbStep = params.curbStep ?? (sidewalkY - roadY) / curbRows;
20451
+ const height = wallRows + sidewalkRows + curbRows + roadRows;
20452
+ const cellCount = columns * height;
20453
+ const bed = new Float32Array(cellCount);
20454
+ const pin = new Float32Array(cellCount);
20455
+ const vertical = new Float32Array(cellCount);
20456
+ const sidewalkEnd = wallRows + sidewalkRows;
20457
+ const curbEnd = sidewalkEnd + curbRows;
20458
+ const regionOfRow = (row) => row < wallRows ? 0 : row < sidewalkEnd ? 1 : row < curbEnd ? 2 : 3;
20459
+ for (let row = 0; row < height; row++) {
20460
+ for (let column = 0; column < columns; column++) {
20461
+ const index = row * columns + column;
20462
+ const region = regionOfRow(row);
20463
+ const x = originX + (column + 0.5) * cellSize;
20464
+ let bedHeight;
20465
+ let roughness = 0.2;
20466
+ if (region === 0) {
20467
+ bedHeight = (wallTopY - (row + 0.5) * cellSize) * 1e3;
20468
+ roughness = 0.3;
20469
+ } else if (region === 1) {
20470
+ const z = (row - wallRows + 0.5) * cellSize;
20471
+ bedHeight = sidewalkY * 1e3 - z * 6;
20472
+ const jointX = Math.abs(((x - originX) % 0.5 + 0.5) % 0.5 - 0.25);
20473
+ const jointZ = Math.abs((z % 0.5 + 0.5) % 0.5 - 0.25);
20474
+ if (jointX > 0.25 - cellSize * 0.6 || jointZ > 0.25 - cellSize * 0.6) bedHeight -= 0.9;
20475
+ roughness = 0.18;
20476
+ } else if (region === 2) {
20477
+ bedHeight = sidewalkY * 1e3 - (row - sidewalkEnd + 0.5) * curbStep * 1e3;
20478
+ } else {
20479
+ const z = (row - curbEnd + 0.5) * cellSize;
20480
+ bedHeight = roadY * 1e3 + z * 14 - (x - params.roadSlopeAnchorX) * 5;
20481
+ roughness = 0.55;
20482
+ }
20483
+ const noise = valueNoise(column * 0.35, row * 0.35) * 0.6 + valueNoise(column * 1.3, row * 1.3) * 0.4;
20484
+ bed[index] = bedHeight + (noise - 0.5) * roughness * 2;
20485
+ vertical[index] = region === 0 || region === 2 ? 0.95 : 1;
20486
+ pin[index] = 0.62 + 0.76 * (valueNoise(column * 0.21 + 40, row * 0.21) * 0.5 + hashCell(column, row) * 0.5) * (region === 3 ? 1.25 : 1);
20487
+ }
20488
+ }
20489
+ const curbZ = wallZ + sidewalkRows * cellSize;
20490
+ const roadEndZ = curbZ + roadRows * cellSize;
20491
+ const right = [1, 0, 0];
20492
+ const regions = [
20493
+ { id: REGION_NAMES[0], firstRow: 0, rowCount: wallRows, origin: [originX, wallTopY, wallZ], columnAxis: right, rowAxis: [0, -1, 0], normal: [0, 0, 1], isVertical: true },
20494
+ { id: REGION_NAMES[1], firstRow: wallRows, rowCount: sidewalkRows, origin: [originX, sidewalkY, wallZ], columnAxis: right, rowAxis: [0, 0, 1], normal: [0, 1, 0], isVertical: false },
20495
+ { id: REGION_NAMES[2], firstRow: sidewalkEnd, rowCount: curbRows, origin: [originX, sidewalkY, curbZ], columnAxis: right, rowAxis: [0, -1, 0], normal: [0, 0, 1], isVertical: true },
20496
+ { id: REGION_NAMES[3], firstRow: curbEnd, rowCount: roadRows, origin: [originX, roadY, curbZ], columnAxis: right, rowAxis: [0, 0, 1], normal: [0, 1, 0], isVertical: false }
20497
+ ];
20498
+ const maxX = originX + columns * cellSize;
20499
+ return {
20500
+ id: params.id,
20501
+ width: columns,
20502
+ height,
20503
+ cellSize,
20504
+ bed,
20505
+ pin,
20506
+ vertical,
20507
+ regions,
20508
+ rules,
20509
+ cellToWorld: (row, column) => cellToWorldOf(regions, cellSize, row, column),
20510
+ collide(previous, position) {
20511
+ if (position[2] <= wallZ && position[1] > sidewalkY) {
20512
+ position[2] = wallZ;
20513
+ return 0;
20514
+ }
20515
+ if (position[2] < curbZ && (!rules.guardBehindWall || position[2] >= wallZ) && position[1] <= sidewalkY) {
20516
+ position[1] = sidewalkY;
20517
+ return 1;
20518
+ }
20519
+ if (rules.curbCatch && position[2] >= curbZ && previous[2] < curbZ && position[1] < sidewalkY) {
20520
+ position[2] = curbZ;
20521
+ return 2;
20522
+ }
20523
+ if (position[2] >= curbZ && position[1] <= roadY) {
20524
+ position[1] = roadY;
20525
+ return 3;
20526
+ }
20527
+ return -1;
20528
+ },
20529
+ impact: (region, position, velocity) => impactOf(regions[region], position, velocity, cellSize),
20530
+ contains: (position) => position[0] > originX && position[0] < maxX && (!rules.clipRoadEnd || position[2] < roadEndZ),
20531
+ escaped(position) {
20532
+ if (position[1] < -1) return true;
20533
+ const box = rules.escapeBox;
20534
+ return box !== void 0 && (position[0] < box.minX || position[0] > box.maxX || position[2] > box.maxZ);
20535
+ }
20536
+ };
20537
+ }
20538
+ var PADRAO_CELL = 0.0125;
20539
+ var PADRAO_WALL_Z = 0;
20540
+ var PADRAO_LAYOUT = createFoldedLayout({
20541
+ id: "padrao",
20542
+ columns: 256,
20543
+ cellSize: PADRAO_CELL,
20544
+ originX: -1.6,
20545
+ wallRows: 144,
20546
+ sidewalkRows: 128,
20547
+ curbRows: 12,
20548
+ roadRows: 112,
20549
+ wallTopY: 1.95,
20550
+ sidewalkY: 0.15,
20551
+ roadY: 0,
20552
+ wallZ: PADRAO_WALL_Z,
20553
+ curbStep: PADRAO_CELL,
20554
+ roadSlopeAnchorX: 0,
20555
+ rules: {
20556
+ dropCapacity: 600,
20557
+ curbCatch: true,
20558
+ guardBehindWall: true,
20559
+ clipRoadEnd: true,
20560
+ escapeBox: { minX: -3, maxX: 3, maxZ: PADRAO_WALL_Z + 128 * PADRAO_CELL + 112 * PADRAO_CELL + 1 },
20561
+ dripStyle: "padrao"
20562
+ }
20563
+ });
20564
+ var WORKSHOP_CELL = 0.0125;
20565
+ var WORKSHOP_LAYOUT = createFoldedLayout({
20566
+ id: "workshop",
20567
+ columns: 160,
20568
+ cellSize: WORKSHOP_CELL,
20569
+ originX: -2.2,
20570
+ wallRows: 160,
20571
+ sidewalkRows: 128,
20572
+ curbRows: 9,
20573
+ roadRows: 151,
20574
+ wallTopY: 2.12,
20575
+ sidewalkY: 0.1235,
20576
+ roadY: 9e-3,
20577
+ wallZ: -4.497,
20578
+ roadSlopeAnchorX: -1.2,
20579
+ rules: { dropCapacity: 400, curbCatch: false, guardBehindWall: false, clipRoadEnd: false, dripStyle: "workshop" }
20580
+ });
20581
+
20582
+ // src/item-use.ts
20583
+ var drinkHydrationOf = (item, liquids = LIQUIDS) => {
20584
+ const fluid = item.fluid;
20585
+ const drink = fluid ? liquids.find((liquid) => liquid.id === fluid.liquid)?.drink : void 0;
20586
+ if (!fluid || !drink) return void 0;
20587
+ const doses = item.durability?.kind === "doses" ? Math.max(1, item.durability.amount ?? 1) : 1;
20588
+ return drink.thirst * fluid.liters / doses;
20589
+ };
20590
+ var createGoodsItemUse = (options = {}) => {
20591
+ const kinds = options.kinds ?? createGoodsKinds();
20592
+ const effects = options.effects ?? GOODS_USE_EFFECTS;
20593
+ const liquids = options.liquids ?? LIQUIDS;
20594
+ return (item) => {
20595
+ if (item.kind === void 0 || !kinds.has(item.kind)) return void 0;
20596
+ const result = resolveUse(item, effects);
20597
+ const { clip: effectClip, ...params } = result?.params ?? {};
20598
+ const clip = typeof effectClip === "string" ? effectClip : resolveEntry(kinds, item).use?.clip;
20599
+ if (clip === void 0) return void 0;
20600
+ if (!result) return { clip, consumes: false };
20601
+ const nutrition = result.nutrition ? { satiety: result.nutrition.satiety, hydration: drinkHydrationOf(item, liquids) ?? result.nutrition.hydration } : {};
20602
+ return { clip, consumes: result.consumes, effect: { id: result.effect, ...Object.keys(params).length > 0 ? { params } : {}, ...nutrition } };
20603
+ };
20604
+ };
20605
+ var goodsItemUse = createGoodsItemUse();
19800
20606
  return __toCommonJS(index_exports);
19801
20607
  })();
19802
20608
  //# sourceMappingURL=index.global.js.map