This commit is contained in:
2024-04-30 01:52:19 -04:00
parent 62e90a9a17
commit 94a45c2bce
3 changed files with 29 additions and 26 deletions

View File

@@ -2,7 +2,7 @@
--!native
--!strict
type LightingProps = { [string]: Color3 | number | boolean | string }
type LightingProps = { [string]: Color3 | number | boolean | string | Enum.Technology }
export type Effects = {
ColorCorrection: ColorCorrectionEffect
@@ -28,19 +28,10 @@ local Lighting_PropsTree: LightingProps = {
["FogColor"] = Color3.new(0,0,0),
["FogEnd"] = 10_0000,
["FogStart"] = 10_0000,
["Technology"] = Enum.Technology.Future
}
local function Skybox(): (Sky, Atmosphere, BloomEffect)
local SkyBox = Instance.new("Sky") :: Sky
SkyBox.SkyboxBk = "rbxassetid://48020371"
SkyBox.SkyboxDn = "rbxassetid://48020144"
SkyBox.SkyboxFt = "rbxassetid://48020234"
SkyBox.SkyboxLf = "rbxassetid://48020211"
SkyBox.SkyboxRt = "rbxassetid://48020254"
SkyBox.SkyboxUp = "rbxassetid://48020383"
SkyBox.MoonTextureId = ""
SkyBox.StarCount = 500
local function Skybox(): (Atmosphere, BloomEffect)
local Atmosphere = Instance.new("Atmosphere") :: Atmosphere
Atmosphere.Density = .429
Atmosphere.Offset = 0
@@ -54,7 +45,7 @@ local function Skybox(): (Sky, Atmosphere, BloomEffect)
Bloom.Size = 35
Bloom.Threshold = 1.5
return SkyBox, Atmosphere, Bloom
return Atmosphere, Bloom
end
return function(): Effects
@@ -73,8 +64,7 @@ return function(): Effects
end
end
local Sky, Atmosphere, Bloom = Skybox()
Sky.Parent = Lighting
local Atmosphere, Bloom = Skybox()
Atmosphere.Parent = Lighting
Bloom.Parent = Lighting

View File

@@ -46,10 +46,11 @@ function Lights.constructor(LightSwitches)
}, Lights)
end
local EnumMaterials = Enum.Material:GetEnumItems()
local EnumMaterials: {Enum.Material} = Enum.Material:GetEnumItems()
local EnumMaterialsNames: {string} = {}
--Convert it all to string values, couldnt figure out any hacks to make it a true one liner
for k: number, v: Enum.Material in EnumMaterials do
EnumMaterials[k] = v.Name
EnumMaterialsNames[k] = v.Name
end
local function ToggleSwitchLight(EnabledState: boolean, LightProperties: LightPropertiesSafe)
@@ -61,15 +62,11 @@ local function ToggleSwitchLight(EnabledState: boolean, LightProperties: LightPr
local LightObject = LightProperties.Lights[n] :: BasePart
if EnabledState then
local ActivatedMaterial = table.find(EnumMaterials, LightProperties.ActivatedMaterial) or 1 --Only doing this because it is runtime safe
LightObject.Color = LightProperties.ColorActivated
LightObject.Material = EnumMaterials[ActivatedMaterial]
LightObject.Material = Enum.Material[LightProperties.ActivatedMaterial]
else
local DeactivatedMaterial = table.find(EnumMaterials, LightProperties.DeactivatedMaterial) or 1 --Only doing this because it is runtime safe
LightObject.Color = LightProperties.ColorDeactivated
LightObject.Material = EnumMaterials[DeactivatedMaterial]
LightObject.Material = Enum.Material[LightProperties.DeactivatedMaterial]
end
end
end
@@ -138,6 +135,21 @@ function Lights:Init()
LightProperties.Prompt.ActionText = "Toggle On"
end
local ActivatedMaterial = table.find(EnumMaterialsNames, LightProperties.ActivatedMaterial) :: number
local DeactivatedMaterial = table.find(EnumMaterialsNames, LightProperties.DeactivatedMaterial) :: number
if not ActivatedMaterial then
ActivatedMaterial = 1
warn()
end
if not DeactivatedMaterial then
DeactivatedMaterial = 1
warn()
end
LightProperties.ActivatedMaterial = EnumMaterialsNames[ActivatedMaterial]
LightProperties.DeactivatedMaterial = EnumMaterialsNames[DeactivatedMaterial]
ToggleSwitch(EnabledState, LightProperties :: LightPropertiesSafe, false)
Prompt:AddHookTriggered(function(_Player: Player)

View File

@@ -3,7 +3,8 @@
--!strict
type HumanoidRootPart = BasePart
type PromptCallback = (Player: Player, Root: HumanoidRootPart) -> ()
type Character = Model
type PromptCallback = (Player: Player, HumanoidRootPart: HumanoidRootPart, Character: Character) -> ()
type PromptSignal = RBXScriptSignal<Player>
type PromptSignalName = "Triggered" | "TriggerEnded"
@@ -52,7 +53,7 @@ local function DistanceCheck(self: ClassConstructor, Player: Player)
if Root then
if (Root.Position-(self.Instance :: BasePart).Position).Magnitude<=self.Prompt.MaxActivationDistance+1 then
(self.__TriggeredCallback :: PromptCallback)(Player, Root)
(self.__TriggeredCallback :: PromptCallback)(Player, Root, PlayerCharacter :: Character)
else
warn(`{Player.Name}, {Player.UserId} activated a prompt without being in range of MaxActivationDistance.`)
end