Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYNC] Removing large constants files. #29

Merged
merged 6 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/engine/core/database/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export * from "@/engine/core/database/registry";
export * from "@/engine/core/database/save_markers";
export * from "@/engine/core/database/smart";
export * from "@/engine/core/database/stalker";
export * from "@/engine/core/database/simulation";
export * from "@/engine/core/database/story_objects";
export * from "@/engine/core/database/types";
export * from "@/engine/core/database/zones";
3 changes: 1 addition & 2 deletions src/engine/core/managers/interaction/SleepManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import { SleepDialog } from "@/engine/core/ui/interaction/SleepDialog";
import { executeConsoleCommand, getConsoleFloatCommand } from "@/engine/core/utils/game/game_console";
import { LuaLogger } from "@/engine/core/utils/logging";
import { disableInfo, giveInfo } from "@/engine/core/utils/object/object_info_portion";
import { animations } from "@/engine/lib/constants/animation/animations";
import { postProcessors } from "@/engine/lib/constants/animation/post_processors";
import { animations, postProcessors } from "@/engine/lib/constants/animation";
import { consoleCommands } from "@/engine/lib/constants/console_commands";
import { infoPortions } from "@/engine/lib/constants/info_portions";
import { Optional, TDuration } from "@/engine/lib/types";
Expand Down
32 changes: 15 additions & 17 deletions src/engine/core/managers/interaction/TravelManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ import {
getServerDistanceBetween,
} from "@/engine/core/utils/object";
import { isAnySquadMemberEnemyToActor } from "@/engine/core/utils/relation";
import { postProcessors } from "@/engine/lib/constants/animation/post_processors";
import { captions } from "@/engine/lib/constants/captions/captions";
import { postProcessors } from "@/engine/lib/constants/animation";
import { communities, TCommunity } from "@/engine/lib/constants/communities";
import { TRUE } from "@/engine/lib/constants/words";
import { zones } from "@/engine/lib/constants/zones";
import {
ClientObject,
Optional,
Expand Down Expand Up @@ -132,7 +130,7 @@ export class TravelManager extends AbstractCoreManager {
public initializeTravellerDialog(dialog: PhraseDialog): void {
const npcCommunity: TCommunity = communities.stalker; // -- npc:character_community()

let actorPhrase: Phrase = dialog.AddPhrase(captions.dm_traveler_what_are_you_doing, "0", "", -10000);
let actorPhrase: Phrase = dialog.AddPhrase("dm_traveler_what_are_you_doing", "0", "", -10000);
let actorScript: PhraseScript = actorPhrase.GetPhraseScript();

let npcPhrase: Phrase = dialog.AddPhrase("if you see this - this is bad", "1", "0", -10000);
Expand Down Expand Up @@ -206,7 +204,7 @@ export class TravelManager extends AbstractCoreManager {
return false;
} else if (npc.character_community() === communities.army) {
return false;
} else if (getObjectSmartTerrain(npc)?.name() === zones.jup_b41) {
} else if (getObjectSmartTerrain(npc)?.name() === "jup_b41") {
return false;
}

Expand Down Expand Up @@ -379,16 +377,16 @@ export class TravelManager extends AbstractCoreManager {
/**
* todo: Description.
*/
public getTravelConst(actor: ClientObject, npc: ClientObject, dialogId: TStringId, phraseId: TStringId): TLabel {
public getTravelConst(actor: ClientObject, object: ClientObject, dialogId: TStringId, phraseId: TStringId): TLabel {
const simBoard: SimulationBoardManager = SimulationBoardManager.getInstance();
const travelPhraseId: TStringId = string.sub(phraseId, 1, string.len(phraseId) - 2);
const smartName: TName = this.smartNamesByPhraseId.get(travelPhraseId);
const smartTerrain: Optional<SmartTerrain> = simBoard.getSmartTerrainByName(smartName)!;

const distance: TDistance = npc.position().distance_to(smartTerrain.position);
const distance: TDistance = object.position().distance_to(smartTerrain.position);
const price: TCount = this.getTravelPriceByDistance(distance);

return game.translate_string(captions.dm_traveler_travel_cost) + " " + tostring(price) + ".";
return game.translate_string("dm_traveler_travel_cost") + " " + tostring(price) + ".";
}

/**
Expand Down Expand Up @@ -428,21 +426,21 @@ export class TravelManager extends AbstractCoreManager {
*/
public onTravelToSpecificSmartWithSquad(
actor: ClientObject,
npc: ClientObject,
object: ClientObject,
dialogId: TStringId,
phraseId: TStringId
): void {
const simulationBoardManager: SimulationBoardManager = SimulationBoardManager.getInstance();
const travelPhraseId: TStringId = string.sub(phraseId, 1, string.len(phraseId) - 3);
const smartName: TName = this.smartNamesByPhraseId.get(travelPhraseId);
const smartTerrain: Optional<SmartTerrain> = simulationBoardManager.getSmartTerrainByName(smartName)!;
const squad: Optional<Squad> = getObjectSquad(npc);
const squad: Optional<Squad> = getObjectSquad(object);

logger.info("Actor travel with squad:", npc.name(), smartName);
logger.info("Actor travel with squad:", object.name(), smartName);

createGameAutoSave(captions.st_save_uni_travel_generic);
createGameAutoSave("st_save_uni_travel_generic");

npc.stop_talk();
object.stop_talk();

level.disable_input();
level.hide_indicators_safe();
Expand Down Expand Up @@ -472,17 +470,17 @@ export class TravelManager extends AbstractCoreManager {
*/
public onTravelTogetherWithSquad(
actor: ClientObject,
npc: ClientObject,
object: ClientObject,
dialogId: TStringId,
phraseId: TStringId
): void {
createGameAutoSave(captions.st_save_uni_travel_generic);
createGameAutoSave("st_save_uni_travel_generic");

const squad: Squad = getObjectSquad(npc)!;
const squad: Squad = getObjectSquad(object)!;
const squadTargetId: Optional<TNumberId> = squad.assignedTargetId;
const smartTerrain: SmartTerrain = alife().object<SmartTerrain>(squadTargetId!)!;

npc.stop_talk();
object.stop_talk();

level.disable_input();
level.hide_indicators_safe();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { ENotificationType, ITipNotification } from "@/engine/core/managers/inte
import { StatisticsManager } from "@/engine/core/managers/interface/statistics/StatisticsManager";
import { WeatherManager } from "@/engine/core/managers/world/WeatherManager";
import { disableInfo, giveInfo, hasAlifeInfo } from "@/engine/core/utils/object/object_info_portion";
import { captions } from "@/engine/lib/constants/captions";
import { communities } from "@/engine/lib/constants/communities";
import { infoPortions, TInfoPortion } from "@/engine/lib/constants/info_portions";
import { artefacts } from "@/engine/lib/constants/items/artefacts";
Expand Down Expand Up @@ -162,7 +161,7 @@ describe("AchievementManager class", () => {

checkGenericAchievement({
check: () => achievementsManager.checkAchievedPioneer(),
notificationCaption: captions.st_ach_pioneer,
notificationCaption: "st_ach_pioneer",
notificationIcon: achievementIcons[EAchievement.PIONEER],
achievementInfo: infoPortions.pioneer_achievement_gained,
requiredInfos: [
Expand All @@ -178,7 +177,7 @@ describe("AchievementManager class", () => {

checkGenericAchievement({
check: () => achievementsManager.checkAchievedMutantHunter(),
notificationCaption: captions.st_ach_mutant_hunter,
notificationCaption: "st_ach_mutant_hunter",
notificationIcon: achievementIcons[EAchievement.MUTANT_HUNTER],
achievementInfo: infoPortions.mutant_hunter_achievement_gained,
requiredInfos: [
Expand All @@ -194,7 +193,7 @@ describe("AchievementManager class", () => {

checkGenericAchievement({
check: () => achievementsManager.checkAchievedDetective(),
notificationCaption: captions.st_ach_detective,
notificationCaption: "st_ach_detective",
notificationIcon: achievementIcons[EAchievement.DETECTIVE],
achievementInfo: infoPortions.detective_achievement_gained,
requiredInfos: [infoPortions.zat_b22_barmen_gave_reward],
Expand All @@ -206,7 +205,7 @@ describe("AchievementManager class", () => {

checkGenericAchievement({
check: () => achievementsManager.checkAchievedOneOfLads(),
notificationCaption: captions.st_ach_one_of_the_lads,
notificationCaption: "st_ach_one_of_the_lads",
notificationIcon: achievementIcons[EAchievement.ONE_OF_THE_LADS],
achievementInfo: infoPortions.one_of_the_lads_gained,
requiredInfos: [infoPortions.zat_b30_sultan_loose, infoPortions.zat_b7_actor_help_stalkers],
Expand All @@ -218,7 +217,7 @@ describe("AchievementManager class", () => {

checkGenericAchievement({
check: () => achievementsManager.checkAchievedKingpin(),
notificationCaption: captions.st_ach_kingpin,
notificationCaption: "st_ach_kingpin",
notificationIcon: achievementIcons[EAchievement.KINGPIN],
achievementInfo: infoPortions.kingpin_gained,
requiredInfos: [infoPortions.zat_b30_barmen_under_sultan, infoPortions.zat_b7_actor_help_bandits],
Expand All @@ -230,7 +229,7 @@ describe("AchievementManager class", () => {

checkGenericAchievement({
check: () => achievementsManager.checkAchievedHeraldOfJustice(),
notificationCaption: captions.st_ach_herald_of_justice,
notificationCaption: "st_ach_herald_of_justice",
notificationIcon: achievementIcons[EAchievement.HERALD_OF_JUSTICE],
achievementInfo: infoPortions.herald_of_justice_achievement_gained,
requiredInfos: [
Expand All @@ -246,7 +245,7 @@ describe("AchievementManager class", () => {

checkGenericAchievement({
check: () => achievementsManager.checkAchievedBattleSystemsMaster(),
notificationCaption: captions.st_ach_battle_systems_master,
notificationCaption: "st_ach_battle_systems_master",
notificationIcon: achievementIcons[EAchievement.BATTLE_SYSTEMS_MASTER],
achievementInfo: infoPortions.battle_systems_master_achievement_gained,
requiredInfos: [infoPortions.zat_b3_all_instruments_brought],
Expand All @@ -258,7 +257,7 @@ describe("AchievementManager class", () => {

checkGenericAchievement({
check: () => achievementsManager.checkAchievedHighTechMaster(),
notificationCaption: captions.st_ach_high_tech_master,
notificationCaption: "st_ach_high_tech_master",
notificationIcon: achievementIcons[EAchievement.HIGH_TECH_MASTER],
achievementInfo: infoPortions.high_tech_master_achievement_gained,
requiredInfos: [
Expand All @@ -274,7 +273,7 @@ describe("AchievementManager class", () => {

checkGenericAchievement({
check: () => achievementsManager.checkAchievedSkilledStalker(),
notificationCaption: captions.st_ach_skilled_stalker,
notificationCaption: "st_ach_skilled_stalker",
notificationIcon: achievementIcons[EAchievement.SKILLED_STALKER],
achievementInfo: infoPortions.skilled_stalker_achievement_gained,
requiredInfos: [infoPortions.actor_was_in_many_bad_places],
Expand All @@ -286,7 +285,7 @@ describe("AchievementManager class", () => {

checkGenericAchievement({
check: () => achievementsManager.checkAchievedLeader(),
notificationCaption: captions.st_ach_leader,
notificationCaption: "st_ach_leader",
notificationIcon: achievementIcons[EAchievement.LEADER],
achievementInfo: infoPortions.leader_achievement_gained,
requiredInfos: [
Expand All @@ -302,7 +301,7 @@ describe("AchievementManager class", () => {

checkGenericAchievement({
check: () => achievementsManager.checkAchievedDiplomat(),
notificationCaption: captions.st_ach_diplomat,
notificationCaption: "st_ach_diplomat",
notificationIcon: achievementIcons[EAchievement.DIPLOMAT],
achievementInfo: infoPortions.diplomat_achievement_gained,
requiredInfos: [infoPortions.jup_a12_wo_shooting, infoPortions.jup_a10_bandit_take_all_money],
Expand All @@ -314,7 +313,7 @@ describe("AchievementManager class", () => {

checkGenericAchievement({
check: () => achievementsManager.checkAchievedDiplomat(),
notificationCaption: captions.st_ach_diplomat,
notificationCaption: "st_ach_diplomat",
notificationIcon: achievementIcons[EAchievement.DIPLOMAT],
achievementInfo: infoPortions.diplomat_achievement_gained,
requiredInfos: [infoPortions.jup_a12_wo_shooting, infoPortions.jup_a10_bandit_take_money],
Expand All @@ -328,7 +327,7 @@ describe("AchievementManager class", () => {

checkGenericAchievement({
check: () => achievementsManager.checkAchievedResearchMan(),
notificationCaption: captions.st_ach_research_man,
notificationCaption: "st_ach_research_man",
notificationIcon: achievementIcons[EAchievement.RESEARCH_MAN],
achievementInfo: infoPortions.research_man_gained,
requiredInfos: [
Expand All @@ -343,7 +342,7 @@ describe("AchievementManager class", () => {

checkGenericAchievement({
check: () => achievementsManager.checkAchievedResearchMan(),
notificationCaption: captions.st_ach_research_man,
notificationCaption: "st_ach_research_man",
notificationIcon: achievementIcons[EAchievement.RESEARCH_MAN],
achievementInfo: infoPortions.research_man_gained,
requiredInfos: [
Expand All @@ -360,7 +359,7 @@ describe("AchievementManager class", () => {

checkGenericAchievement({
check: () => achievementsManager.checkAchievedFriendOfDuty(),
notificationCaption: captions.st_ach_friend_of_duty,
notificationCaption: "st_ach_friend_of_duty",
notificationIcon: achievementIcons[EAchievement.FRIEND_OF_DUTY],
achievementInfo: infoPortions.sim_duty_help_harder,
requiredInfos: [
Expand All @@ -377,7 +376,7 @@ describe("AchievementManager class", () => {

checkGenericAchievement({
check: () => achievementsManager.checkAchievedFriendOfFreedom(),
notificationCaption: captions.st_ach_friend_of_freedom,
notificationCaption: "st_ach_friend_of_freedom",
notificationIcon: achievementIcons[EAchievement.FRIEND_OF_FREEDOM],
achievementInfo: infoPortions.sim_freedom_help_harder,
requiredInfos: [
Expand All @@ -394,7 +393,7 @@ describe("AchievementManager class", () => {

checkGenericAchievement({
check: () => achievementsManager.checkAchievedBalanceAdvocate(),
notificationCaption: captions.st_ach_balance_advocate,
notificationCaption: "st_ach_balance_advocate",
notificationIcon: achievementIcons[EAchievement.BALANCE_ADVOCATE],
achievementInfo: infoPortions.balance_advocate_gained,
requiredInfos: [
Expand All @@ -410,7 +409,7 @@ describe("AchievementManager class", () => {

checkGenericAchievement({
check: () => achievementsManager.checkAchievedKeeperOfSecrets(),
notificationCaption: captions.st_ach_keeper_of_secrets,
notificationCaption: "st_ach_keeper_of_secrets",
notificationIcon: achievementIcons[EAchievement.KEEPER_OF_SECRETS],
achievementInfo: infoPortions.keeper_of_secrets_achievement_gained,
requiredInfos: [infoPortions.pri_b305_all_strelok_notes_given],
Expand All @@ -422,7 +421,7 @@ describe("AchievementManager class", () => {

checkGenericAchievement({
check: () => achievementsManager.checkAchievedInformationDealer(),
notificationCaption: captions.st_ach_information_dealer,
notificationCaption: "st_ach_information_dealer",
notificationIcon: achievementIcons[EAchievement.INFORMATION_DEALER],
achievementInfo: infoPortions.actor_information_dealer,
requiredInfos: [
Expand All @@ -443,7 +442,7 @@ describe("AchievementManager class", () => {

checkGenericAchievement({
check: () => achievementsManager.checkAchievedInformationDealer(),
notificationCaption: captions.st_ach_information_dealer,
notificationCaption: "st_ach_information_dealer",
notificationIcon: achievementIcons[EAchievement.INFORMATION_DEALER],
achievementInfo: infoPortions.actor_information_dealer,
requiredInfos: [
Expand All @@ -466,7 +465,7 @@ describe("AchievementManager class", () => {

checkGenericAchievement({
check: () => achievementsManager.checkAchievedFriendOfStalkers(),
notificationCaption: captions.st_ach_friend_of_stalkers,
notificationCaption: "st_ach_friend_of_stalkers",
notificationIcon: achievementIcons[EAchievement.FRIEND_OF_STALKERS],
achievementInfo: infoPortions.sim_stalker_help_harder,
requiredInfos: [
Expand All @@ -487,7 +486,7 @@ describe("AchievementManager class", () => {

it("should correctly check wealthy achievement", () => {
const achievementsManager: AchievementsManager = AchievementsManager.getInstance();
const onNotification = mockNotificationListener(captions.st_ach_wealthy, achievementIcons[EAchievement.WEALTHY]);
const onNotification = mockNotificationListener("st_ach_wealthy", achievementIcons[EAchievement.WEALTHY]);

giveInfo(infoPortions.actor_wealthy);
expect(achievementsManager.checkAchievedWealthy()).toBeTruthy();
Expand All @@ -507,7 +506,7 @@ describe("AchievementManager class", () => {
it("should correctly check seeker achievement", () => {
const achievementsManager: AchievementsManager = AchievementsManager.getInstance();
const statisticsManager: StatisticsManager = StatisticsManager.getInstance();
const onNotification = mockNotificationListener(captions.st_ach_seeker, achievementIcons[EAchievement.SEEKER]);
const onNotification = mockNotificationListener("st_ach_seeker", achievementIcons[EAchievement.SEEKER]);

giveInfo(infoPortions.sim_bandit_attack_harder);
expect(achievementsManager.checkAchievedSeeker()).toBeTruthy();
Expand Down Expand Up @@ -542,7 +541,7 @@ describe("AchievementManager class", () => {
const statisticsManager: StatisticsManager = StatisticsManager.getInstance();
const achievementsManager: AchievementsManager = AchievementsManager.getInstance();
const onNotification = mockNotificationListener(
captions.st_ach_marked_by_zone,
"st_ach_marked_by_zone",
achievementIcons[EAchievement.MARKED_BY_ZONE]
);

Expand Down
Loading