/****************************************************************************** Simple analogue clock. = Description = Use example in map as reference. Use one separate "ClockDriver" for each clock and set unique values ClockDriver.HourHandTag -> Hour's Mover.Tag ClockDriver.MinuteHandTag -> Minute's Mover.Tag = Author = SeriousBarbie AT Barbies DOT World = Changelog = == Version 1 == Release 13 Sep 2025 + added "R = Hand.Rotation;" in event SetHand() == Version 0 == Release 07 May 2025 first release ******************************************************************************/ class ClockDriver expands Keypoint; var() name MinuteHandTag; var() name HourHandTag; var Mover MinuteHand; var Mover HourHand; function bool FindHandMover(name ATag, string VarName, out Mover M) { if (ATag == '') { warn("mover Tag for" @ VarName @ "must be given - terminating"); return false; } foreach AllActors(class'Mover', M, ATag) break; if (M == None) { warn("no mover with Tag='" $ ATag $ "' found - terminating"); return false; } return true; } event bool SetHand(Mover Hand, float Roll) { local rotator R; R = Hand.Rotation; R.Roll = Roll; if ( ! Hand.SetRotation(R)) { warn("coulden't set rotation=" $ R @ "for" @ Hand); return false; } return true; } event bool SetHands() { local bool result; local float f; result = true; f = 65536.0 / 60.0 * Level.Minute; if ( ! SetHand(MinuteHand, f)) result = false; if ( ! SetHand(HourHand, (f / 12.0 ) + (65536.0 / 12.0 * Level.Hour))) result = false; return result; } event PostBeginPlay() { if ( ! FindHandMover(MinuteHandTag, "MinuteHandTag", MinuteHand)) destroy(); if ( ! FindHandMover(HourHandTag, "HourHandTag", HourHand)) destroy(); Super.PostBeginPlay(); SetHands(); SetTimer(Level.TimeDilation * 60, true); } event Timer() { SetHands(); } defaultproperties { bStatic=False }