Skip to content

Instantly share code, notes, and snippets.

@dsonbill
Last active March 5, 2020 01:51
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/4f59dea3cf15bbf38b066778d4333ac8 to your computer and use it in GitHub Desktop.
Save dsonbill/4f59dea3cf15bbf38b066778d4333ac8 to your computer and use it in GitHub Desktop.
PROP
{
name = SUP_ASET_ClockTimer
MODEL
{
model = ASET/ASET_Props/Instruments/ASET_ClockTimer/ASET_ClockTimer
texture = ClockTimerDiffuse,ASET/ASET_Props/Instruments/ASET_ClockTimer/ClockTimerDiffuse
}
MODULE
{
name = MASComponent
//Actions
COLLIDER_EVENT
{
name = Timer Button
collider = StartColl
onClick = SUP_SetTimerState()
sound = ASET/ASET_Props/Sounds/AnalogTimerButton
volume = 0.5
}
ANIMATION_PLAYER
{
name = Timer Button Push
animation = TestTimerButton
animationSpeed = 1.0
variable = SUP_TimerButtonPushed()
}
//Clock Hands
ROTATION
{
name = Hour Hand
transform = Hours_arrowObj
startRotation = 0,0,0
endRotation = 0,360,0
variable = fc.Conditioned(fc.HourOfDay(fc.UT()))
range = 0.0, 6.0
blend = true
longPath = true
}
ROTATION
{
name = Minute Hand
transform = Minutes_arrowObj
startRotation = 0,0,0
endRotation = 0,360,0
variable = fc.Conditioned(fc.MinutesOfHour(fc.UT()))
range = 0.0, 60.0
blend = true
longPath = true
}
ROTATION
{
name = Second Hand
transform = Seconds_arrowObj
startRotation = 0,0,0
endRotation = 0,360,0
variable = fc.Conditioned(fc.SecondsOfMinute(fc.UT()))
range = 0.0, 60.0
blend = true
longPath = true
}
//Timer Hands
//ROTATION
//{
// name = Timer Minute Hand
// transform = TimerArrowMinObj
// startRotation = 0,0,0
// endRotation = 0,720,0
// variable = fc.Conditioned(fc.GetPersistentAsNumber("SUP_Seat_Position_Value"))
// range = 0.0, 1.0
// blend = true
// speed = 0.7
//}
//ROTATION
//{
// name = Timer Second Hand
// transform = TimerArrowSecObj
// startRotation = 0,0,0
// endRotation = 0,720,0
// variable = fc.Conditioned(fc.GetPersistentAsNumber("SUP_Seat_Position_Value"))
// range = 0.0, 1.0
// blend = true
// speed = 0.7
//}
//Timer On Flag
TRANSLATION
{
name = Timer State
transform = TimerON_flagObj
startTranslation = 0,0,0
endTranslation = 0,0,0.005
variable = fc.Conditioned(fc.GetPersistentAsNumber("SUP_Timer_State") == 1)
}
//Hours in a Day
TRANSLATION
{
name = Clock Kerbin Time
transform = EarthScaleObj
startTranslation = 0,0,0
endTranslation = 0,-0.003,0
variable = (fc.HoursPerDay() / 6) == 1
}
TRANSLATION
{
name = Clock Earth Time
transform = EarthScaleObj
startTranslation = 0,0,0
endTranslation = 0,-0.003,0
variable = (fc.HoursPerDay() / 12) == 1
}
}
}
MAS_LUA
{
name = SUP_ASET_ClockTimer_Scripts
script = SupplementalProps/Instruments/SUP_ASET_ClockTimer.lua
}
function SUP_SetTimerState()
state = fc.GetPersistentAsNumber("SUP_Timer_State")
if state == 0 then
fc.SetPersistent("SUP_Timer_State", 1)
elseif state == 1 then
fc.SetPersistent("SUP_Timer_State", 2)
else
fc.SetPersistent("SUP_Timer_State", 0)
end
SUP_TimerButtonPushed = true
end
local SUP_TimerButtonPushed = false
function SUP_TimerButtonPushed()
if SUP_TimerButtonPushed then
SUP_TimerButtonPushed = false
return 1
end
return 0
end
function SUP_GetTimerSeconds()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment