Skip to content

Commit

Permalink
feat(fs): sf_zombo_tech
Browse files Browse the repository at this point in the history
  • Loading branch information
dockfries committed Jul 21, 2024
1 parent a237460 commit 0aa8d47
Show file tree
Hide file tree
Showing 7 changed files with 828 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/filterscript/src/scripts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ export * from "./pirate_ship";
export * from "./safe_animated";
export * from "./samp_anims";
export * from "./sf_building1";
export * from "./sf_zombo_tech";
export * from "./skin_changer";
export * from "./v_spawner";
18 changes: 16 additions & 2 deletions packages/filterscript/src/scripts/ls_beach_side/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ let floorRequestedBy: (Player | InvalidEnum.PLAYER_ID)[] = [];
// Used for a timer that makes the elevator move faster after players start
// surfing the object
let elevatorBoostTimer: NodeJS.Timeout | null = null;
let elevatorTurnTimer: NodeJS.Timeout | null = null;

function elevator_Initialize() {
// Create the elevator and elevator door objects
Expand Down Expand Up @@ -584,8 +585,15 @@ export const LSBeachSide: ILSBeachSideFS = {
});
label_Elevator.create();

if (elevatorTurnTimer) {
clearTimeout(elevatorTurnTimer);
}

elevatorState = constants.ELEVATOR_STATE_WAITING;
setTimeout(elevator_TurnToIdle, constants.ELEVATOR_WAIT_TIME);
elevatorTurnTimer = setTimeout(
elevator_TurnToIdle,
constants.ELEVATOR_WAIT_TIME,
);
}

return next();
Expand Down Expand Up @@ -711,7 +719,7 @@ export const LSBeachSide: ILSBeachSideFS = {
// to enable a simple teleport command (/lsb) which teleports the player to
// outside the LS BeachSide building.

if (options && options.command) {
if (options && options.enableCommand) {
const onCommandText = PlayerEvent.onCommandText(
"lsb",
({ player, next }) => {
Expand Down Expand Up @@ -745,6 +753,12 @@ export const LSBeachSide: ILSBeachSideFS = {
clearTimeout(elevatorBoostTimer);
elevatorBoostTimer = null;
}

if (elevatorTurnTimer) {
clearTimeout(elevatorTurnTimer);
elevatorTurnTimer = null;
}

// Destroy the elevator, the elevator doors and the elevator floor doors
elevator_Destroy();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { IFilterScript } from "@infernus/core";

export interface ILSBeachSideFSOptions {
command?: boolean;
enableCommand?: boolean;
}

export interface ILSBeachSideFS extends IFilterScript {
Expand Down
16 changes: 15 additions & 1 deletion packages/filterscript/src/scripts/ls_elevator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ let floorRequestedBy: (Player | InvalidEnum.PLAYER_ID)[];

// Timer that makes the elevator move faster after players start surfing the object.
let elevatorBoostTimer: NodeJS.Timeout | null = null;
let elevatorTurnTimer: NodeJS.Timeout | null = null;

// Private:
function elevator_Initialize() {
Expand Down Expand Up @@ -487,8 +488,15 @@ export const LSElevator: IFilterScript = {
});
label_Elevator.create();

if (elevatorTurnTimer) {
clearTimeout(elevatorTurnTimer);
}

elevatorState = constants.ELEVATOR_STATE_WAITING;
setTimeout(elevator_TurnToIdle, constants.ELEVATOR_WAIT_TIME);
elevatorTurnTimer = setTimeout(
elevator_TurnToIdle,
constants.ELEVATOR_WAIT_TIME,
);
}

return next();
Expand Down Expand Up @@ -546,6 +554,12 @@ export const LSElevator: IFilterScript = {
clearTimeout(elevatorBoostTimer);
elevatorBoostTimer = null;
}

if (elevatorTurnTimer) {
clearTimeout(elevatorTurnTimer);
elevatorTurnTimer = null;
}

elevator_Destroy();
},
};
34 changes: 34 additions & 0 deletions packages/filterscript/src/scripts/sf_zombo_tech/constants/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Movement speed of the elevator
export const ELEVATOR_SPEED = 5.0;

// Movement speed of the doors
export const DOORS_SPEED = 5.0;

// Time in ms that the elevator will wait in each floor before continuing with the queue...
// be sure to give enough time for doors to open
export const ELEVATOR_WAIT_TIME = 5000;

// Position defines
export const X_DOOR_CLOSED = -1951.603027;
export const X_DOOR_L_OPENED = X_DOOR_CLOSED + 1.6;
export const X_DOOR_R_OPENED = X_DOOR_CLOSED - 1.6;
export const GROUND_Z_COORD = 47.451492;
export const X_ELEVATOR_POS = -1951.603027;
export const Y_ELEVATOR_POS = 636.418334;

// Elevator state defines
export const ELEVATOR_STATE_IDLE = 0;
export const ELEVATOR_STATE_WAITING = 1;
export const ELEVATOR_STATE_MOVING = 2;

// Invalid floor define
export const INVALID_FLOOR = -1;

// Elevator floor names for the 3D text labels
export const FloorNames = ["Ground Floor", "ZomboTech Lab"];

// Elevator floor Z heights
export const FloorZOffsets = [
0.0, // Ground Floor
-21.628007, // ZomboTech Lab -21.598007
];
Loading

0 comments on commit 0aa8d47

Please sign in to comment.