Santa's Toy Factory Utility Module
Santa's Toy Factory — Utility Module
A grab-bag of reusable helpers: an event wrapper that smuggles extra data to listeners (SubscribeAgent), generic map/array extension methods (RemoveKey, RemoveAll), <localizes> message builders, number padding, a float ToString(Decimals), a hand-rolled ParseInt, and a keyframe-driven prop Shake. Teaches parametric types, extension functions, and localization.
From the Santa's Toy Factory Epic starter project (SampleVerse/SantaToyFactory/utility_module.verse). Epic Games reference Verse, shown for study.
-
# This file defines the utility module that contains a number of extension functions, constants and functions for performing various tasks. using { /Fortnite.com/Devices } using { /Fortnite.com/Devices/CreativeAnimation } using { /UnrealEngine.com/Temporary/SpatialMath } using { /UnrealEngine.com/Temporary/UI } using { /Verse.org/Random } using { /Verse.org/Simulation } Utility<public> := module: # The factor to convert from LEGO® units (knobs) to Fortnite units (centimeters) LEGOUnitsToFortniteUnits<public> : float = 0.8 * 20.0 # Extension functions for passing arguments with events. # Code taken from: https://dev.epicgames.com/community/snippets/d8k/fortnite-wrapping-subscribe-to-pass-additional-data-to-listeners. (Listenable : listenable(agent)).SubscribeAgent<public>(OutputFunc : tuple(agent, t)->void, ExtraData : t where t:type) : cancelable = Wrapper := wrapper_agent(t){ExtraData := ExtraData, OutputFunc := OutputFunc} Listenable.Subscribe(Wrapper.InputFunc)
You're reading a preview
The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.
Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.