Proximity prompt and work on elevator

This commit is contained in:
2024-03-10 21:41:10 -04:00
parent 3e28667b13
commit df86e6efb6
15 changed files with 327 additions and 177 deletions

View File

@@ -40,7 +40,7 @@ type Constructor_Return_Props = {
Humanoid: Humanoid
}
export type BobbingConstructor = ClassConstructor
export type BobbingConstructor = Impl_Constructor
local Bobbing = {} :: Impl_Constructor
Bobbing.__index = Bobbing

View File

@@ -2,13 +2,13 @@
--!native
--!strict
type Head = BasePart
type Head = BasePart
type UpperTorso = BasePart
type Neck = Motor6D
type Waist = Motor6D
type NeckC0 = CFrame
type WaistC0 = CFrame
type UDP = UnreliableRemoteEvent
type Neck = Motor6D
type Waist = Motor6D
type NeckC0 = CFrame
type WaistC0 = CFrame
type UDP = UnreliableRemoteEvent
type struct_SpineMovement = {
Neck: CFrame,

View File

@@ -5,14 +5,24 @@
type CustomCoreGuiEnums = {Enum.CoreGuiType}
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.AllowEmotes = true
CoreGuis.AllowBackpack = false
CoreGuis.AllowReset = false
CoreGuis.AllowEmotes = true
CoreGuis.AllowBackpack = false
CoreGuis.AllowPlayerList = false
local SG = game:GetService("StarterGui")

View File

@@ -2,21 +2,40 @@
--!native
--!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
function CrosshairModule.constructor(PlayerGui: PlayerGui)
local Screen = PlayerGui:WaitForChild("Crosshair")
local Icon = Screen:WaitForChild("ImageLabel")
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) -> (),
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({
Screen = Screen,
Icon = Icon
@@ -24,21 +43,20 @@ function CrosshairModule.constructor(PlayerGui: PlayerGui)
end
function CrosshairModule:Enable()
(self.Screen :: ScreenGui).Enabled = true
self.Screen.Enabled = true
end
function CrosshairModule:Disable()
(self.Screen :: ScreenGui).Enabled = false
self.Screen.Enabled = false
end
function CrosshairModule:Change(ID: rbxassetid)
(self.Icon :: ImageLabel).Image = ID or CrosshairModule.Icon
self.Icon.Image = ID or CrosshairModule.Icon
end
function CrosshairModule:Jump(RootVelocity: Vector3)
local X, Y = RootVelocity.X, RootVelocity.Y;
(self.Icon :: ImageLabel).Position = UDim2.fromScale(
self.Icon.Position = UDim2.fromScale(
Y>1 and Easings.Linear(.5,.5+(X/1000),.3) or .5,
math.clamp(.4, .5-(-Y/1000), .6)
)

View File

@@ -2,12 +2,34 @@
--!native
--!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.Enabled = false
function HealthModule.constructor(PlayerGui: PlayerGui)
local HealthGui = PlayerGui:WaitForChild("Health")
local Amount = HealthGui:WaitForChild("Amount")
local HealthGui = PlayerGui:WaitForChild("Health") :: ScreenGui
local Amount = HealthGui:WaitForChild("Amount") :: TextLabel
return setmetatable({
HealthGui = HealthGui,