@adatechnology/game-items-goods 0.4.6 → 0.5.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.
- package/dist/index.d.ts +19 -2
- package/dist/index.global.js +769 -0
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
package/dist/index.global.js
CHANGED
|
@@ -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
|
{
|
|
@@ -19797,6 +19852,720 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
19797
19852
|
var GOODS_STRINGS = { en: en_default, "pt-BR": pt_BR_default };
|
|
19798
19853
|
var pickGoodsLocale = (locale) => locale?.toLowerCase().startsWith("pt") ? "pt-BR" : "en";
|
|
19799
19854
|
var goodsText = (key, locale) => GOODS_STRINGS[pickGoodsLocale(locale)][key] ?? key;
|
|
19855
|
+
|
|
19856
|
+
// ../game-fluids/dist/index.js
|
|
19857
|
+
var liquids_default = [
|
|
19858
|
+
{
|
|
19859
|
+
id: "water",
|
|
19860
|
+
color: 11064558,
|
|
19861
|
+
opacity: 0.35,
|
|
19862
|
+
stainColor: 7309206,
|
|
19863
|
+
viscosity: 1,
|
|
19864
|
+
density: 1e3,
|
|
19865
|
+
dryTime: 180,
|
|
19866
|
+
gloss: 0.9,
|
|
19867
|
+
drink: {
|
|
19868
|
+
thirst: 100,
|
|
19869
|
+
effects: []
|
|
19870
|
+
},
|
|
19871
|
+
tags: [
|
|
19872
|
+
"drink",
|
|
19873
|
+
"clear"
|
|
19874
|
+
]
|
|
19875
|
+
},
|
|
19876
|
+
{
|
|
19877
|
+
id: "coffee",
|
|
19878
|
+
color: 3875604,
|
|
19879
|
+
opacity: 0.95,
|
|
19880
|
+
stainColor: 2824202,
|
|
19881
|
+
viscosity: 1.5,
|
|
19882
|
+
density: 1005,
|
|
19883
|
+
dryTime: 900,
|
|
19884
|
+
gloss: 0.8,
|
|
19885
|
+
leavesMark: true,
|
|
19886
|
+
steamC: 60,
|
|
19887
|
+
drink: {
|
|
19888
|
+
thirst: 80,
|
|
19889
|
+
effects: [
|
|
19890
|
+
"caffeine"
|
|
19891
|
+
]
|
|
19892
|
+
},
|
|
19893
|
+
tags: [
|
|
19894
|
+
"drink",
|
|
19895
|
+
"hot"
|
|
19896
|
+
]
|
|
19897
|
+
},
|
|
19898
|
+
{
|
|
19899
|
+
id: "tea",
|
|
19900
|
+
color: 9063188,
|
|
19901
|
+
opacity: 0.8,
|
|
19902
|
+
stainColor: 6961682,
|
|
19903
|
+
viscosity: 1.4,
|
|
19904
|
+
density: 1005,
|
|
19905
|
+
dryTime: 800,
|
|
19906
|
+
gloss: 0.8,
|
|
19907
|
+
leavesMark: true,
|
|
19908
|
+
steamC: 60,
|
|
19909
|
+
drink: {
|
|
19910
|
+
thirst: 90,
|
|
19911
|
+
effects: []
|
|
19912
|
+
},
|
|
19913
|
+
tags: [
|
|
19914
|
+
"drink",
|
|
19915
|
+
"hot"
|
|
19916
|
+
]
|
|
19917
|
+
},
|
|
19918
|
+
{
|
|
19919
|
+
id: "milk",
|
|
19920
|
+
color: 16052712,
|
|
19921
|
+
opacity: 0.98,
|
|
19922
|
+
stainColor: 14473160,
|
|
19923
|
+
viscosity: 2,
|
|
19924
|
+
density: 1030,
|
|
19925
|
+
dryTime: 900,
|
|
19926
|
+
gloss: 0.5,
|
|
19927
|
+
leavesMark: true,
|
|
19928
|
+
drink: {
|
|
19929
|
+
thirst: 70,
|
|
19930
|
+
effects: []
|
|
19931
|
+
},
|
|
19932
|
+
tags: [
|
|
19933
|
+
"drink"
|
|
19934
|
+
]
|
|
19935
|
+
},
|
|
19936
|
+
{
|
|
19937
|
+
id: "soda",
|
|
19938
|
+
color: 3808530,
|
|
19939
|
+
opacity: 0.85,
|
|
19940
|
+
stainColor: 2757901,
|
|
19941
|
+
viscosity: 1.3,
|
|
19942
|
+
density: 1040,
|
|
19943
|
+
dryTime: 1200,
|
|
19944
|
+
gloss: 0.85,
|
|
19945
|
+
leavesMark: true,
|
|
19946
|
+
drink: {
|
|
19947
|
+
thirst: 60,
|
|
19948
|
+
effects: []
|
|
19949
|
+
},
|
|
19950
|
+
tags: [
|
|
19951
|
+
"drink",
|
|
19952
|
+
"sticky"
|
|
19953
|
+
]
|
|
19954
|
+
},
|
|
19955
|
+
{
|
|
19956
|
+
id: "juice",
|
|
19957
|
+
color: 15239467,
|
|
19958
|
+
opacity: 0.9,
|
|
19959
|
+
stainColor: 12741916,
|
|
19960
|
+
viscosity: 2,
|
|
19961
|
+
density: 1045,
|
|
19962
|
+
dryTime: 1100,
|
|
19963
|
+
gloss: 0.8,
|
|
19964
|
+
leavesMark: true,
|
|
19965
|
+
drink: {
|
|
19966
|
+
thirst: 75,
|
|
19967
|
+
effects: []
|
|
19968
|
+
},
|
|
19969
|
+
tags: [
|
|
19970
|
+
"drink",
|
|
19971
|
+
"sticky"
|
|
19972
|
+
]
|
|
19973
|
+
},
|
|
19974
|
+
{
|
|
19975
|
+
id: "beer",
|
|
19976
|
+
color: 14259740,
|
|
19977
|
+
opacity: 0.8,
|
|
19978
|
+
stainColor: 11039764,
|
|
19979
|
+
viscosity: 1.4,
|
|
19980
|
+
density: 1010,
|
|
19981
|
+
dryTime: 900,
|
|
19982
|
+
gloss: 0.8,
|
|
19983
|
+
drink: {
|
|
19984
|
+
thirst: 50,
|
|
19985
|
+
effects: [
|
|
19986
|
+
"alcohol"
|
|
19987
|
+
]
|
|
19988
|
+
},
|
|
19989
|
+
tags: [
|
|
19990
|
+
"drink",
|
|
19991
|
+
"alcohol"
|
|
19992
|
+
]
|
|
19993
|
+
},
|
|
19994
|
+
{
|
|
19995
|
+
id: "wine",
|
|
19996
|
+
color: 7016223,
|
|
19997
|
+
opacity: 0.9,
|
|
19998
|
+
stainColor: 5048854,
|
|
19999
|
+
viscosity: 1.6,
|
|
20000
|
+
density: 990,
|
|
20001
|
+
dryTime: 800,
|
|
20002
|
+
gloss: 0.85,
|
|
20003
|
+
leavesMark: true,
|
|
20004
|
+
drink: {
|
|
20005
|
+
thirst: 40,
|
|
20006
|
+
effects: [
|
|
20007
|
+
"alcohol"
|
|
20008
|
+
]
|
|
20009
|
+
},
|
|
20010
|
+
tags: [
|
|
20011
|
+
"drink",
|
|
20012
|
+
"alcohol"
|
|
20013
|
+
]
|
|
20014
|
+
},
|
|
20015
|
+
{
|
|
20016
|
+
id: "spirits",
|
|
20017
|
+
color: 13214042,
|
|
20018
|
+
opacity: 0.6,
|
|
20019
|
+
stainColor: 10320959,
|
|
20020
|
+
viscosity: 1.8,
|
|
20021
|
+
density: 940,
|
|
20022
|
+
dryTime: 200,
|
|
20023
|
+
gloss: 0.85,
|
|
20024
|
+
flammable: true,
|
|
20025
|
+
drink: {
|
|
20026
|
+
thirst: 5,
|
|
20027
|
+
effects: [
|
|
20028
|
+
"alcohol"
|
|
20029
|
+
]
|
|
20030
|
+
},
|
|
20031
|
+
tags: [
|
|
20032
|
+
"drink",
|
|
20033
|
+
"alcohol"
|
|
20034
|
+
]
|
|
20035
|
+
},
|
|
20036
|
+
{
|
|
20037
|
+
id: "fuel",
|
|
20038
|
+
color: 14926682,
|
|
20039
|
+
opacity: 0.6,
|
|
20040
|
+
stainColor: 7232298,
|
|
20041
|
+
viscosity: 0.6,
|
|
20042
|
+
density: 740,
|
|
20043
|
+
dryTime: 60,
|
|
20044
|
+
gloss: 0.95,
|
|
20045
|
+
leavesMark: false,
|
|
20046
|
+
flammable: true,
|
|
20047
|
+
drink: {
|
|
20048
|
+
thirst: 0,
|
|
20049
|
+
effects: [
|
|
20050
|
+
"poison"
|
|
20051
|
+
]
|
|
20052
|
+
},
|
|
20053
|
+
tags: [
|
|
20054
|
+
"fuel",
|
|
20055
|
+
"gasoline"
|
|
20056
|
+
]
|
|
20057
|
+
},
|
|
20058
|
+
{
|
|
20059
|
+
id: "diesel",
|
|
20060
|
+
color: 12098094,
|
|
20061
|
+
opacity: 0.8,
|
|
20062
|
+
stainColor: 5917208,
|
|
20063
|
+
viscosity: 3,
|
|
20064
|
+
density: 830,
|
|
20065
|
+
dryTime: 3600,
|
|
20066
|
+
gloss: 0.95,
|
|
20067
|
+
leavesMark: true,
|
|
20068
|
+
flammable: true,
|
|
20069
|
+
drink: {
|
|
20070
|
+
thirst: 0,
|
|
20071
|
+
effects: [
|
|
20072
|
+
"poison"
|
|
20073
|
+
]
|
|
20074
|
+
},
|
|
20075
|
+
tags: [
|
|
20076
|
+
"fuel"
|
|
20077
|
+
]
|
|
20078
|
+
},
|
|
20079
|
+
{
|
|
20080
|
+
id: "motor_oil",
|
|
20081
|
+
color: 3877388,
|
|
20082
|
+
opacity: 0.95,
|
|
20083
|
+
stainColor: 1840134,
|
|
20084
|
+
viscosity: 100,
|
|
20085
|
+
density: 880,
|
|
20086
|
+
dryTime: 0,
|
|
20087
|
+
gloss: 1,
|
|
20088
|
+
leavesMark: true,
|
|
20089
|
+
flammable: true,
|
|
20090
|
+
drink: {
|
|
20091
|
+
thirst: 0,
|
|
20092
|
+
effects: [
|
|
20093
|
+
"poison"
|
|
20094
|
+
]
|
|
20095
|
+
},
|
|
20096
|
+
tags: [
|
|
20097
|
+
"oil"
|
|
20098
|
+
]
|
|
20099
|
+
},
|
|
20100
|
+
{
|
|
20101
|
+
id: "cooking_oil",
|
|
20102
|
+
color: 14267708,
|
|
20103
|
+
opacity: 0.85,
|
|
20104
|
+
stainColor: 11110698,
|
|
20105
|
+
viscosity: 60,
|
|
20106
|
+
density: 920,
|
|
20107
|
+
dryTime: 0,
|
|
20108
|
+
gloss: 1,
|
|
20109
|
+
leavesMark: true,
|
|
20110
|
+
flammable: true,
|
|
20111
|
+
drink: {
|
|
20112
|
+
thirst: 0,
|
|
20113
|
+
effects: [
|
|
20114
|
+
"poison"
|
|
20115
|
+
]
|
|
20116
|
+
},
|
|
20117
|
+
tags: [
|
|
20118
|
+
"oil",
|
|
20119
|
+
"food"
|
|
20120
|
+
]
|
|
20121
|
+
},
|
|
20122
|
+
{
|
|
20123
|
+
id: "blood",
|
|
20124
|
+
color: 7997964,
|
|
20125
|
+
opacity: 0.92,
|
|
20126
|
+
stainColor: 3874068,
|
|
20127
|
+
viscosity: 4,
|
|
20128
|
+
density: 1060,
|
|
20129
|
+
dryTime: 600,
|
|
20130
|
+
gloss: 0.75,
|
|
20131
|
+
leavesMark: true,
|
|
20132
|
+
drink: {
|
|
20133
|
+
thirst: 10,
|
|
20134
|
+
effects: [
|
|
20135
|
+
"disgust"
|
|
20136
|
+
]
|
|
20137
|
+
},
|
|
20138
|
+
tags: [
|
|
20139
|
+
"organic"
|
|
20140
|
+
]
|
|
20141
|
+
},
|
|
20142
|
+
{
|
|
20143
|
+
id: "old_blood",
|
|
20144
|
+
color: 7085078,
|
|
20145
|
+
opacity: 0.92,
|
|
20146
|
+
stainColor: 2758158,
|
|
20147
|
+
viscosity: 4,
|
|
20148
|
+
density: 1060,
|
|
20149
|
+
dryTime: 360,
|
|
20150
|
+
gloss: 0.7,
|
|
20151
|
+
leavesMark: true,
|
|
20152
|
+
drink: {
|
|
20153
|
+
thirst: 10,
|
|
20154
|
+
effects: [
|
|
20155
|
+
"disgust"
|
|
20156
|
+
]
|
|
20157
|
+
},
|
|
20158
|
+
tags: [
|
|
20159
|
+
"organic"
|
|
20160
|
+
]
|
|
20161
|
+
},
|
|
20162
|
+
{
|
|
20163
|
+
id: "bile",
|
|
20164
|
+
color: 9083434,
|
|
20165
|
+
opacity: 0.9,
|
|
20166
|
+
stainColor: 4080160,
|
|
20167
|
+
viscosity: 6,
|
|
20168
|
+
density: 1020,
|
|
20169
|
+
dryTime: 900,
|
|
20170
|
+
gloss: 0.75,
|
|
20171
|
+
leavesMark: true,
|
|
20172
|
+
drink: {
|
|
20173
|
+
thirst: 0,
|
|
20174
|
+
effects: [
|
|
20175
|
+
"disgust"
|
|
20176
|
+
]
|
|
20177
|
+
},
|
|
20178
|
+
tags: [
|
|
20179
|
+
"organic"
|
|
20180
|
+
]
|
|
20181
|
+
},
|
|
20182
|
+
{
|
|
20183
|
+
id: "sap",
|
|
20184
|
+
color: 13146940,
|
|
20185
|
+
opacity: 0.8,
|
|
20186
|
+
stainColor: 10122282,
|
|
20187
|
+
viscosity: 200,
|
|
20188
|
+
density: 1100,
|
|
20189
|
+
dryTime: 3600,
|
|
20190
|
+
gloss: 0.8,
|
|
20191
|
+
leavesMark: true,
|
|
20192
|
+
drink: {
|
|
20193
|
+
thirst: 20,
|
|
20194
|
+
effects: []
|
|
20195
|
+
},
|
|
20196
|
+
tags: [
|
|
20197
|
+
"organic",
|
|
20198
|
+
"sticky"
|
|
20199
|
+
]
|
|
20200
|
+
},
|
|
20201
|
+
{
|
|
20202
|
+
id: "acid",
|
|
20203
|
+
color: 10146378,
|
|
20204
|
+
opacity: 0.6,
|
|
20205
|
+
stainColor: 7313970,
|
|
20206
|
+
viscosity: 1.5,
|
|
20207
|
+
density: 1200,
|
|
20208
|
+
dryTime: 900,
|
|
20209
|
+
gloss: 0.9,
|
|
20210
|
+
leavesMark: true,
|
|
20211
|
+
drink: {
|
|
20212
|
+
thirst: 0,
|
|
20213
|
+
effects: [
|
|
20214
|
+
"poison"
|
|
20215
|
+
]
|
|
20216
|
+
},
|
|
20217
|
+
tags: [
|
|
20218
|
+
"corrosive"
|
|
20219
|
+
]
|
|
20220
|
+
},
|
|
20221
|
+
{
|
|
20222
|
+
id: "paint",
|
|
20223
|
+
color: 11740715,
|
|
20224
|
+
opacity: 0.98,
|
|
20225
|
+
stainColor: 9050655,
|
|
20226
|
+
viscosity: 300,
|
|
20227
|
+
density: 1300,
|
|
20228
|
+
dryTime: 1800,
|
|
20229
|
+
gloss: 0.6,
|
|
20230
|
+
leavesMark: true,
|
|
20231
|
+
drink: {
|
|
20232
|
+
thirst: 0,
|
|
20233
|
+
effects: [
|
|
20234
|
+
"poison"
|
|
20235
|
+
]
|
|
20236
|
+
},
|
|
20237
|
+
tags: [
|
|
20238
|
+
"paint"
|
|
20239
|
+
]
|
|
20240
|
+
},
|
|
20241
|
+
{
|
|
20242
|
+
id: "bleach",
|
|
20243
|
+
color: 15134688,
|
|
20244
|
+
opacity: 0.7,
|
|
20245
|
+
stainColor: 13621446,
|
|
20246
|
+
viscosity: 1.2,
|
|
20247
|
+
density: 1100,
|
|
20248
|
+
dryTime: 900,
|
|
20249
|
+
gloss: 0.85,
|
|
20250
|
+
leavesMark: true,
|
|
20251
|
+
drink: {
|
|
20252
|
+
thirst: 0,
|
|
20253
|
+
effects: [
|
|
20254
|
+
"poison"
|
|
20255
|
+
]
|
|
20256
|
+
},
|
|
20257
|
+
tags: [
|
|
20258
|
+
"corrosive"
|
|
20259
|
+
]
|
|
20260
|
+
},
|
|
20261
|
+
{
|
|
20262
|
+
id: "sewage",
|
|
20263
|
+
color: 5921582,
|
|
20264
|
+
opacity: 0.92,
|
|
20265
|
+
stainColor: 3093273,
|
|
20266
|
+
viscosity: 4,
|
|
20267
|
+
density: 1010,
|
|
20268
|
+
dryTime: 1800,
|
|
20269
|
+
gloss: 0.8,
|
|
20270
|
+
leavesMark: true,
|
|
20271
|
+
drink: {
|
|
20272
|
+
thirst: 0,
|
|
20273
|
+
effects: [
|
|
20274
|
+
"disgust",
|
|
20275
|
+
"poison"
|
|
20276
|
+
]
|
|
20277
|
+
},
|
|
20278
|
+
tags: [
|
|
20279
|
+
"organic",
|
|
20280
|
+
"waste"
|
|
20281
|
+
]
|
|
20282
|
+
},
|
|
20283
|
+
{
|
|
20284
|
+
id: "honey",
|
|
20285
|
+
color: 14193162,
|
|
20286
|
+
opacity: 0.9,
|
|
20287
|
+
stainColor: 12089350,
|
|
20288
|
+
viscosity: 3e3,
|
|
20289
|
+
density: 1420,
|
|
20290
|
+
dryTime: 14400,
|
|
20291
|
+
gloss: 0.95,
|
|
20292
|
+
leavesMark: true,
|
|
20293
|
+
drink: {
|
|
20294
|
+
thirst: 10,
|
|
20295
|
+
effects: []
|
|
20296
|
+
},
|
|
20297
|
+
tags: [
|
|
20298
|
+
"drink",
|
|
20299
|
+
"sticky"
|
|
20300
|
+
]
|
|
20301
|
+
},
|
|
20302
|
+
{
|
|
20303
|
+
id: "mud",
|
|
20304
|
+
color: 4008988,
|
|
20305
|
+
opacity: 0.95,
|
|
20306
|
+
stainColor: 3811866,
|
|
20307
|
+
viscosity: 40,
|
|
20308
|
+
density: 1600,
|
|
20309
|
+
dryTime: 900,
|
|
20310
|
+
gloss: 0.4,
|
|
20311
|
+
tags: [
|
|
20312
|
+
"dirty"
|
|
20313
|
+
]
|
|
20314
|
+
},
|
|
20315
|
+
{
|
|
20316
|
+
id: "coolant",
|
|
20317
|
+
color: 3455050,
|
|
20318
|
+
opacity: 0.7,
|
|
20319
|
+
stainColor: 2783796,
|
|
20320
|
+
viscosity: 4,
|
|
20321
|
+
density: 1070,
|
|
20322
|
+
dryTime: 1200,
|
|
20323
|
+
gloss: 0.85,
|
|
20324
|
+
leavesMark: true,
|
|
20325
|
+
drink: {
|
|
20326
|
+
thirst: 0,
|
|
20327
|
+
effects: [
|
|
20328
|
+
"poison"
|
|
20329
|
+
]
|
|
20330
|
+
},
|
|
20331
|
+
tags: [
|
|
20332
|
+
"coolant"
|
|
20333
|
+
]
|
|
20334
|
+
},
|
|
20335
|
+
{
|
|
20336
|
+
id: "brake_fluid",
|
|
20337
|
+
color: 13145646,
|
|
20338
|
+
opacity: 0.8,
|
|
20339
|
+
stainColor: 9069600,
|
|
20340
|
+
viscosity: 8,
|
|
20341
|
+
density: 1050,
|
|
20342
|
+
dryTime: 3600,
|
|
20343
|
+
gloss: 0.9,
|
|
20344
|
+
leavesMark: true,
|
|
20345
|
+
drink: {
|
|
20346
|
+
thirst: 0,
|
|
20347
|
+
effects: [
|
|
20348
|
+
"poison"
|
|
20349
|
+
]
|
|
20350
|
+
},
|
|
20351
|
+
tags: [
|
|
20352
|
+
"brake_fluid"
|
|
20353
|
+
]
|
|
20354
|
+
}
|
|
20355
|
+
];
|
|
20356
|
+
var LIQUIDS = liquids_default;
|
|
20357
|
+
var SAMPLES = 16;
|
|
20358
|
+
var COS = [];
|
|
20359
|
+
var SIN = [];
|
|
20360
|
+
for (let i = 0; i < SAMPLES; i++) {
|
|
20361
|
+
COS.push(Math.cos(i / SAMPLES * Math.PI * 2));
|
|
20362
|
+
SIN.push(Math.sin(i / SAMPLES * Math.PI * 2));
|
|
20363
|
+
}
|
|
20364
|
+
var RUNOFF_TILT = 6 * Math.PI / 180;
|
|
20365
|
+
var RUNOFF_TILT_MAX = 60 * Math.PI / 180;
|
|
20366
|
+
function hashCell(x, y) {
|
|
20367
|
+
let value = x * 374761393 + y * 668265263 | 0;
|
|
20368
|
+
value = (value ^ value >>> 13) * 1274126177 | 0;
|
|
20369
|
+
return ((value ^ value >>> 16) >>> 0) / 4294967296;
|
|
20370
|
+
}
|
|
20371
|
+
function valueNoise(x, y) {
|
|
20372
|
+
const xi = Math.floor(x);
|
|
20373
|
+
const yi = Math.floor(y);
|
|
20374
|
+
const xf = x - xi;
|
|
20375
|
+
const yf = y - yi;
|
|
20376
|
+
const u = xf * xf * (3 - 2 * xf);
|
|
20377
|
+
const v = yf * yf * (3 - 2 * yf);
|
|
20378
|
+
const a = hashCell(xi, yi);
|
|
20379
|
+
const b = hashCell(xi + 1, yi);
|
|
20380
|
+
const c = hashCell(xi, yi + 1);
|
|
20381
|
+
const d = hashCell(xi + 1, yi + 1);
|
|
20382
|
+
return a + (b - a) * u + (c - a) * v + (a - b - c + d) * u * v;
|
|
20383
|
+
}
|
|
20384
|
+
var REGION_NAMES = ["wall", "sidewalk", "curb", "road"];
|
|
20385
|
+
var dot3 = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
20386
|
+
function impactOf(region, position, velocity, cellSize) {
|
|
20387
|
+
const local = [position[0] - region.origin[0], position[1] - region.origin[1], position[2] - region.origin[2]];
|
|
20388
|
+
return {
|
|
20389
|
+
row: region.firstRow + dot3(local, region.rowAxis) / cellSize,
|
|
20390
|
+
column: dot3(local, region.columnAxis) / cellSize,
|
|
20391
|
+
along: [dot3(velocity, region.columnAxis), dot3(velocity, region.rowAxis)],
|
|
20392
|
+
normalSpeed: -dot3(velocity, region.normal)
|
|
20393
|
+
};
|
|
20394
|
+
}
|
|
20395
|
+
function cellToWorldOf(regions, cellSize, row, column) {
|
|
20396
|
+
let region = regions[regions.length - 1];
|
|
20397
|
+
for (const candidate of regions) {
|
|
20398
|
+
if (row < candidate.firstRow + candidate.rowCount) {
|
|
20399
|
+
region = candidate;
|
|
20400
|
+
break;
|
|
20401
|
+
}
|
|
20402
|
+
}
|
|
20403
|
+
const across = column * cellSize;
|
|
20404
|
+
const down = (row - region.firstRow) * cellSize;
|
|
20405
|
+
return [
|
|
20406
|
+
region.origin[0] + region.columnAxis[0] * across + region.rowAxis[0] * down,
|
|
20407
|
+
region.origin[1] + region.columnAxis[1] * across + region.rowAxis[1] * down,
|
|
20408
|
+
region.origin[2] + region.columnAxis[2] * across + region.rowAxis[2] * down
|
|
20409
|
+
];
|
|
20410
|
+
}
|
|
20411
|
+
function createFoldedLayout(params) {
|
|
20412
|
+
const { columns, cellSize, originX, wallRows, sidewalkRows, curbRows, roadRows, wallTopY, sidewalkY, roadY, wallZ, rules } = params;
|
|
20413
|
+
const curbStep = params.curbStep ?? (sidewalkY - roadY) / curbRows;
|
|
20414
|
+
const height = wallRows + sidewalkRows + curbRows + roadRows;
|
|
20415
|
+
const cellCount = columns * height;
|
|
20416
|
+
const bed = new Float32Array(cellCount);
|
|
20417
|
+
const pin = new Float32Array(cellCount);
|
|
20418
|
+
const vertical = new Float32Array(cellCount);
|
|
20419
|
+
const sidewalkEnd = wallRows + sidewalkRows;
|
|
20420
|
+
const curbEnd = sidewalkEnd + curbRows;
|
|
20421
|
+
const regionOfRow = (row) => row < wallRows ? 0 : row < sidewalkEnd ? 1 : row < curbEnd ? 2 : 3;
|
|
20422
|
+
for (let row = 0; row < height; row++) {
|
|
20423
|
+
for (let column = 0; column < columns; column++) {
|
|
20424
|
+
const index = row * columns + column;
|
|
20425
|
+
const region = regionOfRow(row);
|
|
20426
|
+
const x = originX + (column + 0.5) * cellSize;
|
|
20427
|
+
let bedHeight;
|
|
20428
|
+
let roughness = 0.2;
|
|
20429
|
+
if (region === 0) {
|
|
20430
|
+
bedHeight = (wallTopY - (row + 0.5) * cellSize) * 1e3;
|
|
20431
|
+
roughness = 0.3;
|
|
20432
|
+
} else if (region === 1) {
|
|
20433
|
+
const z = (row - wallRows + 0.5) * cellSize;
|
|
20434
|
+
bedHeight = sidewalkY * 1e3 - z * 6;
|
|
20435
|
+
const jointX = Math.abs(((x - originX) % 0.5 + 0.5) % 0.5 - 0.25);
|
|
20436
|
+
const jointZ = Math.abs((z % 0.5 + 0.5) % 0.5 - 0.25);
|
|
20437
|
+
if (jointX > 0.25 - cellSize * 0.6 || jointZ > 0.25 - cellSize * 0.6) bedHeight -= 0.9;
|
|
20438
|
+
roughness = 0.18;
|
|
20439
|
+
} else if (region === 2) {
|
|
20440
|
+
bedHeight = sidewalkY * 1e3 - (row - sidewalkEnd + 0.5) * curbStep * 1e3;
|
|
20441
|
+
} else {
|
|
20442
|
+
const z = (row - curbEnd + 0.5) * cellSize;
|
|
20443
|
+
bedHeight = roadY * 1e3 + z * 14 - (x - params.roadSlopeAnchorX) * 5;
|
|
20444
|
+
roughness = 0.55;
|
|
20445
|
+
}
|
|
20446
|
+
const noise = valueNoise(column * 0.35, row * 0.35) * 0.6 + valueNoise(column * 1.3, row * 1.3) * 0.4;
|
|
20447
|
+
bed[index] = bedHeight + (noise - 0.5) * roughness * 2;
|
|
20448
|
+
vertical[index] = region === 0 || region === 2 ? 0.95 : 1;
|
|
20449
|
+
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);
|
|
20450
|
+
}
|
|
20451
|
+
}
|
|
20452
|
+
const curbZ = wallZ + sidewalkRows * cellSize;
|
|
20453
|
+
const roadEndZ = curbZ + roadRows * cellSize;
|
|
20454
|
+
const right = [1, 0, 0];
|
|
20455
|
+
const regions = [
|
|
20456
|
+
{ id: REGION_NAMES[0], firstRow: 0, rowCount: wallRows, origin: [originX, wallTopY, wallZ], columnAxis: right, rowAxis: [0, -1, 0], normal: [0, 0, 1], isVertical: true },
|
|
20457
|
+
{ id: REGION_NAMES[1], firstRow: wallRows, rowCount: sidewalkRows, origin: [originX, sidewalkY, wallZ], columnAxis: right, rowAxis: [0, 0, 1], normal: [0, 1, 0], isVertical: false },
|
|
20458
|
+
{ id: REGION_NAMES[2], firstRow: sidewalkEnd, rowCount: curbRows, origin: [originX, sidewalkY, curbZ], columnAxis: right, rowAxis: [0, -1, 0], normal: [0, 0, 1], isVertical: true },
|
|
20459
|
+
{ id: REGION_NAMES[3], firstRow: curbEnd, rowCount: roadRows, origin: [originX, roadY, curbZ], columnAxis: right, rowAxis: [0, 0, 1], normal: [0, 1, 0], isVertical: false }
|
|
20460
|
+
];
|
|
20461
|
+
const maxX = originX + columns * cellSize;
|
|
20462
|
+
return {
|
|
20463
|
+
id: params.id,
|
|
20464
|
+
width: columns,
|
|
20465
|
+
height,
|
|
20466
|
+
cellSize,
|
|
20467
|
+
bed,
|
|
20468
|
+
pin,
|
|
20469
|
+
vertical,
|
|
20470
|
+
regions,
|
|
20471
|
+
rules,
|
|
20472
|
+
cellToWorld: (row, column) => cellToWorldOf(regions, cellSize, row, column),
|
|
20473
|
+
collide(previous, position) {
|
|
20474
|
+
if (position[2] <= wallZ && position[1] > sidewalkY) {
|
|
20475
|
+
position[2] = wallZ;
|
|
20476
|
+
return 0;
|
|
20477
|
+
}
|
|
20478
|
+
if (position[2] < curbZ && (!rules.guardBehindWall || position[2] >= wallZ) && position[1] <= sidewalkY) {
|
|
20479
|
+
position[1] = sidewalkY;
|
|
20480
|
+
return 1;
|
|
20481
|
+
}
|
|
20482
|
+
if (rules.curbCatch && position[2] >= curbZ && previous[2] < curbZ && position[1] < sidewalkY) {
|
|
20483
|
+
position[2] = curbZ;
|
|
20484
|
+
return 2;
|
|
20485
|
+
}
|
|
20486
|
+
if (position[2] >= curbZ && position[1] <= roadY) {
|
|
20487
|
+
position[1] = roadY;
|
|
20488
|
+
return 3;
|
|
20489
|
+
}
|
|
20490
|
+
return -1;
|
|
20491
|
+
},
|
|
20492
|
+
impact: (region, position, velocity) => impactOf(regions[region], position, velocity, cellSize),
|
|
20493
|
+
contains: (position) => position[0] > originX && position[0] < maxX && (!rules.clipRoadEnd || position[2] < roadEndZ),
|
|
20494
|
+
escaped(position) {
|
|
20495
|
+
if (position[1] < -1) return true;
|
|
20496
|
+
const box = rules.escapeBox;
|
|
20497
|
+
return box !== void 0 && (position[0] < box.minX || position[0] > box.maxX || position[2] > box.maxZ);
|
|
20498
|
+
}
|
|
20499
|
+
};
|
|
20500
|
+
}
|
|
20501
|
+
var PADRAO_CELL = 0.0125;
|
|
20502
|
+
var PADRAO_WALL_Z = 0;
|
|
20503
|
+
var PADRAO_LAYOUT = createFoldedLayout({
|
|
20504
|
+
id: "padrao",
|
|
20505
|
+
columns: 256,
|
|
20506
|
+
cellSize: PADRAO_CELL,
|
|
20507
|
+
originX: -1.6,
|
|
20508
|
+
wallRows: 144,
|
|
20509
|
+
sidewalkRows: 128,
|
|
20510
|
+
curbRows: 12,
|
|
20511
|
+
roadRows: 112,
|
|
20512
|
+
wallTopY: 1.95,
|
|
20513
|
+
sidewalkY: 0.15,
|
|
20514
|
+
roadY: 0,
|
|
20515
|
+
wallZ: PADRAO_WALL_Z,
|
|
20516
|
+
curbStep: PADRAO_CELL,
|
|
20517
|
+
roadSlopeAnchorX: 0,
|
|
20518
|
+
rules: {
|
|
20519
|
+
dropCapacity: 600,
|
|
20520
|
+
curbCatch: true,
|
|
20521
|
+
guardBehindWall: true,
|
|
20522
|
+
clipRoadEnd: true,
|
|
20523
|
+
escapeBox: { minX: -3, maxX: 3, maxZ: PADRAO_WALL_Z + 128 * PADRAO_CELL + 112 * PADRAO_CELL + 1 },
|
|
20524
|
+
dripStyle: "padrao"
|
|
20525
|
+
}
|
|
20526
|
+
});
|
|
20527
|
+
var WORKSHOP_CELL = 0.0125;
|
|
20528
|
+
var WORKSHOP_LAYOUT = createFoldedLayout({
|
|
20529
|
+
id: "workshop",
|
|
20530
|
+
columns: 160,
|
|
20531
|
+
cellSize: WORKSHOP_CELL,
|
|
20532
|
+
originX: -2.2,
|
|
20533
|
+
wallRows: 160,
|
|
20534
|
+
sidewalkRows: 128,
|
|
20535
|
+
curbRows: 9,
|
|
20536
|
+
roadRows: 151,
|
|
20537
|
+
wallTopY: 2.12,
|
|
20538
|
+
sidewalkY: 0.1235,
|
|
20539
|
+
roadY: 9e-3,
|
|
20540
|
+
wallZ: -4.497,
|
|
20541
|
+
roadSlopeAnchorX: -1.2,
|
|
20542
|
+
rules: { dropCapacity: 400, curbCatch: false, guardBehindWall: false, clipRoadEnd: false, dripStyle: "workshop" }
|
|
20543
|
+
});
|
|
20544
|
+
|
|
20545
|
+
// src/item-use.ts
|
|
20546
|
+
var drinkHydrationOf = (item, liquids = LIQUIDS) => {
|
|
20547
|
+
const fluid = item.fluid;
|
|
20548
|
+
const drink = fluid ? liquids.find((liquid) => liquid.id === fluid.liquid)?.drink : void 0;
|
|
20549
|
+
if (!fluid || !drink) return void 0;
|
|
20550
|
+
const doses = item.durability?.kind === "doses" ? Math.max(1, item.durability.amount ?? 1) : 1;
|
|
20551
|
+
return drink.thirst * fluid.liters / doses;
|
|
20552
|
+
};
|
|
20553
|
+
var createGoodsItemUse = (options = {}) => {
|
|
20554
|
+
const kinds = options.kinds ?? createGoodsKinds();
|
|
20555
|
+
const effects = options.effects ?? GOODS_USE_EFFECTS;
|
|
20556
|
+
const liquids = options.liquids ?? LIQUIDS;
|
|
20557
|
+
return (item) => {
|
|
20558
|
+
if (item.kind === void 0 || !kinds.has(item.kind)) return void 0;
|
|
20559
|
+
const result = resolveUse(item, effects);
|
|
20560
|
+
const { clip: effectClip, ...params } = result?.params ?? {};
|
|
20561
|
+
const clip = typeof effectClip === "string" ? effectClip : resolveEntry(kinds, item).use?.clip;
|
|
20562
|
+
if (clip === void 0) return void 0;
|
|
20563
|
+
if (!result) return { clip, consumes: false };
|
|
20564
|
+
const nutrition = result.nutrition ? { satiety: result.nutrition.satiety, hydration: drinkHydrationOf(item, liquids) ?? result.nutrition.hydration } : {};
|
|
20565
|
+
return { clip, consumes: result.consumes, effect: { id: result.effect, ...Object.keys(params).length > 0 ? { params } : {}, ...nutrition } };
|
|
20566
|
+
};
|
|
20567
|
+
};
|
|
20568
|
+
var goodsItemUse = createGoodsItemUse();
|
|
19800
20569
|
return __toCommonJS(index_exports);
|
|
19801
20570
|
})();
|
|
19802
20571
|
//# sourceMappingURL=index.global.js.map
|