Skip to content

Instantly share code, notes, and snippets.

@dsonbill
Created March 3, 2020 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsonbill/3d74d6d860ad75c56425bf55f0dab460 to your computer and use it in GitHub Desktop.
Save dsonbill/3d74d6d860ad75c56425bf55f0dab460 to your computer and use it in GitHub Desktop.
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
}
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
PROP
{
name = SUP_Seat_Height
MODEL
{
model = ASET/ASET_Props/Control/Push_Button_Modular/models/pb_SplitHorizontal_Cap
texture = pb_Full_Cap_Black,ASET/ASET_Props/Control/Push_Button_Modular/models/pb_Full_Cap_Black
texture = Switch_TUMBLEDiffuse,ASET/ASET_Props/Control/Switch_Tumble/Switch_TUMBLEDiffuse
}
MODEL
{
model = ASET/ASET_Props/Control/Push_Button_Modular/models/pb_Bcklt_2
texture = Switch_TUMBLEDiffuse,ASET/ASET_Props/Control/Switch_Tumble/Switch_TUMBLEDiffuse
}
MODEL
{
model = ASET/ASET_Props/Control/Switch_Toggle_Modular/models/TgglCollider_DBL
}
MODULE
{
name = MASComponent
COLLIDER_EVENT
{
name = Collider
collider = SwitchColliderUP
sound = ASET/ASET_Props/Sounds/pb_Push02
volume = 1
autoRepeat = 0.1
onClick = SUP_SeatHeightButton(0.05)
}
COLLIDER_EVENT
{
name = Collider
collider = SwitchColliderDOWN
sound = ASET/ASET_Props/Sounds/pb_Push02
volume = 1
autoRepeat = 0.1
onClick = SUP_SeatHeightButton(-0.05)
}
TEXT_LABEL
{
name = Caption
transform = PanelTextTop_bklt
fontSize = 5.8
lineSpacing = 0.9
font = Liberation Sans
style = Bold
alignment = Center
anchor = LowerCenter
emissive = active
variable = fc.Conditioned(fc.GetPersistentAsNumber("Backlight"))
blend = true
activeColor = COLOR_ASET_SWITCHER_NAME_POSITIVECOLOR
passiveColor = COLOR_ASET_SWITCHER_NAME_ZEROCOLOR
text = SEAT$$$HEIGHT
}
TEXT_LABEL
{
name = Upper Legend
transform = Legend_Upper
fontSize = 3.9
lineSpacing = 0.9
font = Liberation Sans
style = Bold
alignment = Center
anchor = MiddleCenter
emissive = never
passiveColor = COLOR_MOARdV_UnlitBlackText
text = UP
}
TEXT_LABEL
{
name = Lower Legend
transform = Legend_Lower
fontSize = 3.9
lineSpacing = 0.9
font = Liberation Sans
style = Bold
alignment = Center
anchor = MiddleCenter
emissive = never
passiveColor = COLOR_MOARdV_UnlitBlackText
text = DOWN
}
COLOR_SHIFT
{
name = Border
transform = GlowBorder
variable = fc.Conditioned(fc.GetPersistentAsNumber("Backlight"))
passiveColor = 0,0,0,255
activeColor = COLOR_ASET_SWITCHER_BORDER_POSITIVECOLOR
blend = true
}
COLOR_SHIFT
{
name = Upper Panel
transform = pb_SH_TopLens_obj
passiveColor = 0,0,0,255
activeColor = COLOR_MOARdV_IndicatorPanelGreen
variable = fc.Conditioned(fc.GetPersistentAsNumber("SUP_Seat_Height") < 1)
}
COLOR_SHIFT
{
name = Lower Panel
transform = pb_SH_BottomLens_obj
passiveColor = 0,0,0,255
activeColor = COLOR_MOARdV_IndicatorPanelGreen
variable = fc.Conditioned(fc.GetPersistentAsNumber("SUP_Seat_Height") > 0)
}
TEXTURE_SHIFT
{
name = Upper Panel
transform = pb_SH_TopLens_obj
startUV = 0, 0
endUV = 0, -0.5
layers = _Emissive
variable = fc.Conditioned(fc.GetPersistentAsNumber("SUP_Seat_Height") < 1)
}
TEXTURE_SHIFT
{
name = Lower Panel
transform = pb_SH_BottomLens_obj
startUV = 0, 0
endUV = 0, -0.5
layers = _Emissive
variable = fc.Conditioned(fc.GetPersistentAsNumber("SUP_Seat_Height") > 0)
}
}
}
PROP
{
name = SUP_Seat_Position
// Black full cap
MODEL
{
model = ASET/ASET_Props/Control/Push_Button_Modular/models/pb_Full_Cap
texture = pb_Full_Cap_Black,ASET/ASET_Props/Control/Push_Button_Modular/models/pb_Full_Cap_Black
texture = Switch_TUMBLEDiffuse,ASET/ASET_Props/Control/Switch_Tumble/Switch_TUMBLEDiffuse
}
// Glow Border Type 5 - 3/4 wrap around, text on top
MODEL
{
model = ASET/ASET_Props/Control/Push_Button_Modular/models/pb_Bcklt_5
texture = Switch_TUMBLEDiffuse,ASET/ASET_Props/Control/Switch_Tumble/Switch_TUMBLEDiffuse
}
MODEL
{
model = ASET/ASET_Props/Control/Push_Button_Modular/models/pb_Collider
}
MODULE
{
name = MASComponent
COLLIDER_EVENT
{
name = Collider
collider = pb_Collider
sound = ASET/ASET_Props/Sounds/pb_Push02
volume = 1
onClick = SUP_SeatPositionButton()
}
ANIMATION_PLAYER
{
name = Button press animation
animation = pb_PushAnim
animationSpeed = 1.0
variable = fc.GetPersistentAsNumber("SUP_Seat_Position")
}
TEXT_LABEL
{
name = Caption
transform = PanelTextTop_bklt
fontSize = 5.8
lineSpacing = 0.9
font = Liberation Sans
style = Bold
alignment = Center
anchor = LowerCenter
emissive = active
variable = fc.Conditioned(fc.GetPersistentAsNumber("Backlight"))
blend = true
activeColor = COLOR_ASET_SWITCHER_NAME_POSITIVECOLOR
passiveColor = COLOR_ASET_SWITCHER_NAME_ZEROCOLOR
text = SEAT$$$POSITION
}
TEXT_LABEL
{
name = Upper Legend
transform = Legend_Upper
fontSize = 3.9
lineSpacing = 0.9
font = Liberation Sans
style = Bold
alignment = Center
anchor = MiddleCenter
emissive = active
variable = fc.Conditioned(1 - fc.GetPersistentAsNumber("SUP_Seat_Position"))
activeColor = COLOR_MOARdV_IndicatorLampAmber
passiveColor = COLOR_MOARdV_PassiveBacklightText
text = PILOT
}
TEXT_LABEL
{
name = Upper Legend Bullets
transform = Legend_Upper
fontSize = 3.9
lineSpacing = 0.9
font = Liberation Sans
style = Bold
alignment = Center
anchor = MiddleCenter
emissive = active
variable = fc.Conditioned(1 - fc.GetPersistentAsNumber("SUP_Seat_Position"))
activeColor = COLOR_MOARdV_IndicatorLampAmber
passiveColor = COLOR_MOARdV_PassiveBacklightText
text = ● ●
}
TEXT_LABEL
{
name = Lower Legend
transform = Legend_Lower
fontSize = 3.9
lineSpacing = 0.9
font = Liberation Sans
style = Bold
alignment = Center
anchor = MiddleCenter
emissive = active
variable = fc.Conditioned(fc.GetPersistentAsNumber("SUP_Seat_Position"))
activeColor = COLOR_MOARdV_IndicatorLampGreen
passiveColor = COLOR_MOARdV_PassiveBacklightText
text = REAR$$$CABIN
}
TEXT_LABEL
{
name = Lower Legend Bullets
transform = Legend_Lower
fontSize = 3.9
lineSpacing = 0.9
font = Liberation Sans
style = Bold
alignment = Center
anchor = MiddleCenter
emissive = active
variable = fc.Conditioned(fc.GetPersistentAsNumber("SUP_Seat_Position"))
activeColor = COLOR_MOARdV_IndicatorLampGreen
passiveColor = COLOR_MOARdV_PassiveBacklightText
text = ● ●
}
COLOR_SHIFT
{
name = Border
transform = GlowBorder
variable = fc.Conditioned(fc.GetPersistentAsNumber("Backlight"))
passiveColor = 0,0,0,255
activeColor = COLOR_ASET_SWITCHER_BORDER_POSITIVECOLOR
blend = true
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment