Skip to content

Instantly share code, notes, and snippets.

@spilth
Created March 31, 2023 13:30
Show Gist options
  • Save spilth/02ff8ded34ae562c4d11c7a93cfa76a9 to your computer and use it in GitHub Desktop.
Save spilth/02ff8ded34ae562c4d11c7a93cfa76a9 to your computer and use it in GitHub Desktop.
Muckle Manager Device
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Verse.org/Random }
using { /UnrealEngine.com/Temporary/Diagnostics }
SpawnedMessage<localizes>(ItemName:string, Location:string):message = "The {ItemName} has spawned {Location}!"
DroppedMessage<localizes>(ItemName:string): message = "The {ItemName} has been dropped!"
PickedUpMessage<localizes>(Title:string): message = "Somebody has become {Title}"
TrackerMessage<localizes>(ItemName:string, Location:string):message = "Grab the {ItemName} located {Location}!"
spawn_location := class<concrete>:
@editable
Name:string = "Location Name"
@editable
Spawner:capture_item_spawner_device = capture_item_spawner_device{}
@editable
Beacon:beacon_device = beacon_device{}
@editable
Indicator:map_indicator_device = map_indicator_device{}
Enable():void=
Spawner.Enable()
Beacon.Enable()
Indicator.Enable()
Disable():void=
Spawner.Disable()
Beacon.Disable()
Indicator.Disable()
muckle_manager_device := class(creative_device):
@editable
ChosenTitle:string = "The Chosen One"
@editable
FirstSpawnTimer:timer_device = timer_device{}
@editable
SaintSelector:class_and_team_selector_device = class_and_team_selector_device{}
@editable
SinnerTracker:tracker_device = tracker_device{}
@editable
SinnerSelector:class_and_team_selector_device = class_and_team_selector_device{}
@editable
ItemName:string = "Golden Shotgun"
# Temporary solution since ItemReturnedEvent doesn't seem to Signal yet
@editable
ItemReturnedTrigger:trigger_device = trigger_device{}
@editable
Announcer:hud_message_device = hud_message_device{}
@editable
SpawnLocations:[]spawn_location = array{}
OnBegin<override>()<suspends>:void=
FirstSpawnTimer.SuccessEvent.Subscribe(OnTimerSuccess)
ItemReturnedTrigger.TriggeredEvent.Subscribe(OnItemReturned)
for(Index := 0..SpawnLocations.Length - 1):
if(SpawnLocation := SpawnLocations[Index]):
SpawnLocation.Spawner.ItemPickedUpEvent.Subscribe(OnItemPickedUp)
SpawnLocation.Spawner.ItemDroppedEvent.Subscribe(OnItemDropped)
DisableAllSpawnLocations()
OnTimerSuccess(Player : ?agent):void =
EnableRandomSpawner()
OnItemPickedUp(Player : agent):void=
DisableAllSpawnLocations()
SaintSelector.ChangeClass(Player)
Announcer.SetText(PickedUpMessage(ChosenTitle))
Announcer.Show()
OnItemReturned(Player : ?agent):void=
EnableRandomSpawner()
OnItemDropped(Player : agent):void=
SinnerSelector.ChangeClass(Player)
Announcer.SetText(DroppedMessage(ItemName))
Announcer.Show()
EnableRandomSpawner():void=
RandomIndex := GetRandomInt(0, SpawnLocations.Length - 1)
for(Index := 0..SpawnLocations.Length - 1):
if(SpawnLocation := SpawnLocations[Index]):
if (Index = RandomIndex):
SpawnLocation.Enable()
Announcer.SetText(SpawnedMessage(ItemName, SpawnLocation.Name))
Announcer.Show()
SinnerTracker.SetDescriptionText(TrackerMessage(ItemName, SpawnLocation.Name))
else:
SpawnLocation.Disable()
DisableAllSpawnLocations():void=
for(Index := 0..SpawnLocations.Length - 1):
if(SpawnLocation := SpawnLocations[Index]):
SpawnLocation.Disable()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment