Created
March 3, 2020 13:11
-
-
Save dsonbill/3d74d6d860ad75c56425bf55f0dab460 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROP | |
{ | |
name = SmartSeat | |
MODEL | |
{ | |
model = ASET/ASET_Props/Misc/SeatV2/SeatV2 | |
texture = SeatV2_Diffuse,ASET/ASET_Props/Misc/SeatV2/SeatV2_Diffuse | |
} | |
MODULE | |
{ | |
name = MASComponent | |
TRANSLATION | |
{ | |
name = Seat Height | |
transform = SeatTransform | |
startTranslation = 0,0,0 | |
endTranslation = 0,0.185,0 | |
variable = fc.Conditioned(fc.GetPersistentAsNumber("SUP_Seat_Height_Value")) | |
blend = true | |
speed = 0.55 | |
} | |
TRANSLATION | |
{ | |
name = Seat Position | |
transform = SeatTransform | |
startTranslation = 0,0,0 | |
endTranslation = 0.055,0.0325,-0.4 | |
variable = fc.Conditioned(fc.GetPersistentAsNumber("SUP_Seat_Position_Value")) | |
blend = true | |
speed = 0.45 | |
} | |
ROTATION | |
{ | |
name = Seat Rotation | |
transform = SeatTransform | |
startRotation = 0,0,0 | |
endRotation = 0,90,0 | |
variable = fc.Conditioned(fc.GetPersistentAsNumber("SUP_Seat_Position_Value")) | |
range = 0.0, 1.0 | |
blend = true | |
speed = 0.7 | |
} | |
TRIGGER_EVENT | |
{ | |
name = Change Seat Position | |
event = SUP_ChangeSeatPosition() | |
variable = SUP_SeatPositionTrigger(fc.Conditioned(fc.GetPersistentAsNumber("SUP_Seat_Position"))) | |
} | |
TRIGGER_EVENT | |
{ | |
name = Change Seat Height | |
event = SUP_ChangeSeatHeight() | |
variable = SUP_SeatHeightTrigger(fc.Conditioned(fc.GetPersistentAsNumber("SUP_Seat_Height"))) | |
} | |
AUDIO_PLAYER | |
{ | |
name = Motor | |
sound = ASET/ASET_Props/Sounds/motor | |
trigger = ON | |
variable = SUP_SeatHeightTrigger(fc.Conditioned(fc.GetPersistentAsNumber("SUP_Seat_Height"))) | |
} | |
AUDIO_PLAYER | |
{ | |
name = Motor | |
sound = ASET/ASET_Props/Sounds/motor | |
trigger = BOTH | |
mustPlayOnce = true | |
variable = fc.Conditioned(fc.GetPersistentAsNumber("SUP_Seat_Position")) | |
} | |
} | |
} | |
MAS_LUA | |
{ | |
name = SmartSeat_Scripts | |
script = SupplementalProps/Seat/Seat.lua | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function SUP_ChangeSeatPosition() | |
fc.SetPersistent("SUP_Seat_Height", 0) | |
fc.SetPersistent("SUP_Seat_Height_Value", 0) | |
fc.SetPersistent("SUP_Seat_Position_Value", fc.GetPersistentAsNumber("SUP_Seat_Position")) | |
end | |
function SUP_ChangeSeatHeight() | |
local y = fc.GetPersistentAsNumber("SUP_Seat_Height") | |
if fc.GetPersistentAsNumber("SUP_Seat_Position") < 1 then | |
fc.SetPersistent("SUP_Seat_Height_Value", y) | |
end | |
end | |
local SUP_prevSeatPosition = 0 | |
function SUP_SeatPositionTrigger(seatPosition) | |
if SUP_prevSeatPosition != seatPosition then | |
SUP_prevSeatPosition = seatPosition | |
return 1 | |
end | |
return 0 | |
end | |
local SUP_prevSeatHeight = 0 | |
function SUP_SeatHeightTrigger(seatHeight) | |
if SUP_prevSeatHeight != seatHeight then | |
SUP_prevSeatHeight = seatHeight | |
return 1 | |
end | |
return 0 | |
end | |
function SUP_SeatHeightButton(step) | |
if fc.GetPersistentAsNumber("SUP_Seat_Position") < 1 then | |
fc.AddPersistentClamped("SUP_Seat_Height", fc.SetPersistent("%AUTOID%", step), 0, 1) | |
end | |
end | |
function SUP_SeatPositionButton() | |
if fc.GetPersistentAsNumber("SUP_Seat_Height") == 0 then | |
fc.TogglePersistent("SUP_Seat_Position") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment