Skip to content

Commit 9639e3b

Browse files
committed
Updated for Rocket 3.2.0.2
1 parent 75e8e9d commit 9639e3b

File tree

4 files changed

+24
-25
lines changed

4 files changed

+24
-25
lines changed

Zamirathe_HomeCommand/CommandHome.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,13 @@ public string Help
2929
return "Teleports you to your bed if you have one.";
3030
}
3131
}
32-
public void Execute(CSteamID playerid, string bed)
32+
public void Execute(RocketPlayer playerid, string bed)
3333
{
34-
Player player = PlayerTool.getPlayer(playerid);
35-
HomePlayer homeplayer = player.transform.GetComponent<HomePlayer>();
36-
object[] cont = HomeCommand.CheckConfig(player, playerid, homeplayer);
34+
HomePlayer homeplayer = playerid.Player.transform.GetComponent<HomePlayer>();
35+
object[] cont = HomeCommand.CheckConfig(playerid);
3736
if (!(bool)cont[0]) return;
3837
// A bed was found, so let's run a few checks.
39-
homeplayer.GoHome((Vector3)cont[1], (byte)cont[2], player);
38+
homeplayer.GoHome((Vector3)cont[1], (byte)cont[2], playerid);
4039
}
4140
}
4241
}

Zamirathe_HomeCommand/HomeCommand.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,30 @@ protected override void Load()
2626
}
2727
}
2828
// All we are doing here is checking the config to see if anything like restricted movement or time restriction is enforced.
29-
public static object[] CheckConfig(Player player, CSteamID playerid, HomePlayer homeplayer)
29+
public static object[] CheckConfig(RocketPlayer player)
3030
{
3131
object[] returnv = { false, null, null };
3232
// First check if command is enabled.
3333
if (!HomeCommand.Instance.Configuration.Enabled)
3434
{
3535
// Command disabled.
36-
RocketChatManager.Say(playerid, String.Format(HomeCommand.Instance.Configuration.DisabledMsg, player.SteamChannel.SteamPlayer.SteamPlayerID.CharacterName));
36+
RocketChatManager.Say(player, String.Format(HomeCommand.Instance.Configuration.DisabledMsg, player.CharacterName));
3737
return returnv;
3838
}
3939
// It is enabled, but are they in a vehicle?
40-
if (player.Stance.Stance == EPlayerStance.DRIVING || player.Stance.Stance == EPlayerStance.SITTING)
40+
if (player.Stance == EPlayerStance.DRIVING || player.Stance == EPlayerStance.SITTING)
4141
{
4242
// They are in a vehicle.
43-
RocketChatManager.Say(playerid, String.Format(HomeCommand.Instance.Configuration.NoVehicleMsg, player.SteamChannel.SteamPlayer.SteamPlayerID.CharacterName));
43+
RocketChatManager.Say(player, String.Format(HomeCommand.Instance.Configuration.NoVehicleMsg, player.CharacterName));
4444
return returnv;
4545
}
4646
// They aren't in a vehicle, so check if they have a bed.
4747
Vector3 bedPos;
4848
byte bedRot;
49-
if (!BarricadeManager.tryGetBed(playerid, out bedPos, out bedRot))
49+
if (!BarricadeManager.tryGetBed(player.CSteamID, out bedPos, out bedRot))
5050
{
5151
// Bed not found.
52-
RocketChatManager.Say(playerid, String.Format(HomeCommand.Instance.Configuration.NoBedMsg, player.SteamChannel.SteamPlayer.SteamPlayerID.CharacterName));
52+
RocketChatManager.Say(player, String.Format(HomeCommand.Instance.Configuration.NoBedMsg, player.CharacterName));
5353
return returnv;
5454
}
5555
object[] returnv2 = { true, bedPos, bedRot };

Zamirathe_HomeCommand/HomePlayer.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ public class HomePlayer : RocketPlayerComponent
2020
private bool cangohome;
2121
private Vector3 bedPos;
2222
private byte bedRot;
23-
private Player p;
23+
private RocketPlayer p;
2424

2525
private void Load()
2626
{
2727
this.GoingHome = false;
2828
this.cangohome = false;
2929
}
30-
public void GoHome(Vector3 bedPos, byte bedRot, Player player)
30+
public void GoHome(Vector3 bedPos, byte bedRot, RocketPlayer player)
3131
{
3232
this.waitrestricted = HomeCommand.Instance.Configuration.TeleportWait;
3333
this.movementrestricted = HomeCommand.Instance.Configuration.MovementRestriction;
@@ -45,14 +45,14 @@ public void GoHome(Vector3 bedPos, byte bedRot, Player player)
4545
}
4646
else
4747
{
48-
if (player.SteamChannel.SteamPlayer.IsAdmin && HomeCommand.Instance.WaitGroups.ContainsKey("admin"))
48+
if (player.IsAdmin && HomeCommand.Instance.WaitGroups.ContainsKey("admin"))
4949
{
5050
HomeCommand.Instance.WaitGroups.TryGetValue("admin", out this.waittime);
5151
}
5252
else
5353
{
5454
// Either not an admin or they don't get special wait restrictions.
55-
List<Group> hg = player.GetGroups();
55+
List<Group> hg = player.Groups;
5656
byte[] time2 = new byte[hg.Count];
5757
for (byte g=0;g<hg.Count;g++)
5858
{
@@ -71,11 +71,11 @@ public void GoHome(Vector3 bedPos, byte bedRot, Player player)
7171
if (this.movementrestricted)
7272
{
7373
this.LastCalledHomePos = this.transform.position;
74-
RocketChatManager.Say(player.SteamChannel.SteamPlayer.SteamPlayerID.CSteamID, String.Format(HomeCommand.Instance.Configuration.FoundBedWaitNoMoveMsg, player.name, this.waittime));
74+
RocketChatManager.Say(player, String.Format(HomeCommand.Instance.Configuration.FoundBedWaitNoMoveMsg, player.CharacterName, this.waittime));
7575
}
7676
else
7777
{
78-
RocketChatManager.Say(player.SteamChannel.SteamPlayer.SteamPlayerID.CSteamID, String.Format(HomeCommand.Instance.Configuration.FoundBedNowWaitMsg, player.name, this.waittime));
78+
RocketChatManager.Say(player, String.Format(HomeCommand.Instance.Configuration.FoundBedNowWaitMsg, player.CharacterName, this.waittime));
7979
}
8080
}
8181
else
@@ -88,28 +88,28 @@ public void GoHome(Vector3 bedPos, byte bedRot, Player player)
8888
private void DoGoHome()
8989
{
9090
if (!this.cangohome) return;
91-
RocketChatManager.Say(this.p.SteamChannel.SteamPlayer.SteamPlayerID.CSteamID, String.Format(HomeCommand.Instance.Configuration.TeleportMsg, this.p.SteamChannel.SteamPlayer.SteamPlayerID.CharacterName));
92-
this.p.sendTeleport(this.bedPos, this.bedRot);
91+
RocketChatManager.Say(this.p, String.Format(HomeCommand.Instance.Configuration.TeleportMsg, this.p.CharacterName));
92+
this.p.Teleport(this.bedPos, this.bedRot);
9393
this.cangohome = false;
9494
this.GoingHome = false;
9595
}
9696
public void FixedUpdate()
9797
{
9898
if (!this.GoingHome) return;
99-
if (this.p.PlayerLife.Dead)
99+
if (this.p.Dead)
100100
{
101101
// Abort teleport, they died.
102-
RocketChatManager.Say(this.p.SteamChannel.SteamPlayer.SteamPlayerID.CSteamID, String.Format(HomeCommand.Instance.Configuration.NoTeleportDiedMsg, this.p.SteamChannel.SteamPlayer.SteamPlayerID.CharacterName));
102+
RocketChatManager.Say(this.p, String.Format(HomeCommand.Instance.Configuration.NoTeleportDiedMsg, this.p.CharacterName));
103103
this.GoingHome = false;
104104
this.cangohome = false;
105105
return;
106106
}
107107
if (this.movementrestricted)
108108
{
109-
if (Vector3.Distance(this.p.transform.position, this.LastCalledHomePos) > 0.1)
109+
if (Vector3.Distance(this.p.Position, this.LastCalledHomePos) > 0.1)
110110
{
111111
// Abort teleport, they moved.
112-
RocketChatManager.Say(this.p.SteamChannel.SteamPlayer.SteamPlayerID.CSteamID, String.Format(HomeCommand.Instance.Configuration.UnableMoveSinceMoveMsg, this.p.SteamChannel.SteamPlayer.SteamPlayerID.CharacterName));
112+
RocketChatManager.Say(this.p, String.Format(HomeCommand.Instance.Configuration.UnableMoveSinceMoveMsg, this.p.CharacterName));
113113
this.GoingHome = false;
114114
this.cangohome = false;
115115
return;

Zamirathe_HomeCommand/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("2.1.0.0")]
36-
[assembly: AssemblyFileVersion("2.1.0.0")]
35+
[assembly: AssemblyVersion("2.1.0.1")]
36+
[assembly: AssemblyFileVersion("2.1.0.1")]

0 commit comments

Comments
 (0)