Skip to content

Commit ea7bf48

Browse files
committed
Add Sandbox mode for people entering a lobby solo
1 parent 87011cc commit ea7bf48

File tree

5 files changed

+91
-180
lines changed

5 files changed

+91
-180
lines changed

ProjectSettings/Input.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@
113113
"KeyboardCode": "h",
114114
"GamepadCode": "None",
115115
"GroupName": "Other"
116+
},
117+
{
118+
"Name": "exit_sandbox",
119+
"KeyboardCode": "b",
120+
"GamepadCode": "Guide",
121+
"GroupName": "Other"
116122
}
117123
],
118124
"__guid": "462cd8dc-4078-4db6-9df8-21ff504a1afb",

code/Systems/GameMode/FreeForAll.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,11 @@ private void RotateActivePlayer()
377377
_rotateCount++;
378378
}
379379

380-
private void ResetGameMode()
380+
public void ResetGameMode()
381381
{
382382
Log.Info( "Resetting FFA mode to defaults." );
383+
384+
State = FreeForAllState.GameOver;
383385

384386
PlayerQueue.Clear();
385387
ActivePlayer = null;
@@ -403,6 +405,10 @@ private void ResetGameMode()
403405
} );
404406

405407
_rotateCount = 0;
408+
409+
GrubsConfig.InfiniteAmmo = false;
410+
GrubsConfig.KeepGameAlive = false;
411+
IsSandboxMode = false;
406412

407413
GrubsTerrain.Instance.Init();
408414
}

code/UI/GameHud/FreeForAllHud.razor

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@
1919
<InputHintsPanel />
2020
<InventoryDisplay />
2121
<PlayerList />
22+
@if (GameMode.IsSandboxMode)
23+
{
24+
<div class="sandbox-mode-hint">
25+
<label>Sandbox Mode</label>
26+
<CustomInputHint InputHintText="Return to Menu">
27+
<ChildContent>
28+
<CustomInputGlyph InputAction="exit_sandbox"/>
29+
</ChildContent>
30+
</CustomInputHint>
31+
</div>
32+
}
2233
</root>
2334

2435
@code
@@ -30,6 +41,22 @@
3041

3142
private string TurnTimer => GameMode?.TimeUntilTurnOver.Relative.CeilToInt().Clamp(0, int.MaxValue).ToString("0");
3243

