VerseIsland
FeedLearnLeaderboardGuidesReferenceExploreSearchDocsVerse Library
Sign in
Feed Learn 📖 Codex Leaderboard Guides Reference Explore Search Docs Verse Library
Browse Community Snippets›Verse Language·Up to Community Snippets · Verse Language·74 of 114 in Verse Language

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 Discord — free for members Read the original at Epic Games documentation

Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.

Guided course

Add this to your free study plan — we’ll suggest related material and stitch it into one compile-checked lesson.

Keep exploring
More in Verse Language · 74 of 114
Prev
santas toy factory upgrade config
Next
coltonkeeley projectost deprecated lottery wheel

Source

Epic Games documentation

View original
VerseIsland· an archipelago of Verse & UEFN knowledge
🗺️ Island atlasLearnGuidesHistoryAbout & PressSources & LicensingPrivacy PolicyTermsStatus

Not affiliated with Epic Games. Fortnite, UEFN, Unreal Engine, and Verse are trademarks of Epic Games, Inc. Content is attributed to its source — see Sources & Licensing.

🦜

Scout · your island guide

The Isle of Verse