67 lines
4.9 KiB
JavaScript
67 lines
4.9 KiB
JavaScript
|
|
/* Robot Clash - parts catalogue (no DOM). Loaded as a classic script (window.RC.PARTS) and in Node
|
||
|
|
(require('./parts.js') returns RC).
|
||
|
|
|
||
|
|
Slots: chassis, motor, wheels, battery (required, exactly one each), armour, weapon, tower (optional).
|
||
|
|
Common fields: id, slot, name (brand name, not translated), cost, weight (kg), power (draw; battery: supply).
|
||
|
|
Texts for each part: lang.js key 'pd_<id>' (short description, en + de). */
|
||
|
|
(function (root) {
|
||
|
|
'use strict';
|
||
|
|
const RC = (root.RC = root.RC || {});
|
||
|
|
|
||
|
|
RC.WEIGHT_LIMIT = 100; // kg, single weight class in v1
|
||
|
|
RC.SLOTS = ['chassis', 'motor', 'wheels', 'battery', 'armour', 'weapon', 'tower'];
|
||
|
|
RC.REQUIRED = { chassis: true, motor: true, wheels: true, battery: true };
|
||
|
|
|
||
|
|
const P = [
|
||
|
|
// chassis: hp, body size (len along forward, wid, h), shape for the 3D model
|
||
|
|
{ id: 'crate', slot: 'chassis', name: 'Crate Mk1', cost: 150, weight: 22, hp: 100, len: 1.3, wid: 1.0, h: 0.42, shape: 'box' },
|
||
|
|
{ id: 'doorstop', slot: 'chassis', name: 'Doorstop', cost: 380, weight: 25, hp: 105, len: 1.45, wid: 1.05, h: 0.34, shape: 'wedge', lowProfile: true },
|
||
|
|
{ id: 'bulwark', slot: 'chassis', name: 'Bulwark', cost: 720, weight: 34, hp: 150, len: 1.5, wid: 1.2, h: 0.5, shape: 'box' },
|
||
|
|
{ id: 'scarab', slot: 'chassis', name: 'Scarab', cost: 1150, weight: 30, hp: 135, len: 1.4, wid: 1.15, h: 0.46, shape: 'dome', frontArmour: 0.15 },
|
||
|
|
|
||
|
|
// motor: force (N), top speed (m/s)
|
||
|
|
{ id: 'sparky', slot: 'motor', name: 'Sparky 2kW', cost: 100, weight: 8, power: 3, force: 650, speed: 4.0 },
|
||
|
|
{ id: 'hornet', slot: 'motor', name: 'Hornet 3kW', cost: 420, weight: 10, power: 5, force: 850, speed: 5.0 },
|
||
|
|
{ id: 'bulldog', slot: 'motor', name: 'Bulldog Torque', cost: 680, weight: 14, power: 6, force: 1250, speed: 4.3 },
|
||
|
|
{ id: 'comet', slot: 'motor', name: 'Comet 5kW', cost: 1250, weight: 12, power: 8, force: 1150, speed: 6.2 },
|
||
|
|
|
||
|
|
// wheels: speed factor, lateral grip, turn rate (rad/s), push factor; invertible = drives upside down
|
||
|
|
{ id: 'rubber', slot: 'wheels', name: 'Rubber 4x', cost: 60, weight: 4, speedMul: 1.0, grip: 7, turn: 2.8, push: 1.0, kind: 'small' },
|
||
|
|
{ id: 'bigtyre', slot: 'wheels', name: 'Big Tyres', cost: 280, weight: 7, speedMul: 1.1, grip: 7.5, turn: 2.5, push: 1.05, kind: 'big', invertible: true },
|
||
|
|
{ id: 'tracks', slot: 'wheels', name: 'Crawler Tracks', cost: 540, weight: 11, speedMul: 0.86, grip: 12, turn: 2.2, push: 1.45, kind: 'tracks' },
|
||
|
|
|
||
|
|
// battery: power = supply
|
||
|
|
{ id: 'lead', slot: 'battery', name: 'Lead 12V', cost: 80, weight: 10, power: 9 },
|
||
|
|
{ id: 'nicd', slot: 'battery', name: 'NiCd Pack', cost: 320, weight: 7, power: 13 },
|
||
|
|
{ id: 'lipo', slot: 'battery', name: 'LiPo Stack', cost: 760, weight: 5, power: 19 },
|
||
|
|
|
||
|
|
// armour: reduce = share of damage absorbed, hp bonus
|
||
|
|
{ id: 'steel', slot: 'armour', name: 'Steel Plates', cost: 220, weight: 12, reduce: 0.15, hp: 10, tint: 0x8a9099 },
|
||
|
|
{ id: 'titan', slot: 'armour', name: 'Titanium Skin', cost: 680, weight: 9, reduce: 0.25, hp: 15, tint: 0xa9b8c9 },
|
||
|
|
{ id: 'hardox', slot: 'armour', name: 'Hardox Shell', cost: 1150, weight: 18, reduce: 0.38, hp: 25, tint: 0xc9a845 },
|
||
|
|
|
||
|
|
// weapons (Space): type decides the behaviour in combat.js
|
||
|
|
{ id: 'wedge', slot: 'weapon', name: 'Steel Wedge', cost: 80, weight: 6, power: 0, type: 'wedge', reach: 0.35, ram: 1.7, cd: 4 },
|
||
|
|
{ id: 'flipper', slot: 'weapon', name: 'Pneumatic Flipper', cost: 480, weight: 14, power: 6, type: 'flipper', reach: 0.55, dmg: 8, launch: 7.5, cd: 2.2 },
|
||
|
|
{ id: 'hammer', slot: 'weapon', name: 'Axe Hammer', cost: 560, weight: 12, power: 5, type: 'hammer', reach: 0.8, dmg: 22, cd: 1.5 },
|
||
|
|
{ id: 'saw', slot: 'weapon', name: 'Circular Saw', cost: 420, weight: 9, power: 5, type: 'saw', reach: 0.4, dps: 24 },
|
||
|
|
{ id: 'crusher', slot: 'weapon', name: 'Hydraulic Jaws', cost: 780, weight: 15, power: 7, type: 'crusher', reach: 0.5, dps: 20, hold: 2.2, cd: 3.5 },
|
||
|
|
{ id: 'spinner', slot: 'weapon', name: 'Bar Spinner', cost: 950, weight: 18, power: 9, type: 'spinner', reach: 0.6, dmg: 34, spinup: 1.4 },
|
||
|
|
|
||
|
|
// towers (Shift / E): auto-aiming turret on top
|
||
|
|
{ id: 'flamer', slot: 'tower', name: 'Flame Nozzle', cost: 360, weight: 6, power: 3, type: 'flamer', range: 2.8, dps: 10, cone: 0.4 },
|
||
|
|
{ id: 'minigun', slot: 'tower', name: 'Rivet Minigun', cost: 520, weight: 7, power: 4, type: 'minigun', range: 9, dps: 8 },
|
||
|
|
{ id: 'rockets', slot: 'tower', name: 'Seeker Pod', cost: 840, weight: 10, power: 5, type: 'rockets', range: 14, dmg: 17, cd: 2.4 },
|
||
|
|
];
|
||
|
|
|
||
|
|
RC.PARTS = {};
|
||
|
|
for (const p of P) RC.PARTS[p.id] = p;
|
||
|
|
RC.PART_LIST = P;
|
||
|
|
RC.partsFor = slot => P.filter(p => p.slot === slot);
|
||
|
|
|
||
|
|
// starter robot: owned on a new save
|
||
|
|
RC.STARTER = { chassis: 'crate', motor: 'sparky', wheels: 'rubber', battery: 'lead', armour: null, weapon: 'wedge', tower: null };
|
||
|
|
|
||
|
|
if (typeof module !== 'undefined' && module.exports) module.exports = RC;
|
||
|
|
})(typeof window !== 'undefined' ? window : globalThis);
|