@adatechnology/game-weapons 0.3.1 → 0.4.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.d.ts +4 -7
- package/dist/index.global.js +233 -29
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +210 -30
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1132,6 +1132,9 @@ var attachments_default = [
|
|
|
1132
1132
|
}
|
|
1133
1133
|
];
|
|
1134
1134
|
|
|
1135
|
+
// src/arsenal.ts
|
|
1136
|
+
import { applyPatches, deepMerge as deepMerge2, mergeById, removeIds } from "@adatechnology/game-contracts";
|
|
1137
|
+
|
|
1135
1138
|
// src/data/archetypes.json
|
|
1136
1139
|
var archetypes_default = [
|
|
1137
1140
|
{
|
|
@@ -11088,6 +11091,209 @@ var canFit = (def, attachment, fitted, context, mount) => {
|
|
|
11088
11091
|
return { ok: true, mount: place.kind };
|
|
11089
11092
|
};
|
|
11090
11093
|
|
|
11094
|
+
// src/data/melee-weapons.json
|
|
11095
|
+
var melee_weapons_default = [
|
|
11096
|
+
{
|
|
11097
|
+
id: "tactical_knife",
|
|
11098
|
+
name: "Tactical knife",
|
|
11099
|
+
category: "melee_blade",
|
|
11100
|
+
action: {
|
|
11101
|
+
kind: "melee",
|
|
11102
|
+
damage: "slash",
|
|
11103
|
+
energy: 45,
|
|
11104
|
+
radius: 0.03,
|
|
11105
|
+
reach: 0.6,
|
|
11106
|
+
rpm: 100,
|
|
11107
|
+
noise: 1
|
|
11108
|
+
},
|
|
11109
|
+
mass: 0.3
|
|
11110
|
+
},
|
|
11111
|
+
{
|
|
11112
|
+
id: "meat_cleaver",
|
|
11113
|
+
name: "Meat cleaver",
|
|
11114
|
+
category: "melee_blade",
|
|
11115
|
+
action: {
|
|
11116
|
+
kind: "melee",
|
|
11117
|
+
damage: "slash",
|
|
11118
|
+
energy: 120,
|
|
11119
|
+
radius: 0.05,
|
|
11120
|
+
reach: 0.6,
|
|
11121
|
+
rpm: 70,
|
|
11122
|
+
noise: 2
|
|
11123
|
+
},
|
|
11124
|
+
mass: 0.6
|
|
11125
|
+
},
|
|
11126
|
+
{
|
|
11127
|
+
id: "hatchet",
|
|
11128
|
+
name: "Hatchet",
|
|
11129
|
+
category: "melee_blade",
|
|
11130
|
+
action: {
|
|
11131
|
+
kind: "melee",
|
|
11132
|
+
damage: "slash",
|
|
11133
|
+
energy: 180,
|
|
11134
|
+
radius: 0.06,
|
|
11135
|
+
reach: 0.7,
|
|
11136
|
+
rpm: 55,
|
|
11137
|
+
noise: 2
|
|
11138
|
+
},
|
|
11139
|
+
mass: 0.8
|
|
11140
|
+
},
|
|
11141
|
+
{
|
|
11142
|
+
id: "nail_bat",
|
|
11143
|
+
name: "Nail bat",
|
|
11144
|
+
category: "melee_blunt",
|
|
11145
|
+
action: {
|
|
11146
|
+
kind: "melee",
|
|
11147
|
+
damage: "blunt",
|
|
11148
|
+
energy: 170,
|
|
11149
|
+
radius: 0.1,
|
|
11150
|
+
reach: 1,
|
|
11151
|
+
rpm: 60,
|
|
11152
|
+
noise: 3
|
|
11153
|
+
},
|
|
11154
|
+
mass: 1.2
|
|
11155
|
+
},
|
|
11156
|
+
{
|
|
11157
|
+
id: "iron_pipe",
|
|
11158
|
+
name: "Iron pipe",
|
|
11159
|
+
category: "melee_blunt",
|
|
11160
|
+
action: {
|
|
11161
|
+
kind: "melee",
|
|
11162
|
+
damage: "blunt",
|
|
11163
|
+
energy: 140,
|
|
11164
|
+
radius: 0.06,
|
|
11165
|
+
reach: 1,
|
|
11166
|
+
rpm: 60,
|
|
11167
|
+
noise: 4
|
|
11168
|
+
},
|
|
11169
|
+
mass: 1.2
|
|
11170
|
+
},
|
|
11171
|
+
{
|
|
11172
|
+
id: "pickaxe",
|
|
11173
|
+
name: "Pickaxe",
|
|
11174
|
+
category: "melee_blade",
|
|
11175
|
+
action: {
|
|
11176
|
+
kind: "melee",
|
|
11177
|
+
damage: "slash",
|
|
11178
|
+
energy: 260,
|
|
11179
|
+
radius: 0.05,
|
|
11180
|
+
reach: 1,
|
|
11181
|
+
rpm: 40,
|
|
11182
|
+
noise: 4
|
|
11183
|
+
},
|
|
11184
|
+
mass: 2.8,
|
|
11185
|
+
tags: [
|
|
11186
|
+
"heavy"
|
|
11187
|
+
]
|
|
11188
|
+
},
|
|
11189
|
+
{
|
|
11190
|
+
id: "sickle",
|
|
11191
|
+
name: "Sickle",
|
|
11192
|
+
category: "melee_blade",
|
|
11193
|
+
action: {
|
|
11194
|
+
kind: "melee",
|
|
11195
|
+
damage: "slash",
|
|
11196
|
+
energy: 70,
|
|
11197
|
+
radius: 0.05,
|
|
11198
|
+
reach: 1.1,
|
|
11199
|
+
rpm: 70,
|
|
11200
|
+
noise: 2
|
|
11201
|
+
},
|
|
11202
|
+
mass: 1.2
|
|
11203
|
+
},
|
|
11204
|
+
{
|
|
11205
|
+
id: "police_baton",
|
|
11206
|
+
name: "Police baton",
|
|
11207
|
+
category: "melee_blunt",
|
|
11208
|
+
action: {
|
|
11209
|
+
kind: "melee",
|
|
11210
|
+
damage: "blunt",
|
|
11211
|
+
energy: 70,
|
|
11212
|
+
radius: 0.04,
|
|
11213
|
+
reach: 0.7,
|
|
11214
|
+
rpm: 90,
|
|
11215
|
+
noise: 3
|
|
11216
|
+
},
|
|
11217
|
+
mass: 0.6
|
|
11218
|
+
},
|
|
11219
|
+
{
|
|
11220
|
+
id: "cast_iron_skillet",
|
|
11221
|
+
name: "Cast iron skillet",
|
|
11222
|
+
category: "melee_blunt",
|
|
11223
|
+
action: {
|
|
11224
|
+
kind: "melee",
|
|
11225
|
+
damage: "blunt",
|
|
11226
|
+
energy: 110,
|
|
11227
|
+
radius: 0.12,
|
|
11228
|
+
reach: 0.6,
|
|
11229
|
+
rpm: 60,
|
|
11230
|
+
noise: 8
|
|
11231
|
+
},
|
|
11232
|
+
mass: 1.2
|
|
11233
|
+
},
|
|
11234
|
+
{
|
|
11235
|
+
id: "improvised_spear",
|
|
11236
|
+
name: "Improvised spear",
|
|
11237
|
+
category: "melee_blade",
|
|
11238
|
+
action: {
|
|
11239
|
+
kind: "melee",
|
|
11240
|
+
damage: "slash",
|
|
11241
|
+
energy: 90,
|
|
11242
|
+
radius: 0.02,
|
|
11243
|
+
reach: 1.6,
|
|
11244
|
+
rpm: 50,
|
|
11245
|
+
noise: 1
|
|
11246
|
+
},
|
|
11247
|
+
mass: 1.1
|
|
11248
|
+
},
|
|
11249
|
+
{
|
|
11250
|
+
id: "chainsaw",
|
|
11251
|
+
name: "Chainsaw",
|
|
11252
|
+
category: "melee_blade",
|
|
11253
|
+
action: {
|
|
11254
|
+
kind: "melee",
|
|
11255
|
+
damage: "slash",
|
|
11256
|
+
energy: 400,
|
|
11257
|
+
radius: 0.1,
|
|
11258
|
+
reach: 0.9,
|
|
11259
|
+
rpm: 300,
|
|
11260
|
+
noise: 120
|
|
11261
|
+
},
|
|
11262
|
+
mass: 6,
|
|
11263
|
+
tags: [
|
|
11264
|
+
"heavy"
|
|
11265
|
+
]
|
|
11266
|
+
},
|
|
11267
|
+
{
|
|
11268
|
+
id: "recurve_bow",
|
|
11269
|
+
name: "Recurve bow",
|
|
11270
|
+
category: "bow",
|
|
11271
|
+
action: {
|
|
11272
|
+
kind: "firearm",
|
|
11273
|
+
caliber: "arrow",
|
|
11274
|
+
rpm: 20,
|
|
11275
|
+
modes: [
|
|
11276
|
+
"single"
|
|
11277
|
+
],
|
|
11278
|
+
magazine: 1,
|
|
11279
|
+
reload: 1.5,
|
|
11280
|
+
barrel: 1,
|
|
11281
|
+
spreadDeg: 0.4,
|
|
11282
|
+
bloomDeg: 0.4,
|
|
11283
|
+
recoveryDegPerS: 2,
|
|
11284
|
+
recoil: [
|
|
11285
|
+
0.3,
|
|
11286
|
+
0.1
|
|
11287
|
+
],
|
|
11288
|
+
range: 40
|
|
11289
|
+
},
|
|
11290
|
+
mass: 1.2,
|
|
11291
|
+
tags: [
|
|
11292
|
+
"silent"
|
|
11293
|
+
]
|
|
11294
|
+
}
|
|
11295
|
+
];
|
|
11296
|
+
|
|
11091
11297
|
// src/check-arsenal.ts
|
|
11092
11298
|
var findDuplicateIds = (kind, entries) => {
|
|
11093
11299
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -11174,21 +11380,8 @@ var checkArsenal = ({ weapons, calibers, explosives, attachments, rules }) => [
|
|
|
11174
11380
|
...checkRuleDefaults(rules)
|
|
11175
11381
|
];
|
|
11176
11382
|
|
|
11177
|
-
// src/merge.ts
|
|
11178
|
-
var UNSAFE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
11179
|
-
var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;
|
|
11180
|
-
var deepMerge = (base, patch) => {
|
|
11181
|
-
if (!patch) return base;
|
|
11182
|
-
const result2 = { ...base };
|
|
11183
|
-
for (const [key, value] of Object.entries(patch)) {
|
|
11184
|
-
if (value === void 0 || UNSAFE_KEYS.has(key)) continue;
|
|
11185
|
-
const current = result2[key];
|
|
11186
|
-
result2[key] = isPlainObject(current) && isPlainObject(value) ? deepMerge(current, value) : value;
|
|
11187
|
-
}
|
|
11188
|
-
return result2;
|
|
11189
|
-
};
|
|
11190
|
-
|
|
11191
11383
|
// src/locale.ts
|
|
11384
|
+
import { deepMerge } from "@adatechnology/game-contracts";
|
|
11192
11385
|
var modesEn = { single: "single action", semi: "semi-automatic", burst: "burst", auto: "automatic", pump: "pump action", bolt: "bolt action", lever: "lever action", break: "break action", volley: "volley" };
|
|
11193
11386
|
var categoriesEn = {
|
|
11194
11387
|
pistol: "pistol",
|
|
@@ -11384,20 +11577,6 @@ var sampleFuse = (explosive, random, fuseLength) => {
|
|
|
11384
11577
|
};
|
|
11385
11578
|
|
|
11386
11579
|
// src/registry.ts
|
|
11387
|
-
var mergeById = (shipped, extra) => {
|
|
11388
|
-
const entries = /* @__PURE__ */ new Map();
|
|
11389
|
-
for (const entry of [...shipped, ...extra ?? []]) entries.set(entry.id, entry);
|
|
11390
|
-
return entries;
|
|
11391
|
-
};
|
|
11392
|
-
var applyPatches = (entries, patches) => {
|
|
11393
|
-
for (const [id, patch] of Object.entries(patches ?? {})) {
|
|
11394
|
-
const entry = entries.get(id);
|
|
11395
|
-
if (entry) entries.set(id, deepMerge(entry, patch));
|
|
11396
|
-
}
|
|
11397
|
-
};
|
|
11398
|
-
var removeIds = (entries, ids) => {
|
|
11399
|
-
for (const id of ids ?? []) entries.delete(id);
|
|
11400
|
-
};
|
|
11401
11580
|
var resolveThrowables = (weapons, explosives) => {
|
|
11402
11581
|
for (const [id, def] of weapons) {
|
|
11403
11582
|
if (def.action.kind !== "throwable" || def.action.explosive === void 0) continue;
|
|
@@ -12675,6 +12854,7 @@ var WeaponFirearm = class extends WeaponAttachments {
|
|
|
12675
12854
|
caliber: cal.diameter,
|
|
12676
12855
|
caliberId: cal.id,
|
|
12677
12856
|
speed,
|
|
12857
|
+
mass: cal.bulletGrams,
|
|
12678
12858
|
energyAt,
|
|
12679
12859
|
pellet: p,
|
|
12680
12860
|
weapon: this.def.id
|
|
@@ -12864,7 +13044,7 @@ var ATTACHMENTS = attachments_default;
|
|
|
12864
13044
|
var EXPLOSIVES = explosives_default;
|
|
12865
13045
|
var ARCHETYPES = archetypes_default;
|
|
12866
13046
|
var ARCHETYPE_IDS = ARCHETYPES.map((def) => def.id);
|
|
12867
|
-
var WEAPONS = [...ARCHETYPES, ...firearms_default, ...launchers_default, ...explosive_weapons_default];
|
|
13047
|
+
var WEAPONS = [...ARCHETYPES, ...firearms_default, ...launchers_default, ...explosive_weapons_default, ...melee_weapons_default];
|
|
12868
13048
|
var DEFAULT_LOADOUT = [
|
|
12869
13049
|
"hand",
|
|
12870
13050
|
"kick",
|
|
@@ -12926,7 +13106,7 @@ var createArsenal = (options = {}) => {
|
|
|
12926
13106
|
for (const [id, def] of weapons) if (!options.include(def)) weapons.delete(id);
|
|
12927
13107
|
}
|
|
12928
13108
|
dropOrphanLaunchers(attachments, weapons, options.attachments);
|
|
12929
|
-
const rules =
|
|
13109
|
+
const rules = deepMerge2(DEFAULT_RULES, options.rules);
|
|
12930
13110
|
const problems = [
|
|
12931
13111
|
...findDuplicateIds("calibre", options.calibers),
|
|
12932
13112
|
...findDuplicateIds("weapon", options.weapons),
|