Floors module

This commit is contained in:
2024-02-14 21:34:45 -05:00
parent c454a5cc4e
commit 0dfaaa4946
8 changed files with 175 additions and 64 deletions

View File

@@ -30,12 +30,14 @@ end
function Spine:Enable() function Spine:Enable()
Spine.Running = true Spine.Running = true
while Spine.Running do task.spawn(function()
local IsFirstPerson = Player.CameraMode == Enum.CameraMode.LockFirstPerson while Spine.Running do
self.Remote:FireServer(self.CurrentCamera.CFrame, IsFirstPerson) local IsFirstPerson = Player.CameraMode == Enum.CameraMode.LockFirstPerson
self.Remote:FireServer(self.CurrentCamera.CFrame, IsFirstPerson)
Delta:time() Delta:time()
end end
end)
end end
function Spine:Disable() function Spine:Disable()

View File

@@ -42,22 +42,32 @@ local CameraConsturctor = CameraModule.constructor(CurrentCamera, HumanoidRootPa
local HumanoidSettings = HumanoidModule.constructor(Humanoid) local HumanoidSettings = HumanoidModule.constructor(Humanoid)
local SpineMovement = SpineModule.constructor(CurrentCamera) local SpineMovement = SpineModule.constructor(CurrentCamera)
local function CrouchFeature() local Walking = 10/2 --10 is default
local function ClientCharacterBinds()
local CrouchConstructor = CrouchModule.constructor(Humanoid) local CrouchConstructor = CrouchModule.constructor(Humanoid)
local CourchBindMap = BindModule.constructor() local BindMap = BindModule.constructor()
CourchBindMap:AddInputBegan({Enum.KeyCode.RightControl, Enum.KeyCode.LeftControl}, function() --Crouch
BindMap:AddInputBegan({Enum.KeyCode.RightControl, Enum.KeyCode.LeftControl}, function()
CrouchConstructor:Crouch(10) CrouchConstructor:Crouch(10)
end) end)
CourchBindMap:AddInputEnded({Enum.KeyCode.RightControl, Enum.KeyCode.LeftControl}, function() BindMap:AddInputEnded({Enum.KeyCode.RightControl, Enum.KeyCode.LeftControl}, function()
CrouchConstructor:Stand(5) CrouchConstructor:Stand(5)
end) end)
--Walk
BindMap:AddInputBegan({Enum.KeyCode.LeftShift, Enum.KeyCode.RightShift}, function()
HumanoidSettings:SetWalkSpeed(Walking)
end)
BindMap:AddInputEnded({Enum.KeyCode.LeftShift, Enum.KeyCode.RightShift}, function()
HumanoidSettings:SetWalkSpeed(10)
end)
end end
HumanoidSettings:SetWalkSpeed() HumanoidSettings:SetWalkSpeed()
HumanoidSettings:SetJumpHeight() HumanoidSettings:SetJumpHeight()
HRPSettings:DisableRobloxSounds() HRPSettings:DisableRobloxSounds()
-- CameraConsturctor:EnableBobbing() CameraConsturctor:EnableBobbing()
SpineMovement:Enable() SpineMovement:Enable()
CrouchFeature() ClientCharacterBinds()

View File

@@ -44,7 +44,7 @@ local function CameraBinds()
end end
CoreGuis:Off() CoreGuis:Off()
-- Camera:FirstPerson() Camera:FirstPerson()
Mouse:DisablePointer() Mouse:DisablePointer()
Crosshair:Enable() Crosshair:Enable()

View File

@@ -0,0 +1,18 @@
local Floors = {}
Floors.__index = Floors
local Storage = game:GetService("ReplicatedStorage")
local Tags = require(Storage:WaitForChild("Tags"))
function Floors.constructor(NumberOfFloors: number)
return setmetatable({NumberOfFloors = NumberOfFloors}, Floors)
end
--NumberOfFloors syntax: ElevatorDoor_(year)_Floor(floors amount)_1/2
function Floors:GetFloors(Year: string)
for i: number = 1, self.NumberOfFloors do
end
end
return Floors

View File

@@ -1,6 +1,11 @@
local Doors = { local Doors = {
Closed = true, Closed = true,
DontLeakMemory = nil Sensors = true,
Door1Stopped_X = Vector3.xAxis*2.9,
Door2Stopped_X = Vector3.xAxis*5.8,
ElevatorDoorTime = 5,
ElevatorDoorStyle = Enum.EasingStyle.Quad,
__DontLeakMemory = nil
} }
Doors.__index = Doors Doors.__index = Doors
@@ -10,59 +15,123 @@ local Storage = game:GetService("ReplicatedStorage")
local Tween = require(Storage:WaitForChild("Tween")) local Tween = require(Storage:WaitForChild("Tween"))
local Tags = require(Storage:WaitForChild("Tags")) local Tags = require(Storage:WaitForChild("Tags"))
local Door1Stopped_X = Vector3.xAxis*2.9 local Floor10_Door1 = Tags.ElevatorDoor_1960_Floor10_1
local Door2Stopped_X = Vector3.xAxis*6 local Floor10_Door2 = Tags.ElevatorDoor_1960_Floor10_2
function Doors.constructor(ElevatorBox: BasePart, ElevatorDoor1: BasePart, ElevatorDoor2: BasePart, ElevatorDoorSensor: Folder) function Doors.constructor(ElevatorBox: BasePart, ElevatorDoor1: BasePart, ElevatorDoor2: BasePart, ElevatorDoorSensor: Folder)
type DoorSensors = {
[string]: BasePart
}
local DoorTween1 = Tween.constructor(nil, ElevatorDoor1) local DoorTween1 = Tween.constructor(nil, ElevatorDoor1)
local DoorTween2 = Tween.constructor(nil, ElevatorDoor2) local DoorTween2 = Tween.constructor(nil, ElevatorDoor2)
local DoorSensor: {[string]: BasePart} = { local DoorSensor: DoorSensors = {
Start = ElevatorDoorSensor:WaitForChild("Start"), Start = ElevatorDoorSensor:WaitForChild("Start"),
End = ElevatorDoorSensor:WaitForChild("End") End = ElevatorDoorSensor:WaitForChild("End")
} }
local DoorClosingClick = Instance.new("Sound")
DoorClosingClick.SoundId = "rbxassetid://16357740945"
DoorClosingClick.Volume = .1
DoorClosingClick.Parent = ElevatorDoor2
return setmetatable({ return setmetatable({
DoorTween1 = DoorTween1, DoorTween1 = DoorTween1,
DoorTween2 = DoorTween2, DoorTween2 = DoorTween2,
DoorSensor = DoorSensor, DoorSensor = DoorSensor,
ElevatorBox = ElevatorBox, ElevatorBox = ElevatorBox,
ElevatorDoor1 = ElevatorDoor1, ElevatorDoor1 = ElevatorDoor1,
ElevatorDoor2 = ElevatorDoor2 ElevatorDoor2 = ElevatorDoor2,
DoorClosingClick = DoorClosingClick
}, Doors) }, Doors)
end end
local function DoorsAnimation(self, opening: boolean?) --speed
local init_opened_door1: Vector3?,
init_opened_door2: Vector3?,
init_closed_door1: Vector3?,
init_closed_door2: Vector3?
--Solve[5/x==3.5,x]
--Solve was unable to solve the system with inexact coefficients. The answer was obtained by solving a corresponding exact system and numericizing the result.
local opening_speed = Doors.ElevatorDoorTime/1.4285714285714286
local sensor_opening_speed = Doors.ElevatorDoorTime/2.5
local function DoorsAnimationFloor(floor: number, opening: boolean?, activated_via_censor: boolean?, TweenTime: number): (Tween, Tween)
local DoorTween1 = Tween.constructor(nil, Floor10_Door1)
local DoorTween2 = Tween.constructor(nil, Floor10_Door2)
local Door1Tween_Floor: Tween = Floor10_Door1:Start(nil, {
Position = opening and init_closed_door1 or init_opened_door1
}, TweenInfo.new(
TweenTime,
activated_via_censor and Enum.EasingStyle.Linear or Doors.ElevatorDoorStyle,
Enum.EasingDirection.InOut
))
local Door2Tween_Floor: Tween = Floor10_Door2:Start(nil, {
Position = opening and init_closed_door1 or init_opened_door1
}, TweenInfo.new(
TweenTime,
activated_via_censor and Enum.EasingStyle.Linear or Doors.ElevatorDoorStyle,
Enum.EasingDirection.InOut
))
return Door1Tween_Floor, Door2Tween_Floor
end
local function DoorsAnimation(self, opening: boolean?, activated_via_censor: boolean?)
self.ElevatorBox.Anchored = true
local ElevatorDoor1_P = self.ElevatorDoor1.Position local ElevatorDoor1_P = self.ElevatorDoor1.Position
local ElevatorDoor2_P = self.ElevatorDoor2.Position local ElevatorDoor2_P = self.ElevatorDoor2.Position
local TweenTime = opening and 3.5 or 5
local Door1Tween = self.DoorTween1:Start(nil, {
Position = opening and ElevatorDoor1_P+Vector3.xAxis*math.max((ElevatorDoor1_P-Door1Stopped_X).X, Door1Stopped_X.X) or ElevatorDoor1_P-Door1Stopped_X
}, TweenInfo.new(
TweenTime,
Enum.EasingStyle.Quad,
Enum.EasingDirection.InOut
))
local Door2Tween = self.DoorTween2:Start(nil, {
Position = opening and ElevatorDoor2_P+Vector3.xAxis*math.max((ElevatorDoor2_P-Door2Stopped_X).X, Door2Stopped_X.X) or ElevatorDoor2_P-Door1Stopped_X
}, TweenInfo.new(
TweenTime,
Enum.EasingStyle.Quad,
Enum.EasingDirection.InOut
))
if Doors.DontLeakMemory then local TweenTime = activated_via_censor and sensor_opening_speed or opening and opening_speed or Doors.ElevatorDoorTime
Doors.DontLeakMemory:Disconnect()
if opening then
if not init_closed_door1 and not init_closed_door2 then
init_closed_door1 = ElevatorDoor1_P+Doors.Door1Stopped_X
init_closed_door2 = ElevatorDoor2_P+Doors.Door2Stopped_X
end
else
if not init_opened_door1 and not init_opened_door2 then
init_opened_door1 = ElevatorDoor1_P-Doors.Door1Stopped_X
init_opened_door2 = ElevatorDoor2_P-Doors.Door2Stopped_X
end
end end
Doors.DontLeakMemory = self:DetectSensorHit(Door1Tween, Door2Tween)
local Door1Tween: Tween = self.DoorTween1:Start(nil, {
Position = opening and init_closed_door1 or init_opened_door1
}, TweenInfo.new(
TweenTime,
activated_via_censor and Enum.EasingStyle.Linear or Doors.ElevatorDoorStyle,
Enum.EasingDirection.InOut
))
local Door2Tween: Tween = self.DoorTween2:Start(nil, {
Position = opening and init_closed_door2 or init_opened_door2
}, TweenInfo.new(
TweenTime,
activated_via_censor and Enum.EasingStyle.Linear or Doors.ElevatorDoorStyle,
Enum.EasingDirection.InOut
))
if not opening then
--Door clicking noise
task.delay(Doors.ElevatorDoorTime-.90, function()
--is the door close enough to closing?
if init_closed_door2.X-self.ElevatorDoor2.Position.X>5 then
self.DoorClosingClick:Play()
end
end)
end
if Doors.__DontLeakMemory then
Doors.__DontLeakMemory:Disconnect()
end
Doors.__DontLeakMemory = self:DetectSensorHit(Door1Tween, Door2Tween)
return Door1Tween, Door2Tween return Door1Tween, Door2Tween
end end
local raycastParams = RaycastParams.new() local raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.Exclude raycastParams.FilterType = Enum.RaycastFilterType.Exclude
raycastParams.IgnoreWater = true --sure ig
--heh.. --heh..
local RayIgnoring = {} local RayIgnoring = {}
@@ -73,20 +142,20 @@ for n: number = 1, #workspace_items do
end end
end end
function Doors:DetectSensorHit(DoorTween1, DoorTween2): nil | RBXScriptSignal function Doors:DetectSensorHit(DoorTween1, DoorTween2): RBXScriptSignal?
local Step = nil local Step = nil
if Doors.Closed then if Doors.Sensors and Doors.Closed then
raycastParams.FilterDescendantsInstances = {self.ElevatorBox, table.unpack(RayIgnoring)} raycastParams.FilterDescendantsInstances = {self.ElevatorBox, table.unpack(RayIgnoring)}
Step = RS.Stepped:Connect(function(_delta, _dt) Step = RS.Stepped:Connect(function(_delta, _dt)
print("Running")
local DoorSensor = workspace:Raycast(self.DoorSensor.Start.Position, self.DoorSensor.End.Position, raycastParams) local DoorSensor = workspace:Raycast(self.DoorSensor.Start.Position, self.DoorSensor.End.Position, raycastParams)
if DoorSensor and DoorSensor.Instance and DoorSensor.Instance:IsA("BasePart") then if DoorSensor and DoorSensor.Instance and DoorSensor.Instance:IsA("BasePart") then
Step:Disconnect() Step:Disconnect()
print("Hit=",DoorSensor.Instance:GetFullName())
DoorTween1:Pause() DoorTween1:Pause()
DoorTween2:Pause() DoorTween2:Pause()
task.wait(1) --elevator at my work has this similar delay lol task.wait(1) --elevators irl have this delay
DoorsAnimation(self, true) DoorsAnimation(self, true, true)
-- DoorTween1:Destroy() -- DoorTween1:Destroy()
-- DoorTween2:Destroy() -- DoorTween2:Destroy()
end end
@@ -112,14 +181,12 @@ function Doors:Opening(opening: boolean?)
return return
end end
end end
self.ElevatorBox.Anchored = true
local Door1Tween, Door2Tween = DoorsAnimation(self, opening) local Door1Tween, Door2Tween = DoorsAnimation(self, opening)
Door2Tween.Completed:Wait() Door2Tween.Completed:Wait()
if Doors.DontLeakMemory then if Doors.__DontLeakMemory then
Doors.DontLeakMemory:Disconnect() Doors.__DontLeakMemory:Disconnect()
end end
self.ElevatorBox.Anchored = false
end end
return Doors return Doors

View File

@@ -1,5 +1,6 @@
local Elevator = script.Parent local Elevator = script.Parent
local Elevators = Elevator.Parent local Elevators = Elevator.Parent
local RS = game:GetService("ReplicatedStorage") local RS = game:GetService("ReplicatedStorage")
local Tags = require(RS:WaitForChild("Tags")) local Tags = require(RS:WaitForChild("Tags"))
@@ -32,12 +33,9 @@ local function GoTo_Level(requested_level: number)
end end
end end
--"it will solve the issue of exploiters messing with the elevator" while true do
ElevatorBox_1960:SetNetworkOwner(nil) task.wait(2)
ElevatorDoors:Opening(true)
print(Tags) task.wait(2)
ElevatorDoors:Opening(false)
task.wait(2) end
ElevatorDoors:Opening(true)
task.wait(2)
ElevatorDoors:Opening(false)

View File

@@ -1,11 +1,12 @@
--All debugging objects such as light source indicating objects will be turned invisible --All debugging objects such as light source indicating objects will be turned invisible
local Players = game:GetService("Players") local Players = game:GetService("Players")
local CS = game:GetService("CollectionService")
export type Entities = { export type Entities = {
IndexedEntities: {Instance} IndexedEntities: {Instance}
} }
local StudioEntities: Entities = { local StudioEntities = {
IndexedEntities = {} IndexedEntities = {}
} }
@@ -54,21 +55,36 @@ function StudioEntities.indexAll(enabled: boolean): Entities
Case(Item, enabled) Case(Item, enabled)
end end
if Item:IsA("BasePart") then --Do micro optimizations if Item:IsA("BasePart") then
Item.CanTouch = false Item.CanTouch = false --Do micro optimizations
--Security from exploiters
if not Item.Anchored and table.find(CS:GetTags(Item), "ServerGuard_Physics") then
local succ, err = pcall(Item.SetNetworkOwner, Item, nil)
if succ then
CS:RemoveTag(Item, "ServerGuard_Physics")
print(`[Server Physics Guard]: "{Item}" Networking -> "{Item:GetNetworkOwner()}", {Item:GetFullName()}`)
else
warn(err)
end
end
elseif Item:IsA("LuaSourceContainer") then --Cant allow scripts outside of the framework elseif Item:IsA("LuaSourceContainer") then --Cant allow scripts outside of the framework
--mini algorthim to see if the script is part of the rhpid-framework character or not --mini algorthim to see if the script is part of the rhpid-framework character or not
local Model = Item:FindFirstAncestorOfClass("Model") local Model = Item:FindFirstAncestorOfClass("Model")
if not Players:GetPlayerFromCharacter(Model) then if not Players:GetPlayerFromCharacter(Model) then
local Path = Item:GetFullName()
pcall(function() pcall(function()
Item.Enabled = false Item.Enabled = false
end) end)
Item:Destroy() Item:Destroy()
warn(`Script: "{Item.Name}" ({Item.ClassName}) was removed because it was outside of the rhpid-framework boundries,`, Path) warn(`Script: "{Item.Name}" ({Item.ClassName}) was removed because it was outside of the rhpid-framework boundries,`, Item:GetFullName())
end end
end end
if table.find(CS:GetTags(Item), "ServerGuard_Physics") then
warn(`[Server Physics Guard]: present on a non BasePart, "{Item}", {Item:GetFullName()}`)
CS:RemoveTag(Item, "ServerGuard_Physics")
end
end end
else else
for i = 1, #StudioEntities.IndexedEntities do for i = 1, #StudioEntities.IndexedEntities do

View File

@@ -5,7 +5,7 @@ local exports: {[string]: BasePart} = {}
local AllTags = CS:GetAllTags() local AllTags = CS:GetAllTags()
for i = 1, #AllTags do for i = 1, #AllTags do
local TagName = AllTags[i] local TagName = AllTags[i]
if TagName ~= "RopeMasterObject" then if TagName ~= "RopeMasterObject" and TagName ~= "ServerGuard_Physics" then
local Tagged = CS:GetTagged(TagName) local Tagged = CS:GetTagged(TagName)
exports[TagName] = #Tagged>1 and Tagged or Tagged[1] exports[TagName] = #Tagged>1 and Tagged or Tagged[1]
end end