-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRealistics.verse
179 lines (162 loc) · 6.87 KB
/
Realistics.verse
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
using { /Fortnite.com/Devices }
using { /Verse.org/Random }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
RealisticsTag := class(subtag) {}
ControllerTagA := class<final>(RealisticsTag) {}
ControllerTagB := class<final>(RealisticsTag) {}
ControllerTagC := class<final>(RealisticsTag) {}
realistics := class<concrete>(storm_game_mode):
@editable
Loadout:loadout = loadout{}
@editable
ThirtyPercentItemSpawner:item_spawner_device = item_spawner_device{}
@editable
SeventyFiftyPercentItemSpawners:[]item_spawner_device = array{}
@editable
NinetyPercentItemSpawners:[]item_spawner_device = array{}
@editable
ChairPropManipulators:[]prop_manipulator_device = array{}
@editable
Chairs:[]chair_device = array{}
Tag<override>:RealisticsTag = RealisticsTag{} # Do not remove the RealisticsTag(Important)
Initialize<override>():void =
Print("Realistics")
(super:)Initialize()
spawn {Loadout.GrantLoadout()}
spawn {SpawnLoot()}
for:
Index := 0..Chairs.Length - 1
PropSeat := prop_seat:
PropManipulator := ChairPropManipulators[Index]
Chair := Chairs[Index]
do {PropSeat.Initialize()}
SetItems<override>():void =
Print("Controller Index: {ControllerIndex}")
set Items = Shuffle(
case(ControllerIndex):
0 => GetCreativeObjectsWithTag(ControllerTagA{})
1 => GetCreativeObjectsWithTag(ControllerTagB{})
_ => GetCreativeObjectsWithTag(ControllerTagC{})
)
# Spawns floor loot
SpawnLoot()<suspends>:void =
# 30% chance of spawning
if(GetRandomInt(0, 100) <= 30):
ThirtyPercentItemSpawner.Enable()
# 75% chance of spawning
for:
ItemSpawner:SeventyFiftyPercentItemSpawners
GetRandomInt(0, 100) <= 75
do {ItemSpawner.Enable()}
# 90% chance of spawning
for:
ItemSpawner:NinetyPercentItemSpawners
GetRandomInt(0, 100) <= 90
do {ItemSpawner.Enable()}
Teleport<override>()<suspends>:void =
(super:)Teleport()
InitializeStorm()
# Sets Beacons, then generates storm
InitializeStorm():void =
defer:
GenerateStorm()
for(Index := 1..StormBeacons.Length - 1):
var Position:vector3 = vector3{}
defer:
if:
Rotation := IdentityRotation()
StormBeacons[Index].TeleportTo[Position, Rotation]
if:
# Phase 2
Index = 1
RandomPosition := vector3:
X := RandomInterval(StormProps[Index].GetTransform().Translation.X, 5000.0)
Y := RandomInterval(StormProps[Index].GetTransform().Translation.Y, 2500.0)
Z := StormProps[Index].GetTransform().Translation.Z
then {set Position = RandomPosition}
else if:
# Phase 3
Index = 2
RandomPosition := vector3:
X := RandomInterval(StormProps[Index].GetTransform().Translation.X, 5000.0)
Y := RandomInterval(StormProps[Index].GetTransform().Translation.Y, 3500.0)
Z := StormProps[Index].GetTransform().Translation.Z
then {set Position = RandomPosition}
else if:
# Phase 4
Index = 3
RandomPosition := vector3:
X := RandomInterval(StormProps[Index].GetTransform().Translation.X, 7000.0)
Y := RandomInterval(StormProps[Index].GetTransform().Translation.Y, 4000.0)
Z := StormProps[Index].GetTransform().Translation.Z
then {set Position = RandomPosition}
# This class subscribes PropManipulator to Chair Devices
prop_seat := class:
PropManipulator:prop_manipulator_device = prop_manipulator_device{}
Chair:chair_device = chair_device{}
# Subscribes PropManipulator
Initialize():void =
PropManipulator.DestroyedEvent.Subscribe(OnPropDestroyed)
# Called when Prop is destroyed
# Disables Chair Device
OnPropDestroyed(Agent:agent):void =
Chair.Disable()
loadout := class<concrete>:
@editable
ShotgunGranter:item_granter_device = item_granter_device{}
@editable
ARGranter:item_granter_device = item_granter_device{}
@editable
SMGGranter:item_granter_device = item_granter_device{}
@editable
ExtraGranter:item_granter_device = item_granter_device{}
@editable
HealGranter:item_granter_device = item_granter_device{}
@editable
TrapGranter:item_granter_device = item_granter_device{}
@editable
AmmoGranter:item_granter_device = item_granter_device{}
# Grants all players random loadouts
GrantLoadout()<suspends>:void =
Itemgranters := array:
ShotgunGranter, ARGranter, SMGGranter, ExtraGranter, HealGranter, TrapGranter
for(Player:GetPlayers()):
defer:
# 25% chance of getting a Trap
if(GetRandomInt(1, 100) <= 25):
TrapGranter.GrantItem(Player)
AmmoGranter.GrantItem(Player)
ShotgunGranter.GrantItem(Player)
HealGranter.GrantItem(Player)
# Changes current item to a random item
for(ItemGranter:Itemgranters):
ItemGranter.CycleToRandomItem(Player)
Index := GetRandomInt(1, 100)
# 3-item loadout (20% chance)
if(Index <= 20):
# 50% chance of getting an AR or SMG
if(GetRandomInt(1, 100) <= 50):
ARGranter.GrantItem(Player)
else {SMGGranter.GrantItem(Player)}
# 5-item loadout (50% chance)
else if(Index > 50):
ARGranter.GrantItem(Player)
SMGGranter.GrantItem(Player)
ExtraGranter.GrantItem(Player)
# 4 item loadout (30% chance)
else:
Index1 := GetRandomInt(1, 100)
# 30% chance of getting an AR, no SMG
if(Index1 <= 30):
ARGranter.GrantItem(Player)
ExtraGranter.GrantItem(Player)
# 40% chance of getting both AR and SMG
else if(Index1 >= 60):
ARGranter.GrantItem(Player)
SMGGranter.GrantItem(Player)
# 30% chance of getting an SMG, no AR
else:
SMGGranter.GrantItem(Player)
ExtraGranter.GrantItem(Player)