Skip to content

Commit f876701

Browse files
committed
chore: formatting
1 parent e327ba1 commit f876701

25 files changed

Lines changed: 464 additions & 469 deletions

File tree

client/death.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { cache, requestAnimDict, sleep } from "@overextended/ox_lib/client";
2-
import { Vector3, Vector4 } from "@nativewrappers/fivem";
3-
import { OxPlayer } from "player";
4-
import { DEATH_SYSTEM, DEBUG, HOSPITAL_BLIPS } from "config";
5-
import { LoadDataFile } from "../common";
1+
import { cache, requestAnimDict, sleep } from '@overextended/ox_lib/client';
2+
import { Vector3, Vector4 } from '@nativewrappers/fivem';
3+
import { OxPlayer } from 'player';
4+
import { DEATH_SYSTEM, DEBUG, HOSPITAL_BLIPS } from 'config';
5+
import { LoadDataFile } from '../common';
66

7-
const hospitals: Vector4[] = LoadDataFile("hospitals").map((vec: number[]) => {
7+
const hospitals: Vector4[] = LoadDataFile('hospitals').map((vec: number[]) => {
88
const hospital = Vector4.fromArray(vec);
99

1010
if (HOSPITAL_BLIPS) {
@@ -21,9 +21,9 @@ const hospitals: Vector4[] = LoadDataFile("hospitals").map((vec: number[]) => {
2121
});
2222

2323
const anims = [
24-
["missfinale_c1@", "lying_dead_player0"],
25-
["veh@low@front_ps@idle_duck", "sit"],
26-
["dead", "dead_a"],
24+
['missfinale_c1@', 'lying_dead_player0'],
25+
['veh@low@front_ps@idle_duck', 'sit'],
26+
['dead', 'dead_a'],
2727
];
2828

2929
let playerIsDead = false;
@@ -72,21 +72,21 @@ async function ClearDeath(tickId: number, bleedOut: boolean) {
7272

7373
for (let index = 0; index < anims.length; index++) RemoveAnimDict(anims[index][0]);
7474

75-
emit("ox:playerRevived");
75+
emit('ox:playerRevived');
7676
}
7777

7878
const bleedOutTime = DEBUG ? 100 : 1000;
7979

8080
async function OnPlayerDeath() {
81-
OxPlayer.state.set("isDead", true, true);
82-
emit("ox_inventory:disarm");
83-
emit("ox:playerDeath");
81+
OxPlayer.state.set('isDead', true, true);
82+
emit('ox_inventory:disarm');
83+
emit('ox:playerDeath');
8484

8585
if (!DEATH_SYSTEM) return;
8686

8787
for (let index = 0; index < anims.length; index++) await requestAnimDict(anims[index][0]);
8888

89-
ShakeGameplayCam("DEATH_FAIL_IN_EFFECT_SHAKE", 1.0);
89+
ShakeGameplayCam('DEATH_FAIL_IN_EFFECT_SHAKE', 1.0);
9090

9191
let bleedOut = 0;
9292
const tickId = setTick(() => {
@@ -114,18 +114,18 @@ async function OnPlayerDeath() {
114114
SetEveryoneIgnorePlayer(cache.playerId, true);
115115
}
116116

117-
AddStateBagChangeHandler("isDead", `player:${cache.serverId}`, async (_bagName: string, _key: string, value: any) => {
117+
AddStateBagChangeHandler('isDead', `player:${cache.serverId}`, async (_bagName: string, _key: string, value: any) => {
118118
playerIsDead = value;
119119
});
120120

121121
function ResetDeathState() {
122-
OxPlayer.state.set("isDead", false, true);
122+
OxPlayer.state.set('isDead', false, true);
123123
}
124124

125-
on("ox:playerLogout", ResetDeathState);
126-
on("ox:playerRevived", ResetDeathState);
125+
on('ox:playerLogout', ResetDeathState);
126+
on('ox:playerRevived', ResetDeathState);
127127

128-
on("ox:playerLoaded", () => {
128+
on('ox:playerLoaded', () => {
129129
const id: CitizenTimer = setInterval(() => {
130130
if (!OxPlayer.isLoaded) return clearInterval(id);
131131

client/player/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,23 +155,23 @@ class PlayerSingleton {
155155
setStatus(name: string, value: number) {
156156
if (this.#statuses[name] === undefined) return false;
157157

158-
this.#statuses[name] = value < 0 ? 0 : value > 100 ? 100 : Number.parseFloat((value).toPrecision(8));
158+
this.#statuses[name] = value < 0 ? 0 : value > 100 ? 100 : Number.parseFloat(value.toPrecision(8));
159159
return true;
160160
}
161161

162162
addStatus(name: string, value: number) {
163163
if (this.#statuses[name] === undefined) return false;
164164

165165
const newValue = this.#statuses[name] + value;
166-
this.#statuses[name] = newValue < 0 ? 0 : newValue > 100 ? 100 : Number.parseFloat((newValue).toPrecision(8));
166+
this.#statuses[name] = newValue < 0 ? 0 : newValue > 100 ? 100 : Number.parseFloat(newValue.toPrecision(8));
167167
return true;
168168
}
169169

170170
removeStatus(name: string, value: number) {
171171
if (this.#statuses[name] === undefined) return false;
172172

173173
const newValue = this.#statuses[name] - value;
174-
this.#statuses[name] = newValue < 0 ? 0 : newValue > 100 ? 100 : Number.parseFloat((newValue).toPrecision(8));
174+
this.#statuses[name] = newValue < 0 ? 0 : newValue > 100 ? 100 : Number.parseFloat(newValue.toPrecision(8));
175175
return true;
176176
}
177177

client/player/status.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ function UpdateStatuses() {
99
const curValue = OxPlayer.getStatus(name) ?? status.default;
1010
const newValue = curValue + status.onTick;
1111

12-
OxPlayer.setStatus(
13-
name,
14-
newValue < 0 ? 0 : newValue > 100 ? 100 : Number.parseFloat((newValue).toPrecision(8)),
15-
);
12+
OxPlayer.setStatus(name, newValue < 0 ? 0 : newValue > 100 ? 100 : Number.parseFloat(newValue.toPrecision(8)));
1613
}
1714

1815
emit('ox:statusTick', OxPlayer.getStatuses());

client/spawn.ts

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { sleep, waitFor } from "@overextended/ox_lib";
2-
import { cache, inputDialog } from "@overextended/ox_lib/client";
3-
import { OxPlayer } from "./player";
4-
import { netEvent } from "utils";
5-
import { CHARACTER_SELECT, SPAWN_LOCATION } from "config";
6-
import locale from "../common/locales";
7-
import type { Character, NewCharacter } from "types";
1+
import { sleep, waitFor } from '@overextended/ox_lib';
2+
import { cache, inputDialog } from '@overextended/ox_lib/client';
3+
import { OxPlayer } from './player';
4+
import { netEvent } from 'utils';
5+
import { CHARACTER_SELECT, SPAWN_LOCATION } from 'config';
6+
import locale from '../common/locales';
7+
import type { Character, NewCharacter } from 'types';
88

99
DoScreenFadeOut(0);
1010
NetworkStartSoloTutorialSession();
11-
setTimeout(() => emitNet("ox:playerJoined"));
11+
setTimeout(() => emitNet('ox:playerJoined'));
1212

1313
async function StartSession() {
1414
if (IsPlayerSwitchInProgress()) {
@@ -42,11 +42,11 @@ async function StartSession() {
4242
SetPlayerHealthRechargeMultiplier(cache.playerId, 0.0);
4343
}
4444

45-
netEvent("ox:startCharacterSelect", async (_userId: number, characters: Character[]) => {
45+
netEvent('ox:startCharacterSelect', async (_userId: number, characters: Character[]) => {
4646
if (OxPlayer.isLoaded) {
4747
OxPlayer.isLoaded = false;
4848

49-
emit("ox:playerLogout");
49+
emit('ox:playerLogout');
5050
}
5151

5252
StartSession();
@@ -73,55 +73,55 @@ netEvent("ox:startCharacterSelect", async (_userId: number, characters: Characte
7373
DoScreenFadeIn(200);
7474

7575
if (character) {
76-
return emitNet("ox:setActiveCharacter", character.charId);
76+
return emitNet('ox:setActiveCharacter', character.charId);
7777
}
7878

7979
const input = await inputDialog(
80-
locale("create_character"),
80+
locale('create_character'),
8181
[
8282
{
83-
type: "input",
83+
type: 'input',
8484
required: true,
85-
icon: "user-pen",
86-
label: locale("firstname"),
87-
placeholder: "John",
85+
icon: 'user-pen',
86+
label: locale('firstname'),
87+
placeholder: 'John',
8888
},
8989
{
90-
type: "input",
90+
type: 'input',
9191
required: true,
92-
icon: "user-pen",
93-
label: locale("lastname"),
94-
placeholder: "Smith",
92+
icon: 'user-pen',
93+
label: locale('lastname'),
94+
placeholder: 'Smith',
9595
},
9696
{
97-
type: "select",
97+
type: 'select',
9898
required: true,
99-
icon: "circle-user",
100-
label: locale("gender"),
99+
icon: 'circle-user',
100+
label: locale('gender'),
101101
options: [
102102
{
103-
label: locale("male"),
104-
value: "male",
103+
label: locale('male'),
104+
value: 'male',
105105
},
106106
{
107-
label: locale("female"),
108-
value: "female",
107+
label: locale('female'),
108+
value: 'female',
109109
},
110110
{
111-
label: locale("non_binary"),
112-
value: "non_binary",
111+
label: locale('non_binary'),
112+
value: 'non_binary',
113113
},
114114
],
115115
},
116116
{
117-
type: "date",
117+
type: 'date',
118118
required: true,
119-
icon: "calendar-days",
120-
label: locale("date_of_birth"),
121-
format: "YYYY-MM-DD",
122-
min: "1900-01-01",
123-
max: "2006-01-01",
124-
default: "2006-01-01",
119+
icon: 'calendar-days',
120+
label: locale('date_of_birth'),
121+
format: 'YYYY-MM-DD',
122+
min: '1900-01-01',
123+
max: '2006-01-01',
124+
default: '2006-01-01',
125125
},
126126
],
127127
{
@@ -131,28 +131,28 @@ netEvent("ox:startCharacterSelect", async (_userId: number, characters: Characte
131131

132132
if (!input) return;
133133

134-
emitNet("ox:setActiveCharacter", <NewCharacter>{
134+
emitNet('ox:setActiveCharacter', <NewCharacter>{
135135
firstName: input[0] as string,
136136
lastName: input[1] as string,
137137
gender: input[2] as string,
138138
date: input[3] as number,
139139
});
140140
});
141141

142-
netEvent("ox:setActiveCharacter", async (character: Character) => {
142+
netEvent('ox:setActiveCharacter', async (character: Character) => {
143143
if (CHARACTER_SELECT) {
144144
SwitchInPlayer(PlayerPedId());
145145
SetGameplayCamRelativeHeading(0);
146146
}
147147

148-
await waitFor(() => (IsScreenFadedIn() && !IsPlayerSwitchInProgress() ? true : undefined), "", 0);
148+
await waitFor(() => (IsScreenFadedIn() && !IsPlayerSwitchInProgress() ? true : undefined), '', 0);
149149

150150
SetEntityHealth(cache.ped, character.health ?? GetEntityMaxHealth(cache.ped));
151151
SetPedArmour(cache.ped, character.armour ?? 0);
152152
FreezeEntityPosition(cache.ped, false);
153153

154154
OxPlayer.isLoaded = true;
155155

156-
emit("playerSpawned");
157-
emit("ox:playerLoaded", OxPlayer, character.isNew);
156+
emit('playerSpawned');
157+
emit('ox:playerLoaded', OxPlayer, character.isNew);
158158
});

client/vehicle/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { cache, onServerCallback, waitFor } from "@overextended/ox_lib/client";
2-
import { Vector3 } from "@nativewrappers/fivem";
3-
import { DEBUG } from "../config";
1+
import { cache, onServerCallback, waitFor } from '@overextended/ox_lib/client';
2+
import { Vector3 } from '@nativewrappers/fivem';
3+
import { DEBUG } from '../config';
44

5-
if (DEBUG) import("./parser");
5+
if (DEBUG) import('./parser');
66

7-
onServerCallback("ox:getNearbyVehicles", (radius: number) => {
7+
onServerCallback('ox:getNearbyVehicles', (radius: number) => {
88
const nearbyEntities: number[] = [];
99
const playerCoords = Vector3.fromArray(GetEntityCoords(cache.ped, true));
1010

11-
(GetGamePool("CVehicle") as number[]).forEach((entityId) => {
11+
(GetGamePool('CVehicle') as number[]).forEach((entityId) => {
1212
const coords = Vector3.fromArray(GetEntityCoords(entityId, true));
1313
const distance = coords.distance(playerCoords);
1414

@@ -18,10 +18,10 @@ onServerCallback("ox:getNearbyVehicles", (radius: number) => {
1818
return nearbyEntities;
1919
});
2020

21-
AddStateBagChangeHandler("initVehicle", "", async (bagName: string, key: string, value: any) => {
21+
AddStateBagChangeHandler('initVehicle', '', async (bagName: string, key: string, value: any) => {
2222
if (!value) return;
2323

24-
await waitFor(() => (!NetworkIsInTutorialSession() ? true : undefined), "", 0);
24+
await waitFor(() => (!NetworkIsInTutorialSession() ? true : undefined), '', 0);
2525

2626
const entity = await waitFor(
2727
async () => {

0 commit comments

Comments
 (0)