-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPatchController.cs
More file actions
81 lines (72 loc) · 2.51 KB
/
PatchController.cs
File metadata and controls
81 lines (72 loc) · 2.51 KB
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
using Kitchen;
using KitchenMods;
using Unity.Entities;
using UnityEngine;
namespace KitchenCustomDifficulty
{
public class PatchController : GameSystemBase, IModSystem
{
private static PatchController _instance;
protected override void Initialise()
{
base.Initialise();
_instance = this;
}
protected override void OnUpdate()
{
}
internal static void UpdateCustomerSpeed(Entity customerEntity)
{
if (_instance == null)
return;
CCustomer customer = _instance.EntityManager.GetComponentData<CCustomer>(customerEntity);
int multiplier = Main.PrefSysManager.Get<int>(Main.CUSTOMER_SPEED_ID);
if (multiplier == -1)
{
customer.Speed *= Main.DefaultValuesDict[Main.CUSTOMER_SPEED_ID] / 100f;
}
else
{
customer.Speed *= multiplier / 100f;
}
_instance.EntityManager.SetComponentData(customerEntity, customer);
}
internal static bool CustomOfferRestart(out bool shouldRunOriginal)
{
if (_instance == null || !_instance.TryGetSingleton(out SKitchenStatus kitchenStatus))
{
shouldRunOriginal = false;
return true;
}
switch (Main.PrefSysManager.Get<int>(Main.RESTART_ON_LOSS_ID))
{
case -1:
shouldRunOriginal = false;
return false;
case 1:
shouldRunOriginal = false;
_instance.World.Add(new COfferRestartDay
{
Reason = LossReason.Patience
});
_instance.Set(new SKitchenStatus
{
RemainingLives = kitchenStatus.TotalLives,
TotalLives = kitchenStatus.TotalLives
});
return true;
default:
shouldRunOriginal = true;
return false;
}
}
internal static bool TryGetBounds(out Bounds bounds)
{
bounds = default;
if (_instance == null || !_instance.TryGetSingletonEntity<SLayout>(out Entity singletonEntity) || !_instance.Require(singletonEntity, out CBounds cBounds))
return false;
bounds = cBounds.Bounds;
return true;
}
}
}