-
Notifications
You must be signed in to change notification settings - Fork 2
feat: zombie request #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1ffc6d5
3b42c71
a62700f
60cae97
e77a49b
dfebdf4
ef4731f
df979d3
d376469
b04815c
4a74c7a
ceaddfa
529fb4a
93639a9
76c5dbe
1356e03
169f1e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| obj/ | ||
| bin/ | ||
| packages/*/ | ||
| packages/*/ | ||
| *.user |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,13 @@ | ||
| using Exiled.API.Features; | ||
| using JetBrains.Annotations; | ||
| using PlayerRoles; | ||
|
|
||
| namespace SillySCP.API.Features | ||
| { | ||
| public class Volunteers | ||
| { | ||
| public RoleTypeId Replacement; | ||
| [CanBeNull] public Player OriginalPlayer; | ||
| public List<Player> Players; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -13,7 +13,7 @@ public class Human : ICommand | |||||
| { | ||||||
| public string Command { get; } = "human"; | ||||||
|
|
||||||
| public string[] Aliases { get; } = new [] { "h" }; | ||||||
| public string[] Aliases { get; } = { "h" }; | ||||||
|
|
||||||
| public string Description { get; } = "Change into a human, if you're an SCP."; | ||||||
|
|
||||||
|
|
@@ -23,25 +23,30 @@ public bool Execute( | |||||
| out string response | ||||||
| ) | ||||||
| { | ||||||
| if (!Player.TryGet(sender, out Player player)) | ||||||
| { | ||||||
| response = "Only Players can use this command."; | ||||||
| return false; | ||||||
| } | ||||||
|
|
||||||
| if (player.Role == RoleTypeId.Scp0492) | ||||||
| { | ||||||
| response = "You cannot change into a human as SCP-049-2!, try .r or .requestVolunteer to request a spectator to take your place"; | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Sorry, looks ugly asf |
||||||
| return false; | ||||||
| } | ||||||
blankochan marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
|
||||||
| if (!VolunteerSystem.ReadyVolunteers) | ||||||
| { | ||||||
| response = "You can not change into a human after the volunteer period is over!"; | ||||||
| return false; | ||||||
| } | ||||||
|
|
||||||
| Player.TryGet(sender, out Player player); | ||||||
|
|
||||||
| if (!player.IsScp) | ||||||
| { | ||||||
| response = "Only SCPs can use this command!"; | ||||||
| return false; | ||||||
| } | ||||||
|
|
||||||
| if (player.Role.Type == RoleTypeId.Scp0492) | ||||||
| { | ||||||
| response = "You can not change into a human as SCP-049-2!"; | ||||||
| return false; | ||||||
| } | ||||||
|
|
||||||
| RoleTypeId role = HumanSpawner.NextHumanRoleToSpawn; | ||||||
| VolunteerSystem.NewVolunteer(player.Role); | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,47 @@ | ||||||
| using CommandSystem; | ||||||
| using Exiled.API.Features; | ||||||
| using PlayerRoles; | ||||||
| using SillySCP.API.Features; | ||||||
|
|
||||||
|
|
||||||
| namespace SillySCP.Commands | ||||||
| { | ||||||
| [CommandHandler(typeof(ClientCommandHandler))] | ||||||
| public class RequestHuman : ICommand | ||||||
| { | ||||||
| public string Command { get; } = "RequestHuman"; | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please lowercase for my sanity
Suggested change
|
||||||
|
|
||||||
| public string[] Aliases { get; } = ["r","rh","request"]; | ||||||
|
|
||||||
| public string Description { get; } = "request to change into a human, if you're an SCP."; // no clue what the description for this should actually be tbh | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| public bool Execute( | ||||||
| ArraySegment<string> arguments, | ||||||
| ICommandSender sender, | ||||||
| out string response | ||||||
| ) | ||||||
| { | ||||||
| if (!Player.TryGet(sender, out Player player)) | ||||||
| { | ||||||
| response = "Only Players can use this command."; | ||||||
| return false; | ||||||
| } | ||||||
|
|
||||||
| if (!player.IsScp) | ||||||
| { | ||||||
| response = "Only SCP's can use this command."; | ||||||
| return false; | ||||||
| } | ||||||
|
|
||||||
| if (player.Role != RoleTypeId.Scp0492) // change if we allow other SCPs to request volunteer swap thingy (i should really figure out that terminology I hate how inconsistent i am) | ||||||
| { | ||||||
| response = "Only Zombies can use this command."; | ||||||
| return false; | ||||||
| } | ||||||
|
|
||||||
| response = "Opening a volunteer request."; // I really do not know what terminology should be used, always sounds so weird | ||||||
| VolunteerSystem.NewVolunteer(player.Role,original:player); | ||||||
| return true; | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| using Exiled.Events.EventArgs.Player; | ||
| using MEC; | ||
| using PlayerRoles; | ||
| using SillySCP.API.EventArgs; | ||
| using SillySCP.API.Features; | ||
| using SillySCP.API.Interfaces; | ||
| using SillySCP.API.Modules; | ||
|
|
@@ -19,6 +20,7 @@ public void Init() | |
| Exiled.Events.Handlers.Player.ChangingRole += OnChangingRole; | ||
|
|
||
| VolunteerSystem.VolunteerPeriodEnd += OnVolunteerPeriodEnd; | ||
| VolunteerSystem.VolunteerChosen += OnChosenVolunteer; | ||
| } | ||
|
|
||
| public void Unregister() | ||
|
|
@@ -27,6 +29,7 @@ public void Unregister() | |
| Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; | ||
| Exiled.Events.Handlers.Player.Died -= OnDead; | ||
| Exiled.Events.Handlers.Player.ChangingRole -= OnChangingRole; | ||
| VolunteerSystem.VolunteerChosen -= OnChosenVolunteer; | ||
| } | ||
|
|
||
| private void OnChangingRole(ChangingRoleEventArgs ev) | ||
|
|
@@ -38,6 +41,23 @@ private void OnChangingRole(ChangingRoleEventArgs ev) | |
| } | ||
| } | ||
|
|
||
| private void OnChosenVolunteer(VolunteerChosenEventArgs ev) | ||
| { | ||
| if (ev.Volunteer.OriginalPlayer != null) // If a Volunteer specified a player, for sake of sanity and simplicity, its treated as a replacement | ||
| { | ||
| // lumi before you chop my balls off, I elected to handle canceling the volunteer entirely if the player is dead in the VolunteerSystem | ||
| Exiled.API.Features.Player originalPlayer = ev.Volunteer.OriginalPlayer; | ||
| ev.Player.MaxHealth = originalPlayer.MaxHealth; | ||
| ev.Player.Health = originalPlayer.Health; | ||
blankochan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ev.Player.Position = originalPlayer.Position; | ||
blankochan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ev.Player.MaxHumeShield = originalPlayer.MaxHumeShield; | ||
| ev.Player.HumeShield = originalPlayer.HumeShield; | ||
blankochan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| originalPlayer.Role.Set(RoleTypeId.Spectator,SpawnReason.None); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ??????????????????? the player should become a human once they do .h, not spectator???????????
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I elected in order to avoid having to duplicate stuff, or make a weird abstraction that'd only ever be used to handle the possibility of like spectator swap or whatever. I made NewVolunteer have a nullable player and then i use that as an optional variable;
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. gonna resolve the other ones about this area because they all kinda roll into here |
||
| } | ||
|
|
||
| } | ||
|
|
||
| private void OnDead(DiedEventArgs ev) | ||
| { | ||
|
|
@@ -68,6 +88,7 @@ private void OnVolunteerPeriodEnd() | |
| { | ||
| // only doing this to save some resources, don't come at me | ||
blankochan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| List<Exiled.API.Features.Player> scps = Exiled.API.Features.Player.List.Where(p => p.IsScp).ToList(); | ||
| if (scps.Count == 0) return; | ||
| List<string> scpNames = scps.Select(scp => scp.Role.Name).ToList(); | ||
| List<string> scpNamesCopy = new(scpNames); | ||
| scpNamesCopy.RemoveAt(scpNamesCopy.Count-1); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lack of space is really irritating me 😭