-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPVirtStorage.cs
More file actions
40 lines (38 loc) · 1.18 KB
/
PVirtStorage.cs
File metadata and controls
40 lines (38 loc) · 1.18 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
using Rocket.Core.Logging;
using Rocket.Unturned.Events;
using Rocket.Unturned.Player;
using SDG.Unturned;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace VirtualStorage
{
public class PVirtStorage : UnturnedPlayerComponent
{
internal ContainerManager cData;
private bool isPrimarySeat = false;
protected override void Load()
{
cData = null;
}
public void FixedUpdate()
{
if (cData != null)
{
if (cData.WasOpen)
{
// Force close virtual container if switching from passengers to drivers seats.
if (!Player.Inventory.isStoring || (Player.IsInVehicle && !isPrimarySeat && Player.CurrentVehicle.checkDriver(Player.CSteamID)))
{
cData.Close();
VirtualStorage.Database.SaveContainerToDB(cData);
cData = null;
}
}
}
if (Player.IsInVehicle)
isPrimarySeat = Player.CurrentVehicle.checkDriver(Player.CSteamID);
}
}
}