44+
public override void Tick()
45+
{
46+
base.Tick();
47+
48+
if (!Networking.IsHost)
49+
return;
50+
51+
if (Input.Pressed("exit_sandbox"))
52+
{
53+
if (BaseGameMode.Current.IsValid() && BaseGameMode.Current is FreeForAll ffa)
54+
{
55+
ffa.ResetGameMode();
56+
}
57+
}
58+
}
59+
3360
protected override int BuildHash()
3461
{
3562
if ( !GameMode.IsValid() || !GameMode.ActivePlayer.IsValid() )
Lines changed: 51 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,58 @@
11
@import '../common.scss';
22

33
FreeForAllHud {
4-
position: relative;
4+
position: relative;
5+
width: 100%;
6+
height: 100%;
7+
8+
.header {
9+
position: absolute;
510
width: 100%;
6-
height: 100%;
7-
8-
.header {
9-
position: absolute;
10-
width: 100%;
11-
justify-content: flex-start;
12-
align-items: center;
13-
flex-direction: column;
14-
15-
.turn-indicator {
16-
font-size: 42px;
17-
padding: 20px 56px 12px;
18-
z-index: 4;
19-
transform: rotate(1deg) translateY(-8px);
11+
justify-content: flex-start;
12+
align-items: center;
13+
flex-direction: column;
14+
15+
.turn-indicator {
16+
font-size: 42px;
17+
padding: 20px 56px 12px;
18+
z-index: 4;
19+
transform: rotate(1deg) translateY(-8px);
2020

21-
label {
22-
transform: rotate(-0.1deg) translateY(-8px);
23-
text-overflow: ellipsis;
24-
}
25-
}
26-
27-
.turn-timer {
28-
font-size: 56px;
29-
width: 90px;
30-
padding: 4px 16px;
31-
align-items: center;
32-
justify-content: center;
33-
z-index: 2;
34-
transform: rotate(-1deg) translateY(-10px);
35-
36-
> label {
37-
transform: rotate(1deg) translateY(-10px);
38-
}
39-
}
21+
label {
22+
transform: rotate(-0.1deg) translateY(-8px);
23+
text-overflow: ellipsis;
24+
}
25+
}
26+
27+
.turn-timer {
28+
font-size: 56px;
29+
width: 90px;
30+
padding: 4px 16px;
31+
align-items: center;
32+
justify-content: center;
33+
z-index: 2;
34+
transform: rotate(-1deg) translateY(-10px);
35+
36+
> label {
37+
transform: rotate(1deg) translateY(-10px);
38+
}
39+
}
40+
}
41+
42+
.sandbox-mode-hint {
43+
position: absolute;
44+
top: 32px;
45+
right: 32px;
46+
flex-direction: column;
47+
background-color: $camo-dark;
48+
color: $camo-light;
49+
padding: 12px 24px;
50+
gap: 8px;
51+
align-items: center;
52+
53+
> label {
54+
font-size: 42px;
55+
font-weight: bold;
4056
}
57+
}
4158
}

code/UI/GameLanding/GameLanding.razor.scss

Lines changed: 0 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -191,148 +191,3 @@ GameLanding {
191191
opacity: 0;
192192
}
193193
}
194-
// .bottom-buttons {
195-
// position: absolute;
196-
// bottom: 100px;
197-
// right: 100px;
198-
// gap: 16px;
199-
// }
200-
//
201-
// .body {
202-
// width: 100%;
203-
// height: 100%;
204-
// opacity: 1;
205-
// transition: all 0.15s;
206-
// border-radius: 16px;
207-
// padding-top: 24px;
208-
// flex-direction: column;
209-
//
210-
// &.hide {
211-
// opacity: 0;
212-
// }
213-
//
214-
// button {
215-
// justify-content: center;
216-
// align-items: center;
217-
// transform: skewX(-4deg);
218-
// color: white;
219-
// border-radius: 4px;
220-
// background-color: rgb(66, 118, 62);
221-
// box-shadow: 2px 2px 8px black;
222-
// padding: 8px 16px;
223-
//
224-
// &.disabled {
225-
// background-color: rgb(43, 74, 41);
226-
// color: #808080;
227-
//
228-
// >i {
229-
// color: #808080;
230-
// }
231-
// }
232-
//
233-
// >label {
234-
// transform: skewX(1deg);
235-
// }
236-
//
237-
// >i {
238-
// font-size: 36px;
239-
// transform: skewX(1deg);
240-
// }
241-
//
242-
// &:not(.disabled):hover {
243-
// sound-in: ui_button_hover;
244-
// right: 102px;
245-
// }
246-
//
247-
// &.settings {
248-
// position: absolute;
249-
// bottom: 225px;
250-
// right: 100px;
251-
// width: 200px;
252-
// height: 50px;
253-
// text-shadow: 2px 2px black;
254-
// font-size: 28px;
255-
// gap: 4px;
256-
// }
257-
//
258-
// &.start {
259-
// height: 100px;
260-
// text-shadow: 4px 4px black;
261-
// font-size: 64px;
262-
//
263-
// &.alt {
264-
// background-color: transparent;
265-
// border: 2px solid rgb(66, 118, 62);
266-
// }
267-
//
268-
// &.disabled {
269-
// width: 450px;
270-
// font-size: 56px;
271-
// }
272-
// }
273-
// }
274-
// }
275-
//
276-
// .upper {
277-
// flex-direction: row;
278-
// align-items: center;
279-
// width: 100%;
280-
// height: 72px;
281-
//
282-
// .header {
283-
// position: relative;
284-
// left: -50px;
285-
// width: 220px;
286-
// height: 72px;
287-
// background-color: rgb(66, 118, 62);
288-
// align-items: center;
289-
// justify-content: flex-end;
290-
// transform: skewX(-4deg);
291-
// z-index: 4;
292-
//
293-
// >label {
294-
// font-size: 48px;
295-
// color: white;
296-
// margin-right: 32px;
297-
// transform: skewX(1deg);
298-
// text-shadow: 2px 2px black;
299-
// }
300-
// }
301-
//
302-
// .gamemode-name {
303-
// position: relative;
304-
// background-color: rgb(233, 239, 232);
305-
// left: -55px;
306-
// height: 42px;
307-
// width: 150px;
308-
// transform: skewX(-4deg);
309-
// align-items: center;
310-
// justify-content: center;
311-
// z-index: 2;
312-
//
313-
// >label {
314-
// font-size: 24px;
315-
// font-weight: light;
316-
// }
317-
// }
318-
// }
319-
//
320-
// .middle {
321-
// margin: 48px 0;
322-
//
323-
// }
324-
//
325-
// .terrain-preview {
326-
// position: absolute;
327-
// top: 40%;
328-
// right: 100px;
329-
// width: 533px;
330-
// height: 300px;
331-
// border: 4px rgb(233, 239, 232);
332-
// border-radius: 4px;
333-
// }
334-
//
335-
// &.hide {
336-
// opacity: 0;
337-
// }
338-
//}

0 commit comments

Comments
 (0)