Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 23 additions & 11 deletions HealSCPs/Commands/heal.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
using CommandSystem;
using System;
using Exiled.API.Features;
using UnityEngine;
using Exiled.API.Extensions;
using PlayerRoles;
using PluginAPI.Core;
using UnityEngine;
using Hints;
using InventorySystem;
using InventorySystem.Items;
using System.Linq;
using System.Collections.Generic;

namespace HealSCPs
{
[CommandHandler(typeof(ClientCommandHandler))]
class heal : ICommand
class Heal : ICommand
{
public string Command { get; } = "heal";

Expand All @@ -19,25 +23,24 @@ class heal : ICommand
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
{
Player player = Player.Get((CommandSender)sender);

if (!player.IsHuman)
{
response = "You can't run this command!";
return false;
}
if (!player.CurrentItem.Type.IsMedical())
if (player.CurrentItem == null || player.CurrentItem.Category != ItemCategory.Medical)
{
response = "You can't heal SCPs with that item!";
return false;
}
Transform cam = player.CameraTransform;
Transform cam = player.ReferenceHub.PlayerCameraReference;
if (!Physics.Raycast(cam.position, cam.forward, out RaycastHit hit, Plugin.Instance.Config.Distance, LayerMask.GetMask("Default", "Player", "Hitbox")))
{
response = "You must be looking at an SCP in order to heal them.";
return false;
}
Player hitPlayer = Player.Get(hit.transform.GetComponentInParent<ReferenceHub>());
if (hitPlayer == null || hitPlayer.Role.Team != Team.SCPs)
if (hitPlayer == null || hitPlayer.Role.GetTeam() != Team.SCPs)
{
response = "You must be looking at an SCP in order to heal them.";
return false;
Expand All @@ -48,7 +51,7 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
return false;
}

float amount = player.CurrentItem.Type switch
float amount = player.CurrentItem.ItemTypeId switch
{
ItemType.Adrenaline => Plugin.Instance.Config.AdrenalineHealthRecieve,
ItemType.Medkit => Plugin.Instance.Config.MedkitHealthRecieve,
Expand All @@ -57,9 +60,18 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
ItemType.SCP500 => Plugin.Instance.Config.SCP500HealthRecieve,
_ => 0
};
hitPlayer.ShowHint($"You have been healed by {player.Nickname} for {amount}HP");
TextHint hint = new($"You have been healed by {player.Nickname} for {amount}HP");
hitPlayer.ReferenceHub.hints.Show(hint);
hitPlayer.Heal(amount);
player.RemoveHeldItem();
//what kind of fucking code is this?
foreach(var item in player.ReferenceHub.inventory.UserInventory.Items.Keys)
{
if (player.ReferenceHub.inventory.UserInventory.Items[item].ItemTypeId == player.CurrentItem.ItemTypeId)
{
player.ReferenceHub.inventory.ServerRemoveItem(item, player.ReferenceHub.inventory.UserInventory.Items[item].PickupDropModel);
break;
}
}
response = $"Healed Player {hitPlayer.Nickname}";
return true;
}
Expand Down
8 changes: 3 additions & 5 deletions HealSCPs/Config.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using Exiled.API.Interfaces;
using PlayerRoles;
using PlayerRoles;
using System.Collections.Generic;
using System.ComponentModel;

namespace HealSCPs
{
public sealed class Config : IConfig
public sealed class Config
{
[Description("Enable the plugin?")]
public bool IsEnabled { get; set; } = true;

[Description("How much health the SCP gets from a Medkit.")]
Expand All @@ -29,7 +29,5 @@ public sealed class Config : IConfig

[Description("What SCPs are allowed to be healed?")]
public List<RoleTypeId> AllowedScps { get; private set; } = new List<RoleTypeId>() { RoleTypeId.Scp049, RoleTypeId.Scp0492, RoleTypeId.Scp079, RoleTypeId.Scp096, RoleTypeId.Scp106, RoleTypeId.Scp173, RoleTypeId.Scp939 };

bool IConfig.Debug { get; set; }
}
}
69 changes: 21 additions & 48 deletions HealSCPs/HealSCPs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,51 +33,29 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\EXILED.7.0.5\lib\net48\Assembly-CSharp-Publicized.dll</HintPath>
<Private>True</Private>
<Reference Include="Assembly-CSharp">
<HintPath>..\depend\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-Publicized, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EXILED.7.0.5\lib\net48\Assembly-CSharp-Publicized.dll</HintPath>
<Private>True</Private>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>..\depend\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="CommandSystem.Core, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EXILED.7.0.5\lib\net48\CommandSystem.Core.dll</HintPath>
<Reference Include="CommandSystem.Core">
<HintPath>..\depend\CommandSystem.Core.dll</HintPath>
</Reference>
<Reference Include="Exiled.API, Version=7.0.5.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.7.0.5\lib\net48\Exiled.API.dll</HintPath>
<Reference Include="Mirror">
<HintPath>..\depend\Mirror.dll</HintPath>
</Reference>
<Reference Include="Exiled.CreditTags, Version=7.0.5.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.7.0.5\lib\net48\Exiled.CreditTags.dll</HintPath>
<Reference Include="Mirror.Components">
<HintPath>..\depend\Mirror.Components.dll</HintPath>
</Reference>
<Reference Include="Exiled.CustomItems, Version=7.0.5.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.7.0.5\lib\net48\Exiled.CustomItems.dll</HintPath>
<Reference Include="NorthwoodLib">
<HintPath>..\depend\NorthwoodLib.dll</HintPath>
</Reference>
<Reference Include="Exiled.CustomRoles, Version=7.0.5.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.7.0.5\lib\net48\Exiled.CustomRoles.dll</HintPath>
<Reference Include="PluginAPI">
<HintPath>..\depend\PluginAPI.dll</HintPath>
</Reference>
<Reference Include="Exiled.Events, Version=7.0.5.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.7.0.5\lib\net48\Exiled.Events.dll</HintPath>
</Reference>
<Reference Include="Exiled.Loader, Version=7.0.5.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.7.0.5\lib\net48\Exiled.Loader.dll</HintPath>
</Reference>
<Reference Include="Exiled.Permissions, Version=7.0.5.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.7.0.5\lib\net48\Exiled.Permissions.dll</HintPath>
</Reference>
<Reference Include="Exiled.Updater, Version=3.1.2.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.7.0.5\lib\net48\Exiled.Updater.dll</HintPath>
</Reference>
<Reference Include="Mirror, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\3.0 References\Mirror.dll</HintPath>
</Reference>
<Reference Include="NorthwoodLib, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EXILED.7.0.5\lib\net48\NorthwoodLib.dll</HintPath>
</Reference>
<Reference Include="PluginAPI, Version=12.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.7.0.5\lib\net48\PluginAPI.dll</HintPath>
<Reference Include="Pooling">
<HintPath>..\depend\Pooling.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
Expand All @@ -87,20 +65,15 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\3.0 References\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.PhysicsModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\3.0 References\UnityEngine.PhysicsModule.dll</HintPath>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\depend\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="YamlDotNet, Version=11.0.0.0, Culture=neutral, PublicKeyToken=ec19458f3c15af5e, processorArchitecture=MSIL">
<HintPath>..\packages\EXILED.7.0.5\lib\net48\YamlDotNet.dll</HintPath>
<Reference Include="UnityEngine.PhysicsModule">
<HintPath>..\depend\UnityEngine.PhysicsModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Commands\heal.cs" />
<Compile Include="Commands\Heal.cs" />
<Compile Include="Config.cs" />
<Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
49 changes: 30 additions & 19 deletions HealSCPs/Plugin.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,38 @@
using Exiled.API.Features;
using PluginAPI.Core;
using PlayerRoles.Ragdolls;
using PluginAPI.Core.Attributes;
using System;

namespace HealSCPs
{
public class Plugin : Plugin<Config>
public class Plugin
{
public override void OnEnabled()
{
Plugin.singleton = this;
base.OnEnabled();
}
public override void OnDisabled()
{
Plugin.singleton = null;
base.OnDisabled();
}
public static Plugin Instance => singleton;
public const string PluginName = "HealSCPs";
public const string PluginVersion = "1.0.0";
public const string PluginDesc = "A plugin to make \'better\' balancing changes to SL.";
public const string Author = "Skillz2play (Ported to NWAPI by btelnyy)";
public static Plugin Instance => instance;
private static Plugin instance;
[PluginConfig(PluginName + ".yml")]
public Config Config = new Config();

public override string Name => "HealSCPs";
public override string Author => "Skillz2play";
public override Version Version => new Version(1, 8, 3);
public override Version RequiredExiledVersion => new Version(7, 0, 0);
[PluginEntryPoint(PluginName, PluginVersion, PluginDesc, Author)]
public void LoadPlugin()
{
if (!Config.IsEnabled)
{
Log.Debug("Plugin is disabled!");
return;
}
instance = this;
Log.Info("Registering events...");
PluginAPI.Events.EventManager.RegisterAllEvents(this);
}

private static Plugin singleton;
}
[PluginUnload()]
public void Unload()
{
Config = null;
}
}
}
Binary file added depend/Assembly-CSharp-firstpass.dll
Binary file not shown.
Binary file added depend/Assembly-CSharp.dll
Binary file not shown.
Binary file added depend/CommandSystem.Core.dll
Binary file not shown.
Binary file added depend/Mirror.Components.dll
Binary file not shown.
Binary file added depend/Mirror.dll
Binary file not shown.
Binary file added depend/NorthwoodLib.dll
Binary file not shown.
Binary file added depend/PluginAPI.dll
Binary file not shown.
Binary file added depend/Pooling.dll
Binary file not shown.
Binary file added depend/System.dll
Binary file not shown.
Binary file added depend/UnityEngine.CoreModule.dll
Binary file not shown.
Binary file added depend/UnityEngine.PhysicsModule.dll
Binary file not shown.