mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 14:51:55 +00:00
Proximity prompt and work on elevator
This commit is contained in:
@@ -40,7 +40,7 @@ type Constructor_Return_Props = {
|
|||||||
Humanoid: Humanoid
|
Humanoid: Humanoid
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BobbingConstructor = ClassConstructor
|
export type BobbingConstructor = Impl_Constructor
|
||||||
|
|
||||||
local Bobbing = {} :: Impl_Constructor
|
local Bobbing = {} :: Impl_Constructor
|
||||||
Bobbing.__index = Bobbing
|
Bobbing.__index = Bobbing
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
--!native
|
--!native
|
||||||
--!strict
|
--!strict
|
||||||
|
|
||||||
type Head = BasePart
|
type Head = BasePart
|
||||||
type UpperTorso = BasePart
|
type UpperTorso = BasePart
|
||||||
type Neck = Motor6D
|
type Neck = Motor6D
|
||||||
type Waist = Motor6D
|
type Waist = Motor6D
|
||||||
type NeckC0 = CFrame
|
type NeckC0 = CFrame
|
||||||
type WaistC0 = CFrame
|
type WaistC0 = CFrame
|
||||||
type UDP = UnreliableRemoteEvent
|
type UDP = UnreliableRemoteEvent
|
||||||
|
|
||||||
type struct_SpineMovement = {
|
type struct_SpineMovement = {
|
||||||
Neck: CFrame,
|
Neck: CFrame,
|
||||||
|
|||||||
@@ -5,14 +5,24 @@
|
|||||||
type CustomCoreGuiEnums = {Enum.CoreGuiType}
|
type CustomCoreGuiEnums = {Enum.CoreGuiType}
|
||||||
|
|
||||||
type Impl_Constructor = {
|
type Impl_Constructor = {
|
||||||
|
On: (self: Impl_Constructor) -> (),
|
||||||
|
Off: (self: Impl_Constructor) -> (),
|
||||||
|
ForceOff: (self: Impl_Constructor) -> (),
|
||||||
|
ForceOn: (self: Impl_Constructor) -> (),
|
||||||
|
} & Impl_Static_Props
|
||||||
|
|
||||||
|
type Impl_Static_Props = {
|
||||||
|
AllowReset: boolean,
|
||||||
|
AllowEmotes: boolean,
|
||||||
|
AllowBackpack: boolean,
|
||||||
|
AllowPlayerList: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
local CoreGuis = {}
|
local CoreGuis = {} :: Impl_Constructor
|
||||||
|
|
||||||
CoreGuis.AllowReset = false
|
CoreGuis.AllowReset = false
|
||||||
CoreGuis.AllowEmotes = true
|
CoreGuis.AllowEmotes = true
|
||||||
CoreGuis.AllowBackpack = false
|
CoreGuis.AllowBackpack = false
|
||||||
CoreGuis.AllowPlayerList = false
|
CoreGuis.AllowPlayerList = false
|
||||||
|
|
||||||
local SG = game:GetService("StarterGui")
|
local SG = game:GetService("StarterGui")
|
||||||
|
|||||||
@@ -2,21 +2,40 @@
|
|||||||
--!native
|
--!native
|
||||||
--!strict
|
--!strict
|
||||||
|
|
||||||
local CrosshairModule = {
|
|
||||||
Icon = "rbxassetid://12643750723"
|
|
||||||
}
|
|
||||||
CrosshairModule.__index = CrosshairModule
|
|
||||||
|
|
||||||
local Storage = game:GetService("ReplicatedStorage")
|
|
||||||
local Easings = require(Storage:WaitForChild("AlgebraEasings"))
|
|
||||||
|
|
||||||
--Use a custom crosshair so we can do effects to it
|
|
||||||
type rbxassetid = string
|
type rbxassetid = string
|
||||||
|
|
||||||
function CrosshairModule.constructor(PlayerGui: PlayerGui)
|
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||||
local Screen = PlayerGui:WaitForChild("Crosshair")
|
type Impl_Constructor = {
|
||||||
local Icon = Screen:WaitForChild("ImageLabel")
|
__index: Impl_Constructor,
|
||||||
|
constructor: Constructor_Fun,
|
||||||
|
--Class functions
|
||||||
|
Enable: (self: ClassConstructor) -> (),
|
||||||
|
Disable: (self: ClassConstructor) -> (),
|
||||||
|
Change: (self: ClassConstructor, ID: rbxassetid) -> (),
|
||||||
|
Jump: (self: ClassConstructor, RootVelocity: Vector3) -> (),
|
||||||
|
} & Impl_Static_Props
|
||||||
|
|
||||||
|
type Constructor_Fun = (PlayerGui: PlayerGui) -> ClassConstructor
|
||||||
|
type Impl_Static_Props = {
|
||||||
|
Icon: rbxassetid
|
||||||
|
}
|
||||||
|
type Constructor_Return_Props = {
|
||||||
|
Screen: ScreenGui,
|
||||||
|
Icon: ImageLabel
|
||||||
|
}
|
||||||
|
|
||||||
|
local CrosshairModule = {} :: Impl_Constructor
|
||||||
|
CrosshairModule.__index = CrosshairModule
|
||||||
|
|
||||||
|
--Use a custom crosshair so we can do effects to it
|
||||||
|
CrosshairModule.Icon = "rbxassetid://12643750723"
|
||||||
|
|
||||||
|
local Storage: ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
|
local Easings = require(Storage:WaitForChild("AlgebraEasings"))
|
||||||
|
|
||||||
|
function CrosshairModule.constructor(PlayerGui: PlayerGui)
|
||||||
|
local Screen = PlayerGui:WaitForChild("Crosshair") :: ScreenGui
|
||||||
|
local Icon = Screen:WaitForChild("ImageLabel") :: ImageLabel
|
||||||
return setmetatable({
|
return setmetatable({
|
||||||
Screen = Screen,
|
Screen = Screen,
|
||||||
Icon = Icon
|
Icon = Icon
|
||||||
@@ -24,21 +43,20 @@ function CrosshairModule.constructor(PlayerGui: PlayerGui)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function CrosshairModule:Enable()
|
function CrosshairModule:Enable()
|
||||||
(self.Screen :: ScreenGui).Enabled = true
|
self.Screen.Enabled = true
|
||||||
end
|
end
|
||||||
|
|
||||||
function CrosshairModule:Disable()
|
function CrosshairModule:Disable()
|
||||||
(self.Screen :: ScreenGui).Enabled = false
|
self.Screen.Enabled = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function CrosshairModule:Change(ID: rbxassetid)
|
function CrosshairModule:Change(ID: rbxassetid)
|
||||||
(self.Icon :: ImageLabel).Image = ID or CrosshairModule.Icon
|
self.Icon.Image = ID or CrosshairModule.Icon
|
||||||
end
|
end
|
||||||
|
|
||||||
function CrosshairModule:Jump(RootVelocity: Vector3)
|
function CrosshairModule:Jump(RootVelocity: Vector3)
|
||||||
local X, Y = RootVelocity.X, RootVelocity.Y;
|
local X, Y = RootVelocity.X, RootVelocity.Y;
|
||||||
|
self.Icon.Position = UDim2.fromScale(
|
||||||
(self.Icon :: ImageLabel).Position = UDim2.fromScale(
|
|
||||||
Y>1 and Easings.Linear(.5,.5+(X/1000),.3) or .5,
|
Y>1 and Easings.Linear(.5,.5+(X/1000),.3) or .5,
|
||||||
math.clamp(.4, .5-(-Y/1000), .6)
|
math.clamp(.4, .5-(-Y/1000), .6)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,12 +2,34 @@
|
|||||||
--!native
|
--!native
|
||||||
--!strict
|
--!strict
|
||||||
|
|
||||||
local HealthModule = {}
|
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||||
|
type Impl_Constructor = {
|
||||||
|
__index: Impl_Constructor,
|
||||||
|
constructor: Constructor_Fun,
|
||||||
|
--Class functions
|
||||||
|
Enable: (self: ClassConstructor) -> (),
|
||||||
|
Disable: (self: ClassConstructor) -> (),
|
||||||
|
DisplayHealth: (self: ClassConstructor, Amount: number) -> (),
|
||||||
|
} & Impl_Static_Props
|
||||||
|
|
||||||
|
type Impl_Static_Props = {
|
||||||
|
Enabled: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
type Constructor_Fun = (PlayerGui: PlayerGui) -> ClassConstructor
|
||||||
|
type Constructor_Return_Props = {
|
||||||
|
HealthGui: ScreenGui,
|
||||||
|
Amount: TextLabel
|
||||||
|
}
|
||||||
|
|
||||||
|
local HealthModule = {} :: Impl_Constructor
|
||||||
HealthModule.__index = HealthModule
|
HealthModule.__index = HealthModule
|
||||||
|
|
||||||
|
HealthModule.Enabled = false
|
||||||
|
|
||||||
function HealthModule.constructor(PlayerGui: PlayerGui)
|
function HealthModule.constructor(PlayerGui: PlayerGui)
|
||||||
local HealthGui = PlayerGui:WaitForChild("Health")
|
local HealthGui = PlayerGui:WaitForChild("Health") :: ScreenGui
|
||||||
local Amount = HealthGui:WaitForChild("Amount")
|
local Amount = HealthGui:WaitForChild("Amount") :: TextLabel
|
||||||
|
|
||||||
return setmetatable({
|
return setmetatable({
|
||||||
HealthGui = HealthGui,
|
HealthGui = HealthGui,
|
||||||
|
|||||||
@@ -4,13 +4,14 @@
|
|||||||
|
|
||||||
--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
|
||||||
|
|
||||||
export type Entities = {IndexedEntities: {Instance}}
|
|
||||||
|
|
||||||
type HideEditor = (a1: BasePart | Folder, a2: boolean) -> ()
|
type HideEditor = (a1: BasePart | Folder, a2: boolean) -> ()
|
||||||
type LuaChangeableContainer = Script | LocalScript
|
type LuaChangeableContainer = Script | LocalScript
|
||||||
|
|
||||||
local Players = game:GetService("Players")
|
local Players: Players = game:GetService("Players")
|
||||||
local CS = game:GetService("CollectionService")
|
local CS: CollectionService = game:GetService("CollectionService")
|
||||||
|
local Storage: ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
|
|
||||||
|
local ServerStorage = Storage:WaitForChild("Server")
|
||||||
|
|
||||||
local StudioEntities = {
|
local StudioEntities = {
|
||||||
IndexedEntities = {}
|
IndexedEntities = {}
|
||||||
@@ -65,7 +66,7 @@ local EditorEntities = {
|
|||||||
["LadderContact"] = HideLadderContact,
|
["LadderContact"] = HideLadderContact,
|
||||||
}
|
}
|
||||||
|
|
||||||
function StudioEntities.indexAll(enabled: boolean): Entities
|
function StudioEntities.indexAll(enabled: boolean)
|
||||||
if #StudioEntities.IndexedEntities == 0 then
|
if #StudioEntities.IndexedEntities == 0 then
|
||||||
--Run when the server starts
|
--Run when the server starts
|
||||||
local WorkspaceEnt = workspace:GetDescendants()
|
local WorkspaceEnt = workspace:GetDescendants()
|
||||||
@@ -93,13 +94,13 @@ function StudioEntities.indexAll(enabled: boolean): Entities
|
|||||||
end
|
end
|
||||||
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 algIsAorthim 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 Model and not Players:GetPlayerFromCharacter(Model) then
|
||||||
pcall(function()
|
if Item:IsA("Script") or Item:IsA("LocalScript") then
|
||||||
(Item :: LuaChangeableContainer).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,`, Item:GetFullName())
|
warn(`Script: "{Item.Name}" ({Item.ClassName}) was removed because it was outside of the rhpid-framework boundries,`, Item:GetFullName())
|
||||||
end
|
end
|
||||||
@@ -120,4 +121,13 @@ function StudioEntities.indexAll(enabled: boolean): Entities
|
|||||||
return StudioEntities.IndexedEntities
|
return StudioEntities.IndexedEntities
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local EditorEntities_Remote = Instance.new("BindableFunction")
|
||||||
|
EditorEntities_Remote.Name = "StudioIndexedEntities"
|
||||||
|
EditorEntities_Remote.Parent = ServerStorage
|
||||||
|
|
||||||
|
EditorEntities_Remote.OnInvoke = function()
|
||||||
|
return StudioEntities.IndexedEntities
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
return StudioEntities
|
return StudioEntities
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
--!optimize 2
|
|
||||||
--!native
|
|
||||||
--!strict
|
|
||||||
|
|
||||||
local Leveling: {[number]: number} = {
|
|
||||||
[1] = 13.205,
|
|
||||||
[10] = 239.216
|
|
||||||
}
|
|
||||||
|
|
||||||
return Leveling
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
--!native
|
--!native
|
||||||
--!strict
|
--!strict
|
||||||
|
|
||||||
return function(ElevatorBox: BasePart, StartPosition: Vector3)
|
return function(ElevatorBox: BasePart, StartPosition: Vector3): (Attachment, AlignPosition, AlignOrientation)
|
||||||
local BoxAttachment = Instance.new("Attachment")
|
local BoxAttachment = Instance.new("Attachment")
|
||||||
BoxAttachment.Parent = ElevatorBox
|
BoxAttachment.Parent = ElevatorBox
|
||||||
|
|
||||||
|
|||||||
@@ -2,36 +2,62 @@
|
|||||||
--!native
|
--!native
|
||||||
--!strict
|
--!strict
|
||||||
|
|
||||||
local Doors = {
|
local RS: RunService = game:GetService("RunService")
|
||||||
Closed = true,
|
local Storage: ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
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
|
|
||||||
|
|
||||||
local RS = game:GetService("RunService")
|
|
||||||
local Storage = game:GetService("ReplicatedStorage")
|
|
||||||
|
|
||||||
local Tween = require(Storage:WaitForChild("Tween"))
|
local Tween = require(Storage:WaitForChild("Tween"))
|
||||||
local Tags = require(Storage:WaitForChild("Tags"))
|
|
||||||
|
|
||||||
local Floor10_Door1 = Tags.ElevatorDoor_1960_Floor10_1
|
|
||||||
local Floor10_Door2 = Tags.ElevatorDoor_1960_Floor10_2
|
|
||||||
|
|
||||||
type DoorSensors = {
|
type DoorSensors = {
|
||||||
[string]: Instance
|
[string]: BasePart
|
||||||
|
}
|
||||||
|
type CustomTween = Tween.TweenClass
|
||||||
|
|
||||||
|
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||||
|
type Impl_Constructor = {
|
||||||
|
__index: Impl_Constructor,
|
||||||
|
constructor: Constructor_Fun,
|
||||||
|
--Class functions
|
||||||
|
DetectSensorHit: (self: ClassConstructor, DoorTween1: Tween, DoorTween2: Tween) -> RBXScriptConnection,
|
||||||
|
Opening: (self: ClassConstructor, opening: boolean?) -> ()
|
||||||
|
} & Impl_Static_Props
|
||||||
|
|
||||||
|
type Constructor_Fun = (ElevatorBox: BasePart, ElevatorDoor1: BasePart, ElevatorDoor2: BasePart, ElevatorDoorSensor: Folder) -> ClassConstructor
|
||||||
|
type Impl_Static_Props = {
|
||||||
|
Closed: boolean,
|
||||||
|
Sensors: boolean,
|
||||||
|
Door1Stopped_X: Vector3,
|
||||||
|
Door2Stopped_X: Vector3,
|
||||||
|
ElevatorDoorTime: number,
|
||||||
|
ElevatorDoorStyle: Enum.EasingStyle,
|
||||||
|
__DontLeakMemory: RBXScriptConnection?
|
||||||
|
}
|
||||||
|
type Constructor_Return_Props = {
|
||||||
|
DoorTween1: CustomTween,
|
||||||
|
DoorTween2: CustomTween,
|
||||||
|
DoorSensor: DoorSensors,
|
||||||
|
ElevatorBox: BasePart,
|
||||||
|
ElevatorDoor1: BasePart,
|
||||||
|
ElevatorDoor2: BasePart,
|
||||||
|
DoorClosingClick: Sound
|
||||||
}
|
}
|
||||||
|
|
||||||
function Doors.constructor(ElevatorBox: BasePart, ElevatorDoor1: BasePart, ElevatorDoor2: BasePart, ElevatorDoorSensor: Folder)
|
local Doors = {} :: Impl_Constructor
|
||||||
|
Doors.__index = Doors
|
||||||
|
|
||||||
|
Doors.Closed = true
|
||||||
|
Doors.Sensors = true
|
||||||
|
Doors.Door1Stopped_X = Vector3.xAxis*2.9
|
||||||
|
Doors.Door2Stopped_X = Vector3.xAxis*5.8
|
||||||
|
Doors.ElevatorDoorTime = 5
|
||||||
|
Doors.ElevatorDoorStyle = Enum.EasingStyle.Quad
|
||||||
|
Doors.__DontLeakMemory = nil
|
||||||
|
|
||||||
|
function Doors.constructor(ElevatorBox, ElevatorDoor1, ElevatorDoor2, ElevatorDoorSensor)
|
||||||
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: DoorSensors = {
|
local DoorSensor: DoorSensors = {
|
||||||
Start = ElevatorDoorSensor:WaitForChild("Start"),
|
Start = ElevatorDoorSensor:WaitForChild("Start") :: BasePart,
|
||||||
End = ElevatorDoorSensor:WaitForChild("End")
|
End = ElevatorDoorSensor:WaitForChild("End") :: BasePart
|
||||||
}
|
}
|
||||||
|
|
||||||
local DoorClosingClick = Instance.new("Sound") :: Sound
|
local DoorClosingClick = Instance.new("Sound") :: Sound
|
||||||
@@ -40,12 +66,12 @@ function Doors.constructor(ElevatorBox: BasePart, ElevatorDoor1: BasePart, Eleva
|
|||||||
DoorClosingClick.Parent = ElevatorDoor2
|
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
|
DoorClosingClick = DoorClosingClick
|
||||||
}, Doors)
|
}, Doors)
|
||||||
end
|
end
|
||||||
@@ -81,7 +107,7 @@ local function DoorsAnimationFloor(floor: number, opening: boolean?, activated_v
|
|||||||
return Door1Tween_Floor, Door2Tween_Floor
|
return Door1Tween_Floor, Door2Tween_Floor
|
||||||
end
|
end
|
||||||
|
|
||||||
local function DoorsAnimation(self, opening: boolean?, activated_via_censor: boolean?)
|
local function DoorsAnimation(self: ClassConstructor, opening: boolean?, activated_via_censor: boolean?)
|
||||||
self.ElevatorBox.Anchored = true
|
self.ElevatorBox.Anchored = true
|
||||||
|
|
||||||
local ElevatorDoor1_P: Vector3 = self.ElevatorDoor1.Position
|
local ElevatorDoor1_P: Vector3 = self.ElevatorDoor1.Position
|
||||||
@@ -101,14 +127,14 @@ local function DoorsAnimation(self, opening: boolean?, activated_via_censor: boo
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local Door1Tween: Tween = self.DoorTween1:Start(nil, {
|
local Door1Tween = self.DoorTween1:Start(nil, {
|
||||||
Position = opening and init_closed_door1 or init_opened_door1
|
Position = opening and init_closed_door1 or init_opened_door1
|
||||||
}, TweenInfo.new(
|
}, TweenInfo.new(
|
||||||
TweenTime,
|
TweenTime,
|
||||||
activated_via_censor and Enum.EasingStyle.Linear or Doors.ElevatorDoorStyle,
|
activated_via_censor and Enum.EasingStyle.Linear or Doors.ElevatorDoorStyle,
|
||||||
Enum.EasingDirection.InOut
|
Enum.EasingDirection.InOut
|
||||||
))
|
))
|
||||||
local Door2Tween: Tween = self.DoorTween2:Start(nil, {
|
local Door2Tween = self.DoorTween2:Start(nil, {
|
||||||
Position = opening and init_closed_door2 or init_opened_door2
|
Position = opening and init_closed_door2 or init_opened_door2
|
||||||
}, TweenInfo.new(
|
}, TweenInfo.new(
|
||||||
TweenTime,
|
TweenTime,
|
||||||
@@ -145,15 +171,12 @@ for n: number = 1, #workspace_items do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
type this = any --yeah,
|
function Doors:DetectSensorHit(DoorTween1, DoorTween2)
|
||||||
type PossibleStepConnection = any
|
local Step = nil
|
||||||
|
|
||||||
function Doors:DetectSensorHit(DoorTween1, DoorTween2): RBXScriptSignal
|
|
||||||
local Step: PossibleStepConnection = nil
|
|
||||||
if Doors.Sensors and 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 :: RunService).Stepped:Connect(function(_delta, _dt)
|
Step = RS.Heartbeat:ConnectParallel(function(_dt)
|
||||||
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
|
||||||
@@ -161,7 +184,7 @@ function Doors:DetectSensorHit(DoorTween1, DoorTween2): RBXScriptSignal
|
|||||||
DoorTween1:Pause()
|
DoorTween1:Pause()
|
||||||
DoorTween2:Pause()
|
DoorTween2:Pause()
|
||||||
task.wait(1) --elevators irl have this delay
|
task.wait(1) --elevators irl have this delay
|
||||||
DoorsAnimation((self :: this), true, true)
|
DoorsAnimation(self, true, true)
|
||||||
-- DoorTween1:Destroy()
|
-- DoorTween1:Destroy()
|
||||||
-- DoorTween2:Destroy()
|
-- DoorTween2:Destroy()
|
||||||
end
|
end
|
||||||
@@ -170,7 +193,7 @@ function Doors:DetectSensorHit(DoorTween1, DoorTween2): RBXScriptSignal
|
|||||||
return Step
|
return Step
|
||||||
end
|
end
|
||||||
|
|
||||||
function Doors:Opening(opening: boolean?)
|
function Doors:Opening(opening)
|
||||||
--short circuiting central
|
--short circuiting central
|
||||||
if opening then
|
if opening then
|
||||||
if Doors.Closed then
|
if Doors.Closed then
|
||||||
|
|||||||
18
src/server/main/Elevators/Otis1960/Leveling.lua
Normal file
18
src/server/main/Elevators/Otis1960/Leveling.lua
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
--!optimize 2
|
||||||
|
--!native
|
||||||
|
--!strict
|
||||||
|
|
||||||
|
local Leveling: {[number]: number} = {
|
||||||
|
[1] = 13.031,
|
||||||
|
[2] = 0,
|
||||||
|
[3] = 0,
|
||||||
|
[4] = 0,
|
||||||
|
[5] = 0,
|
||||||
|
[6] = 0,
|
||||||
|
[7] = 0,
|
||||||
|
[8] = 0,
|
||||||
|
[9] = 0,
|
||||||
|
[10] = 239.245
|
||||||
|
}
|
||||||
|
|
||||||
|
return Leveling
|
||||||
87
src/server/main/Elevators/Otis1960/init.lua
Normal file
87
src/server/main/Elevators/Otis1960/init.lua
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
--!optimize 2
|
||||||
|
--!native
|
||||||
|
--!strict
|
||||||
|
|
||||||
|
local Elevators = script.Parent
|
||||||
|
|
||||||
|
local RS: ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
|
local TagsModule = require(RS:WaitForChild("Tags"))
|
||||||
|
|
||||||
|
local Leveling = require(script:WaitForChild("Leveling"))
|
||||||
|
local Doors = require(script:WaitForChild("Doors"))
|
||||||
|
local ElevatorMover = require(Elevators:WaitForChild("Mover"))
|
||||||
|
|
||||||
|
type Tags = TagsModule.ExportedTags
|
||||||
|
|
||||||
|
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||||
|
type Impl_Constructor = {
|
||||||
|
__index: Impl_Constructor,
|
||||||
|
constructor: Constructor_Fun,
|
||||||
|
--Class functions
|
||||||
|
MoveFloors: (self: ClassConstructor, Level: number) -> (),
|
||||||
|
GoToLevel: (self: ClassConstructor, RequestedLevel: number) -> ()
|
||||||
|
}
|
||||||
|
|
||||||
|
type Constructor_Fun = (Tags: Tags) -> ClassConstructor
|
||||||
|
type Constructor_Return_Props = {
|
||||||
|
ElevatorBox_1960: BasePart,
|
||||||
|
ElevatorBox: BasePart,
|
||||||
|
ElevatorDoor1: BasePart,
|
||||||
|
ElevatorDoor2: BasePart,
|
||||||
|
ElevatorDoorSensor: Folder,
|
||||||
|
ProximityButtons: {Instance},
|
||||||
|
BoxAttachment: Attachment,
|
||||||
|
BoxAlignPosition: AlignPosition,
|
||||||
|
BoxAlignOrientation: AlignOrientation,
|
||||||
|
ElevatorDoors: BasePart,
|
||||||
|
}
|
||||||
|
|
||||||
|
local Otis1960 = {} :: Impl_Constructor
|
||||||
|
Otis1960.__index = Otis1960
|
||||||
|
|
||||||
|
local function PromptButtons(self: Constructor_Return_Props)
|
||||||
|
for i: number = 1, #self.ProximityButtons do
|
||||||
|
local Button = self.ProximityButtons[i]
|
||||||
|
|
||||||
|
local Attachment = Instance.new("Attachment") :: Attachment
|
||||||
|
Attachment.Parent = Button
|
||||||
|
local Prompt = Instance.new("ProximityPrompt") :: ProximityPrompt
|
||||||
|
Prompt.MaxActivationDistance = 3
|
||||||
|
Prompt.Parent = Attachment
|
||||||
|
|
||||||
|
print(`Created a ProximityPrompt @ "{Button:GetFullName()}"`)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Otis1960.constructor(Tags)
|
||||||
|
local self = {} :: Constructor_Return_Props
|
||||||
|
self.ElevatorBox_1960 = Tags.ElevatorMover_1960 :: BasePart
|
||||||
|
self.ElevatorBox = Tags.ElevatorMover_1960 :: BasePart
|
||||||
|
self.ElevatorDoor1 = Tags.ElevatorDoor_1960_1 :: BasePart
|
||||||
|
self.ElevatorDoor2 = Tags.ElevatorDoor_1960_2 :: BasePart
|
||||||
|
self.ElevatorDoorSensor = Tags.ElevatorDoor_Sensor_1960 :: Folder
|
||||||
|
self.ProximityButtons = Tags.ProximityElevatorButton :: {Instance}
|
||||||
|
|
||||||
|
self.BoxAttachment, self.BoxAlignPosition, self.BoxAlignOrientation = ElevatorMover(self.ElevatorBox_1960, self.ElevatorBox_1960.Position)
|
||||||
|
self.ElevatorDoors = Doors.constructor(self.ElevatorBox, self.ElevatorDoor1, self.ElevatorDoor2, self.ElevatorDoorSensor)
|
||||||
|
|
||||||
|
PromptButtons(self)
|
||||||
|
print("Otis1960 initialized and ready")
|
||||||
|
|
||||||
|
return setmetatable(self, Otis1960)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Otis1960:MoveFloors(Level)
|
||||||
|
local ElevatorBoxCurrentPos = self.ElevatorBox.Position
|
||||||
|
--Its gonna use raycasting inside of the shaft to detect when its near and when to stop
|
||||||
|
self.BoxAlignPosition.Position = Vector3.new(ElevatorBoxCurrentPos.X, Level, ElevatorBoxCurrentPos.Z)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Otis1960:GoToLevel(RequestedLevel)
|
||||||
|
local level: number = Leveling[RequestedLevel]
|
||||||
|
if level then
|
||||||
|
self:MoveFloors(level)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return Otis1960
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
--!optimize 2
|
|
||||||
--!native
|
|
||||||
--!strict
|
|
||||||
|
|
||||||
local Otis1960_main = {}
|
|
||||||
Otis1960_main.__index = Otis1960_main
|
|
||||||
|
|
||||||
local Elevator = script.Parent
|
|
||||||
local Elevators = Elevator.Parent
|
|
||||||
|
|
||||||
local RS = game:GetService("ReplicatedStorage")
|
|
||||||
|
|
||||||
local TagsModule = require(RS:WaitForChild("Tags"))
|
|
||||||
local Leveling = require(Elevators:WaitForChild("Leveling"))
|
|
||||||
local Doors = require(Elevator:WaitForChild("Doors"))
|
|
||||||
local ElevatorMover = require(Elevators:WaitForChild("Mover"))
|
|
||||||
|
|
||||||
local Tags = TagsModule.constructor().Exports
|
|
||||||
|
|
||||||
local ElevatorBox_1960 = Tags.ElevatorMover_1960
|
|
||||||
local ElevatorBox = Tags.ElevatorMover_1960 :: BasePart
|
|
||||||
local ElevatorDoor1 = Tags.ElevatorDoor_1960_1 :: BasePart
|
|
||||||
local ElevatorDoor2 = Tags.ElevatorDoor_1960_2 :: BasePart
|
|
||||||
local ElevatorDoorSensor = Tags.ElevatorDoor_Sensor_1960 :: Folder
|
|
||||||
|
|
||||||
local ElevatorBoxStartPos = ElevatorBox_1960.Position
|
|
||||||
|
|
||||||
local _BoxAttachment, BoxAlignPosition, _BoxAlignOrientation = ElevatorMover(ElevatorBox_1960, ElevatorBoxStartPos)
|
|
||||||
|
|
||||||
local ElevatorDoors = Doors.constructor(ElevatorBox, ElevatorDoor1, ElevatorDoor2, ElevatorDoorSensor)
|
|
||||||
|
|
||||||
local function MoveFloors(level: number)
|
|
||||||
local ElevatorBoxCurrentPos = ElevatorBox.Position
|
|
||||||
--Its gonna use raycasting inside of the shaft to detect when its near and when to stop
|
|
||||||
BoxAlignPosition.Position = Vector3.new(ElevatorBoxCurrentPos.X, level, ElevatorBoxCurrentPos.Z)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function GoTo_Level(requested_level: number)
|
|
||||||
local level: number = Leveling[requested_level]
|
|
||||||
if level then
|
|
||||||
MoveFloors(level)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
print("[DEBUG]: Tags:",Tags)
|
|
||||||
|
|
||||||
-- while true do
|
|
||||||
-- task.wait(2)
|
|
||||||
-- ElevatorDoors:Opening(true)
|
|
||||||
-- task.wait(2)
|
|
||||||
-- ElevatorDoors:Opening(false)
|
|
||||||
-- end
|
|
||||||
|
|
||||||
return Otis1960_main
|
|
||||||
@@ -2,35 +2,29 @@
|
|||||||
--!native
|
--!native
|
||||||
--!strict
|
--!strict
|
||||||
|
|
||||||
|
local RS: RunService = game:GetService("RunService")
|
||||||
|
local Storage: ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
|
|
||||||
|
local Elevators = script:WaitForChild("Elevators")
|
||||||
|
local TagsModule = require(Storage:WaitForChild("Tags"))
|
||||||
|
|
||||||
local HideEditorEntities = require(script:WaitForChild("EditorEntities"))
|
local HideEditorEntities = require(script:WaitForChild("EditorEntities"))
|
||||||
local Lighting_Stuff = require(script:WaitForChild("Lighting"))
|
local Lighting_Stuff = require(script:WaitForChild("Lighting"))
|
||||||
local Workspace_Stuff = require(script:WaitForChild("Workspace"))
|
local Workspace_Stuff = require(script:WaitForChild("Workspace"))
|
||||||
local StarterPlayer_Stuff = require(script:WaitForChild("StarterPlayer"))
|
local StarterPlayer_Stuff = require(script:WaitForChild("StarterPlayer"))
|
||||||
|
|
||||||
local RS = game:GetService("RunService")
|
local Otis1960_Module = require(Elevators:WaitForChild("Otis1960"))
|
||||||
local Storage = game:GetService("ReplicatedStorage")
|
|
||||||
|
|
||||||
local TagsModule = require(Storage:WaitForChild("Tags"))
|
|
||||||
|
|
||||||
local TagsConstructor = TagsModule.constructor()
|
local TagsConstructor = TagsModule.constructor()
|
||||||
local Tags = TagsConstructor.Exports
|
local Tags = TagsConstructor.Exports
|
||||||
print("[DEBUG] Tags=", Tags)
|
print("[DEBUG] Tags=", Tags)
|
||||||
|
|
||||||
local Elevators = script:WaitForChild("Elevators")
|
HideEditorEntities.indexAll(not false)
|
||||||
local ServerStorage = Storage:WaitForChild("Server")
|
TagsConstructor:Nuke()
|
||||||
|
|
||||||
local EditorEntities = Instance.new("BindableFunction")
|
|
||||||
EditorEntities.Name = "StudioIndexedEntities"
|
|
||||||
EditorEntities.Parent = ServerStorage
|
|
||||||
|
|
||||||
local StudioEntities = HideEditorEntities.indexAll(not false)
|
|
||||||
|
|
||||||
StarterPlayer_Stuff()
|
StarterPlayer_Stuff()
|
||||||
Lighting_Stuff()
|
Lighting_Stuff()
|
||||||
Workspace_Stuff()
|
Workspace_Stuff()
|
||||||
|
|
||||||
EditorEntities.OnInvoke = function(): HideEditorEntities.Entities
|
--Start the elevators
|
||||||
return StudioEntities.IndexedEntities
|
local Otis1960 = Otis1960_Module.constructor(Tags)
|
||||||
end
|
|
||||||
|
|
||||||
TagsConstructor:Nuke()
|
|
||||||
|
|||||||
@@ -2,15 +2,29 @@
|
|||||||
--!native
|
--!native
|
||||||
--!strict
|
--!strict
|
||||||
|
|
||||||
local Tags = {}
|
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||||
|
type Impl_Constructor = {
|
||||||
|
__index: Impl_Constructor,
|
||||||
|
constructor: Constructor_Fun,
|
||||||
|
--Class functions
|
||||||
|
Nuke: (self: ClassConstructor) -> (),
|
||||||
|
}
|
||||||
|
|
||||||
|
type Constructor_Fun = () -> ClassConstructor
|
||||||
|
type Constructor_Return_Props = {
|
||||||
|
Exports: ExportedTags
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ExportedTags = {
|
||||||
|
[string]: Instance | {Instance}
|
||||||
|
}
|
||||||
|
export type TagsConstructor = ClassConstructor
|
||||||
|
|
||||||
|
local Tags = {} :: Impl_Constructor
|
||||||
Tags.__index = Tags
|
Tags.__index = Tags
|
||||||
|
|
||||||
local CS = game:GetService("CollectionService")
|
local CS = game:GetService("CollectionService")
|
||||||
|
|
||||||
type ExportedTags = {
|
|
||||||
[string]: Instance | {Instance}
|
|
||||||
}
|
|
||||||
|
|
||||||
function Tags.constructor()
|
function Tags.constructor()
|
||||||
local Exports: ExportedTags = {}
|
local Exports: ExportedTags = {}
|
||||||
local AllTags = CS:GetAllTags()
|
local AllTags = CS:GetAllTags()
|
||||||
|
|||||||
@@ -2,24 +2,42 @@
|
|||||||
--!native
|
--!native
|
||||||
--!strict
|
--!strict
|
||||||
|
|
||||||
local Tween = {}
|
type TweenAnimation = {[string]: any}
|
||||||
|
|
||||||
|
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||||
|
type Impl_Constructor = {
|
||||||
|
__index: Impl_Constructor,
|
||||||
|
constructor: Constructor_Fun,
|
||||||
|
--Class functions
|
||||||
|
Start: (self: ClassConstructor, PostInstance: Instance?, PostProperties: TweenAnimation?, PostTweenSettings: TweenInfo?) -> Tween,
|
||||||
|
}
|
||||||
|
|
||||||
|
type Constructor_Fun = (TweenSettings: TweenInfo?, Object: Instance?, PreProperties: TweenAnimation?) -> ClassConstructor
|
||||||
|
type Constructor_Return_Props = {
|
||||||
|
TweenInfo: TweenInfo?,
|
||||||
|
Instance: Instance?,
|
||||||
|
PreProperties: TweenAnimation?,
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TweenClass = ClassConstructor
|
||||||
|
export type TweenConstructor = Impl_Constructor
|
||||||
|
|
||||||
|
local Tween = {} :: Impl_Constructor
|
||||||
Tween.__index = Tween
|
Tween.__index = Tween
|
||||||
|
|
||||||
local TS = game:GetService("TweenService")
|
local TS = game:GetService("TweenService")
|
||||||
|
|
||||||
type TweenAnimation = {[string]: any}
|
function Tween.constructor(TweenSettings, Object, PreProperties)
|
||||||
|
|
||||||
function Tween.constructor(TweenSettings: TweenInfo?, Object: Instance?, PreProperties: TweenAnimation?)
|
|
||||||
return setmetatable({
|
return setmetatable({
|
||||||
TweenInfo = TweenSettings,
|
TweenInfo = TweenSettings,
|
||||||
Instance = Object,
|
Instance = Object,
|
||||||
PreProperties = PreProperties
|
PreProperties = PreProperties
|
||||||
}, Tween)
|
}, Tween)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Tween:Start(PostInstance: Instance?, PostProperties: TweenAnimation?, PostTweenSettings: TweenInfo?): Tween
|
function Tween:Start(PostInstance, PostProperties, PostTweenSettings)
|
||||||
local Props = self.PreProperties
|
local Props = self.PreProperties
|
||||||
local Object = self.Instance
|
local Object = self.Instance
|
||||||
local TweenSettings = self.TweenInfo
|
local TweenSettings = self.TweenInfo
|
||||||
|
|
||||||
if PostProperties then
|
if PostProperties then
|
||||||
|
|||||||
Reference in New Issue
Block a user