Skip to content

Commit

Permalink
perf: code improvements / cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Frowmza committed Sep 5, 2024
1 parent e991b8e commit 039f889
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 16 deletions.
2 changes: 0 additions & 2 deletions src/client/appearance/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,12 @@ export function getHeadOverlay(pedHandle: number) {

if (overlay === "EyeColor") {
headData[overlay] = {
id: overlay,
index: i,
overlayValue: GetPedEyeColor(pedHandle)
};
} else {
const [_, overlayValue, colourType, firstColor, secondColor, overlayOpacity] = GetPedHeadOverlayData(pedHandle, i);
headData[overlay] = {
id: overlay,
index: i,
overlayValue: overlayValue === 255 ? -1 : overlayValue,
colourType: colourType,
Expand Down
14 changes: 2 additions & 12 deletions src/server/appearance/setters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,8 @@ exports('SavePlayerTattoos', function(id, tattoos) {


export async function saveAppearance(src: number, frameworkId: string, appearance: TAppearance, force?: boolean) {
if (src && frameworkId) {
const playerId = getFrameworkID(src);

if (!force && frameworkId !== playerId) {
console.warn('You are trying to save an appearance for a different player', src, frameworkId);
return;
}
}

if (!frameworkId) {
frameworkId = getFrameworkID(src);
}
if (!force && src && frameworkId && getFrameworkID(src) !== frameworkId) console.warn('You are trying to save an appearance for a different player', src, frameworkId);
if (!frameworkId) frameworkId = getFrameworkID(src);

const clothes = {
drawables: appearance.drawables,
Expand Down
1 change: 0 additions & 1 deletion src/typings/appearance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ interface THairData {
// interface for head overlay data

interface HeadOverlayData {
id: string;
index: number;
overlayValue?: number;
colourinterface?: number;
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/menu/Face.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import Slider from '@components/micro/Slider.svelte';
import Wrapper from '@components/micro/Wrapper.svelte';
import { APPEARANCE, LOCALE } from '@stores/appearance';
import type { TValue, THeadOverlay, TEyeColor } from '@typings/apperance';
import type { TValue, THeadOverlay } from '@typings/apperance';
$: data = $APPEARANCE.headStructure;
let eyeColor = ($APPEARANCE.headOverlay?.EyeColor as TValue) || null;
Expand Down

0 comments on commit 039f889

Please sign in to comment.