Skip to content

Commit

Permalink
Class registrator without string literals - enums only.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neloreck committed Aug 14, 2023
1 parent 2b35ed3 commit 3d1c60e
Show file tree
Hide file tree
Showing 18 changed files with 611 additions and 163 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Optional } from "@/engine/lib/types";
const logger: LuaLogger = new LuaLogger($filename);

/**
* todo;
* Matching server class for magazined weapons with grenade launcher.
*/
@LuabindClass()
export class ItemWeaponMagazinedWGl extends cse_alife_item_weapon_magazined_w_gl {
Expand Down
2 changes: 2 additions & 0 deletions src/engine/core/objects/server/physic/ObjectPhysic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const logger: LuaLogger = new LuaLogger($filename);
* Examples:
* - Static artefacts in scientist bunker
* - Detectors to place in anomaly by quest
*
* todo: Rename to PhysicObject to match c++.
*/
@LuabindClass()
export class ObjectPhysic extends cse_alife_object_physic {
Expand Down
164 changes: 163 additions & 1 deletion src/engine/lib/constants/class_ids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,170 @@ export enum EClientObjectClass {
}

/**
* todo;
* Enumeration of class identifiers used in LTX configurations linking.
*/
export enum EConfigClassId {
AI_STL_S = "AI_STL_S",
AMMO_S = "AMMO_S",
C_HLCP_S = "C_HLCP_S",
DET_ADVA = "DET_ADVA",
DET_ELIT = "DET_ELIT",
DET_SCIE = "DET_SCIE",
DET_SIMP = "DET_SIMP",
E_HLMET = "E_HLMET",
E_STLK = "E_STLK",
G_F1_S = "G_F1_S",
G_RGD5_S = "G_RGD5_S",
LVL_CHNG = "LVL_CHNG",
MAIN_MNU = "MAIN_MNU",
ON_OFF_S = "ON_OFF_S",
O_DSTR_S = "O_DSTR_S",
O_PHYS_S = "O_PHYS_S",
SCRPTART = "SCRPTART",
SMART_TERRAIN = "SMRTTRRN",
SMRT_C_S = "SMRT_C_S",
SM_BLOOD = "SM_BLOOD",
SM_BOARW = "SM_BOARW",
SM_BURER = "SM_BURER",
SM_CAT_S = "SM_CAT_S",
SM_CHIMS = "SM_CHIMS",
SM_CONTR = "SM_CONTR",
SM_DOG_F = "SM_DOG_F",
SM_DOG_P = "SM_DOG_P",
SM_DOG_S = "SM_DOG_S",
SM_FLESH = "SM_FLESH",
SM_GIANT = "SM_GIANT",
SM_IZLOM = "SM_IZLOM",
SM_POLTR = "SM_POLTR",
SM_P_DOG = "SM_P_DOG",
SM_SNORK = "SM_SNORK",
SM_TUSHK = "SM_TUSHK",
SM_ZOMBI = "SM_ZOMBI",
SO_HLAMP = "SO_HLAMP",
SPC_RS_S = "SPC_RS_S",
S_ACTOR = "S_ACTOR",
S_ANTIR = "S_ANTIR",
S_BANDG = "S_BANDG",
S_BOTTL = "S_BOTTL",
S_EXPLO = "S_EXPLO",
S_FOOD = "S_FOOD",
S_INVBOX = "S_INVBOX",
S_M209 = "S_M209",
S_MEDKI = "S_MEDKI",
S_OG7B = "S_OG7B",
S_PDA = "S_PDA",
S_VOG25 = "S_VOG25",
TORCH_S = "TORCH_S",
WP_AK74 = "WP_AK74",
WP_ASHTG = "WP_ASHTG",
WP_BINOC = "WP_BINOC",
WP_BM16 = "WP_BM16",
WP_GLAUN = "WP_GLAUN",
WP_GROZA = "WP_GROZA",
WP_HPSA = "WP_HPSA",
WP_KNIFE = "WP_KNIFE",
WP_LR300 = "WP_LR300",
WP_PM = "WP_PM",
WP_RG6 = "WP_RG6",
WP_RPG7 = "WP_RPG7",
WP_SCOPE = "WP_SCOPE",
WP_SHOTG = "WP_SHOTG",
WP_SILEN = "WP_SILEN",
WP_SVD = "WP_SVD",
WP_SVU = "WP_SVU",
WP_USP45 = "WP_USP45",
WP_VAL = "WP_VAL",
WP_VINT = "WP_VINT",
WP_WALTH = "WP_WALTH",
ZS_BFUZZ = "ZS_BFUZZ",
ZS_GALAN = "ZS_GALAN",
ZS_MBALD = "ZS_MBALD",
ZS_MINCE = "ZS_MINCE",
ZS_RADIO = "ZS_RADIO",
ZS_TORRD = "ZS_TORRD",
}

/**
* Script class IDs for linking of serve-client side implementation.
* Later can be got from game object.
*/
export enum EScriptClassId {
ARTEFACT_S = "artefact_s",
BLOODSUCKER_S = "bloodsucker_s",
BOAR_S = "boar_s",
BURER_S = "burer_s",
CAT_S = "cat_s",
CHIMERA_S = "chimera_s",
CONTROLLER_S = "controller_s",
DESTRPHYS_S = "destrphys_s",
DETECTOR_ADVANCED_S = "detector_advanced_s",
DETECTOR_ELITE_S = "detector_elite_s",
DETECTOR_SCIENTIFIC_S = "detector_scientific_s",
DETECTOR_SIMPLE_S = "detector_simple_s",
DEVICE_TORCH_S = "device_torch_s",
DOG_S = "dog_s",
EQU_HELMET_S = "equ_helmet_s",
EQU_STALKER_S = "equ_stalker_s",
FLESH_S = "flesh_s",
FRACTURE_S = "fracture_s",
GIGANT_S = "gigant_s",
HLAMP_S = "hlamp_s",
INVENTORY_BOX_S = "inventory_box_s",
LEVEL_CHANGER_S = "level_changer_s",
MAIN_MENU = "main_menu",
OBJ_ANTIRAD_S = "obj_antirad_s",
OBJ_BANDAGE_S = "obj_bandage_s",
OBJ_BOTTLE_S = "obj_bottle_s",
OBJ_EXPLOSIVE_S = "obj_explosive_s",
OBJ_FOOD_S = "obj_food_s",
OBJ_MEDKIT_S = "obj_medkit_s",
OBJ_PDA_S = "obj_pda_s",
ONLINE_OFFLINE_GROUP_S = "online_offline_group_s",
POLTERGEIST_S = "poltergeist_s",
PSEUDODOG_S = "pseudodog_s",
PSY_DOG_PHANTOM_S = "psy_dog_phantom_s",
PSY_DOG_S = "psy_dog_s",
SCRIPT_ACTOR = "script_actor",
SCRIPT_HELI = "script_heli",
SCRIPT_PHYS = "script_phys",
SCRIPT_RESTRICTOR = "script_restr",
SCRIPT_STALKER = "script_stalker",
SMARTCOVER_S = "smartcover_s",
SMART_TERRAIN = "smart_terrain",
SNORK_S = "snork_s",
TUSHKANO_S = "tushkano_s",
WPN_AK74_S = "wpn_ak74_s",
WPN_AMMO_M209_S = "wpn_ammo_m209_s",
WPN_AMMO_OG7B_S = "wpn_ammo_og7b_s",
WPN_AMMO_S = "wpn_ammo_s",
WPN_AMMO_VOG25_S = "wpn_ammo_vog25_s",
WPN_AUTO_SHOTGUN_S = "wpn_auto_shotgun_s",
WPN_BINOCULAR_S = "wpn_binocular_s",
WPN_BM16_S = "wpn_bm16_s",
WPN_GRENADE_F1_S = "wpn_grenade_f1_s",
WPN_GRENADE_LAUNCHER_S = "wpn_grenade_launcher_s",
WPN_GRENADE_RGD5_S = "wpn_grenade_rgd5_s",
WPN_GROZA_S = "wpn_groza_s",
WPN_HPSA_S = "wpn_hpsa_s",
WPN_KNIFE_S = "wpn_knife_s",
WPN_LR300_S = "wpn_lr300_s",
WPN_PM_S = "wpn_pm_s",
WPN_RG6_S = "wpn_rg6_s",
WPN_RPG7_S = "wpn_rpg7_s",
WPN_SCOPE_S = "wpn_scope_s",
WPN_SHOTGUN_S = "wpn_shotgun_s",
WPN_SILENCER_S = "wpn_silencer_s",
WPN_SVD_S = "wpn_svd_s",
WPN_SVU_S = "wpn_svu_s",
WPN_USP45_S = "wpn_usp45_s",
WPN_VAL_S = "wpn_val_s",
WPN_VINTOREZ_S = "wpn_vintorez_s",
WPN_WALTHER_S = "wpn_walther_s",
ZOMBIE_S = "zombie_s",
ZONE_BFUZZ_S = "zone_bfuzz_s",
ZONE_GALANT_S = "zone_galant_s",
ZONE_MBALD_S = "zone_mbald_s",
ZONE_MINCER_S = "zone_mincer_s",
ZONE_RADIO_S = "zone_radio_s",
ZONE_TORRID_S = "zone_torrid_s",
}
8 changes: 0 additions & 8 deletions src/engine/lib/constants/items/inventory_objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,17 @@
* todo;
*/
export const inventoryObjects = {
inventory_box_s: "inventory_box_s",
obj_antirad: "obj_antirad",
obj_antirad_s: "obj_antirad_s",
obj_attachable: "obj_attachable",
obj_bandage: "obj_bandage",
obj_bandage_s: "obj_bandage_s",
obj_bolt: "obj_bolt",
obj_bottle: "obj_bottle",
obj_bottle_s: "obj_bottle_s",
obj_breakable: "obj_breakable",
obj_climable: "obj_climable",
obj_document: "obj_document",
obj_explosive: "obj_explosive",
obj_explosive_s: "obj_explosive_s",
obj_food: "obj_food",
obj_food_s: "obj_food_s",
obj_medkit: "obj_medkit",
obj_medkit_s: "obj_medkit_s",
obj_pda_s: "obj_pda_s",
} as const;

/**
Expand Down
1 change: 0 additions & 1 deletion src/engine/lib/constants/items/lootable_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export const lootableTableExclude = {
[misc.harmonica_a]: misc.harmonica_a,
[weapons.wpn_binoc]: weapons.wpn_binoc,
[weapons.wpn_binocular]: weapons.wpn_binocular,
[weapons.wpn_binocular_s]: weapons.wpn_binocular_s,
} as const;

export type TLootableExcludeItems = typeof lootableTableExclude;
Expand Down
1 change: 0 additions & 1 deletion src/engine/lib/constants/items/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export const misc = {
bolt: "bolt",
device_pda: "device_pda",
device_torch: "device_torch",
device_torch_s: "device_torch_s",
guitar_a: "guitar_a",
harmonica_a: "harmonica_a",
toolkit_1: "toolkit_1",
Expand Down
27 changes: 0 additions & 27 deletions src/engine/lib/constants/items/weapons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,15 @@ export const weapons = {
grenade_rgd5: "grenade_rgd5",
wpn_abakan: "wpn_abakan",
wpn_ak74: "wpn_ak74",
wpn_ak74_s: "wpn_ak74_s",
wpn_ak74u: "wpn_ak74u",
wpn_ak74u_snag: "wpn_ak74u_snag",
wpn_ammo: "wpn_ammo",
wpn_ammo_m209: "wpn_ammo_m209",
wpn_ammo_m209_s: "wpn_ammo_m209_s",
wpn_ammo_og7b: "wpn_ammo_og7b",
wpn_ammo_og7b_s: "wpn_ammo_og7b_s",
wpn_ammo_s: "wpn_ammo_s",
wpn_ammo_vog25: "wpn_ammo_vog25",
wpn_ammo_vog25_s: "wpn_ammo_vog25_s",
wpn_auto_shotgun_s: "wpn_auto_shotgun_s",
wpn_binoc: "wpn_binoc",
wpn_binocular: "wpn_binocular",
wpn_binocular_s: "wpn_binocular_s",
wpn_bm16: "wpn_bm16",
wpn_bm16_s: "wpn_bm16_s",
wpn_desert_eagle_nimble: "wpn_desert_eagle_nimble",
wpn_fn2000: "wpn_fn2000",
wpn_fn2000_nimble: "wpn_fn2000_nimble",
Expand All @@ -59,64 +51,45 @@ export const weapons = {
wpn_g36_nimble: "wpn_g36_nimble",
wpn_gauss: "wpn_gauss",
wpn_grenade_f1: "wpn_grenade_f1",
wpn_grenade_f1_s: "wpn_grenade_f1_s",
wpn_grenade_fake: "wpn_grenade_fake",
wpn_grenade_launcher: "wpn_grenade_launcher",
wpn_grenade_launcher_s: "wpn_grenade_launcher_s",
wpn_grenade_rgd5: "wpn_grenade_rgd5",
wpn_grenade_rgd5_s: "wpn_grenade_rgd5_s",
wpn_grenade_rpg7: "wpn_grenade_rpg7",
wpn_groza: "wpn_groza",
wpn_groza_nimble: "wpn_groza_nimble",
wpn_groza_s: "wpn_groza_s",
wpn_hpsa_s: "wpn_hpsa_s",
wpn_knife: "wpn_knife",
wpn_knife_s: "wpn_knife_s",
wpn_l85: "wpn_l85",
wpn_lr300: "wpn_lr300",
wpn_lr300_s: "wpn_lr300_s",
wpn_mp5: "wpn_mp5",
wpn_mp5_nimble: "wpn_mp5_nimble",
wpn_pkm: "wpn_pkm",
wpn_pkm_zulus: "wpn_pkm_zulus",
wpn_pm_actor: "wpn_pm_actor",
wpn_pm_s: "wpn_pm_s",
wpn_protecta: "wpn_protecta",
wpn_protecta_nimble: "wpn_protecta_nimble",
"wpn_rg-6": "wpn_rg-6",
wpn_rg6: "wpn_rg6",
wpn_rg6_s: "wpn_rg6_s",
wpn_rpg7: "wpn_rpg7",
wpn_rpg7_s: "wpn_rpg7_s",
wpn_scope: "wpn_scope",
wpn_scope_s: "wpn_scope_s",
wpn_shotgun: "wpn_shotgun",
wpn_shotgun_s: "wpn_shotgun_s",
wpn_sig220: "wpn_sig220",
wpn_sig220_nimble: "wpn_sig220_nimble",
wpn_sig550: "wpn_sig550",
wpn_sig550_luckygun: "wpn_sig550_luckygun",
wpn_silencer: "wpn_silencer",
wpn_silencer_s: "wpn_silencer_s",
wpn_spas12: "wpn_spas12",
wpn_spas12_nimble: "wpn_spas12_nimble",
wpn_stat_mgun: "wpn_stat_mgun",
wpn_svd: "wpn_svd",
wpn_svd_nimble: "wpn_svd_nimble",
wpn_svd_s: "wpn_svd_s",
wpn_svu: "wpn_svu",
wpn_svu_nimble: "wpn_svu_nimble",
wpn_svu_s: "wpn_svu_s",
wpn_toz34: "wpn_toz34",
wpn_usp45: "wpn_usp45",
wpn_usp45_s: "wpn_usp45_s",
wpn_usp_nimble: "wpn_usp_nimble",
wpn_val: "wpn_val",
wpn_val_s: "wpn_val_s",
wpn_vintorez: "wpn_vintorez",
wpn_vintorez_nimble: "wpn_vintorez_nimble",
wpn_vintorez_s: "wpn_vintorez_s",
wpn_walther_s: "wpn_walther_s",
wpn_wincheaster1300: "wpn_wincheaster1300",
wpn_wincheaster1300_trapper: "wpn_wincheaster1300_trapper",
wpn_wmagaz: "wpn_wmagaz",
Expand Down
6 changes: 3 additions & 3 deletions src/engine/scripts/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ const logger: LuaLogger = new LuaLogger($filename);
*/
extern("register", {
/**
* todo: Description.
* Register game classes of objects and link lua implementation with c++ counterpart.
*/
registerGameClasses: (factory: ObjectFactory): void => {
(require("@/engine/scripts/register/class_registrator").registerGameClasses as AnyCallable)(factory);
},
/**
* todo: Description.
* Get current game class ID.
*/
getGameClassId: (gameTypeOption: string, isServer: boolean): void => {
(require("@/engine/scripts/register/game_class_id_registrator").getGameClassId as AnyCallable)(
Expand All @@ -27,7 +27,7 @@ extern("register", {
);
},
/**
* todo: Description.
* Get current game ui ID.
*/
getUiClassId: (gameType: string): void => {
(require("@/engine/scripts/register/ui_class_id_registrator").getUiClassId as AnyCallable)(gameType);
Expand Down
Loading

0 comments on commit 3d1c60e

Please sign in to comment.