Skip to content
Merged

2.0.2 #180

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
10 changes: 10 additions & 0 deletions .github/workflows/buildtoserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
msbuild "$SLN" /p:Configuration=Release

- name: Copy plugin to server
if: github.event_name == 'push'
run: |
DLL=$(find . -path "*/bin/Release/*KruacentExiled.dll" | head -n 1)

Expand All @@ -51,3 +52,12 @@ jobs:
fi
cp "$DLL" $OUTPUT_FOLDER_PATH/

- name: Create GitHub Release Draft
if: github.event_name == 'push'
uses: softprops/action-gh-release@v2
with:
tag_name: draft-${{ github.sha }}
name: "Draft Release"
draft: true
files: "**/bin/Release/*KruacentExiled.dll"
generate_release_notes: false
4 changes: 2 additions & 2 deletions KruacentExiled/CustomRoles/API/Features/CustomSCP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ public int GetPreferences(Player player)
if(sliderSetting is null)
{
Log.Error("slider setting is null in custom scp");
return -6;
return 0;
}


if (!SettingBase.TryGetSetting<SliderSetting>(player, sliderSetting.Id, out var setting)) return -6;
if (!SettingBase.TryGetSetting<SliderSetting>(player, sliderSetting.Id, out var setting)) return 0;
return (int) setting.SliderValue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected override void GiveInventory(Player player)
{
base.GiveInventory(player);

Exiled.CustomItems.API.Features.CustomItem.TryGive(player, "Friend Maker", false);
Exiled.CustomItems.API.Features.CustomItem.TryGive(player, "FriendMaker", false);

}

Expand Down
28 changes: 28 additions & 0 deletions KruacentExiled/CustomRoles/CR/CustomSCPs/SCP035.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
using Exiled.API.Features.Pickups;
using Exiled.CustomItems.API.Features;
using Exiled.Events.EventArgs.Player;
using Exiled.Events.EventArgs.Scp096;
using Exiled.Events.EventArgs.Scp1509;
using Exiled.Events.EventArgs.Scp173;
using Exiled.Events.EventArgs.Server;
using HintServiceMeow.Core.Models.Arguments;
using HintServiceMeow.Core.Utilities;
Expand Down Expand Up @@ -102,6 +104,9 @@ protected override void SubscribeEvents()
Exiled.Events.Handlers.Scp1509.Resurrecting += OnResurrecting;
Exiled.Events.Handlers.Player.UsingItem += OnUsingItem;
Exiled.Events.Handlers.Player.VoiceChatting += OnVoiceChatting;
Exiled.Events.Handlers.Scp096.AddingTarget += OnAddingTarget;
Exiled.Events.Handlers.Scp173.AddingObserver += OnAddingObserver;


base.SubscribeEvents();
}
Expand All @@ -115,6 +120,8 @@ protected override void UnsubscribeEvents()
Exiled.Events.Handlers.Server.EndingRound -= OnEndingRound;
Exiled.Events.Handlers.Scp1509.Resurrecting -= OnResurrecting;
Exiled.Events.Handlers.Player.UsingItem -= OnUsingItem;
Exiled.Events.Handlers.Scp096.AddingTarget -= OnAddingTarget;
Exiled.Events.Handlers.Scp173.AddingObserver -= OnAddingObserver;
base.UnsubscribeEvents();
}
private static HintPosition position = new RemainingPlayerPosition();
Expand All @@ -128,6 +135,27 @@ private void OnDying(DyingEventArgs ev)

}

private void OnAddingObserver(AddingObserverEventArgs ev)
{
if (!ev.IsAllowed) return;
if (Check(ev.Observer))
{
ev.IsAllowed = false;
}
}


private void OnAddingTarget(AddingTargetEventArgs ev)
{
if (!ev.IsAllowed) return;
if (Check(ev.Target))
{
ev.IsAllowed = false;
}


}

private void OnVoiceChatting(VoiceChattingEventArgs ev)
{
Player player = ev.Player;
Expand Down
22 changes: 14 additions & 8 deletions KruacentExiled/Map/Heavy/BulkDoor049.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Exiled.API.Enums;
using Exiled.API.Features;
using Exiled.API.Features.Doors;
using Interactables.Interobjects.DoorUtils;
using KE.Utils.API.Map;
using MEC;
Expand Down Expand Up @@ -38,11 +39,12 @@ public static void Create()

Log.Debug("spawn 049 bulk door at "+ worldpos);
}

private static CoroutineHandle handle;
private static void DoorVariant_OnInstanceRemoved(DoorVariant obj)
{
door.OnStateChanged -= Door_OnStateChanged;
DoorVariant.OnInstanceRemoved -= DoorVariant_OnInstanceRemoved;
Timing.KillCoroutines(handle);
}

public const float IdleDuration = 20f;
Expand All @@ -52,7 +54,7 @@ private static void Door_OnStateChanged()
{
if (door.NetworkTargetState)
{
Timing.RunCoroutine(AutoClose());
handle = Timing.RunCoroutine(AutoClose());
}

}
Expand All @@ -67,14 +69,18 @@ private static IEnumerator<float> AutoClose()
{
yield break;
}
duration -= RefreshRate;
Log.Info(duration);
if (duration <= 0)
if(door.NetworkActiveLocks == 0)
{
Log.Info("auto close");
door.NetworkTargetState = false;
duration = IdleDuration;
duration -= RefreshRate;
Log.Debug(duration);
if (duration <= 0)
{
Log.Debug("auto close");
door.NetworkTargetState = false;
duration = IdleDuration;
}
}

yield return Timing.WaitForSeconds(RefreshRate);

}
Expand Down
1 change: 1 addition & 0 deletions KruacentExiled/Misc/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class Config : IConfig
public float MultSCP106 { get; set; } = 1.1f;
public int MinPlayerVote { get; set; } = 6;

public float MultBaseSCP { get; set; } = 1.25f;


}
Expand Down
2 changes: 1 addition & 1 deletion KruacentExiled/Misc/Features/PostNuke/PostNukeHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private void OnDetonated(WarheadDetonatedEventArgs ev)
KELog.Debug(trigger);

if (trigger == Faction.Unclassified
|| trigger == Faction.FoundationStaff
|| trigger == Faction.SCP
|| trigger == Faction.Flamingos) return;


Expand Down
88 changes: 2 additions & 86 deletions KruacentExiled/Misc/Features/SCPRebalance/SCPBuff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace KruacentExiled.Misc.Features.SCPRebalance
public class SCPBuff : IUsingEvents
{
public const float RefreshRate = 1f;
public float IncreaseSCPHealth { get; } = 1.25f;
public float IncreaseSCPHealth => MainPlugin.Configs.MultBaseSCP;
private static Config Config => MainPlugin.Configs;

public Dictionary<RoleTypeId, float> RoleBuff = new Dictionary<RoleTypeId, float>()
Expand All @@ -41,37 +41,25 @@ internal SCPBuff() { }

public void SubscribeEvents()
{



Exiled.Events.Handlers.Player.ChangingRole += BecomingSCP;
}

public void UnsubscribeEvents()
{
Exiled.Events.Handlers.Player.ChangingRole -= BecomingSCP;



}




internal void StartBuff()
{
Timing.RunCoroutine(PeanutShield());

}


private void BecomingSCP(ChangingRoleEventArgs ev)
{
Player player = ev.Player;
if (!ev.NewRole.IsScp() || ev.NewRole == RoleTypeId.Scp0492) return;
if(player.Role == RoleTypeId.None) return;
float healthincrease = IncreaseSCPHealth;
if(RoleBuff.TryGetValue(ev.NewRole,out float val) && Player.Enumerable.Count(p => SCPTeam.IsSCP(p.ReferenceHub)) > 1)
if(RoleBuff.TryGetValue(ev.NewRole,out float val) && SCPTeam.SCPs.Count > 1)
{
healthincrease *= val;
}
Expand All @@ -92,77 +80,5 @@ private void BecomingSCP(ChangingRoleEventArgs ev)


}


private IEnumerator<float> PeanutShield()
{
while (Round.InProgress)
{
List<Player> peanuts = Player.List.Where(p => p.Role == RoleTypeId.Scp173).ToList();
peanuts.ForEach(p =>
{
AddHumeShield(p, CheckPlayerAround(p, 6));
});
yield return Timing.WaitForSeconds(RefreshRate);
}
}


/// <summary>
/// Count the number of player around
/// </summary>
/// <param name="p">The Player (the peanut) to check around them</param>
/// <param name="radius"></param>
/// <param name="countFriendly"></param>
/// <returns></returns>
private int CheckPlayerAround(Player p, float radius, bool countFriendly = false)
{
int result = 0;
foreach (Player player in Player.List)
{
if (player == p) continue;
if (player.Role.Side == p.Role.Side && !countFriendly) continue;
if (IsPlayerInZone(player, p.Position, radius, radius))
result += 5;
}
return result;
}


private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius, float height)
{

float horizontalDistance = Vector3.Distance(
new Vector3(player.Position.x, 0, player.Position.z),
new Vector3(zonePosition.x, 0, zonePosition.z)
);

// Calculate the vertical difference (y)
float verticalDifference = Mathf.Abs(player.Position.y - zonePosition.y);

// Check if the player is in the 3d zone.
return horizontalDistance <= radius / 2 && verticalDifference <= height / 2;
}


/// <summary>
/// Add HumeShield to a player
/// </summary>
/// <param name="p"></param>
/// <param name="hum"></param>
/// <returns>true if it's not over the max HumeShield of the player; false otherwise</returns>
private bool AddHumeShield(Player p, float hum)
{
float max = p.MaxHumeShield;
if (max < hum + p.HumeShield)
{
p.HumeShield = max;
return false;
}
p.HumeShield += hum;
return true;
}


}
}
5 changes: 5 additions & 0 deletions KruacentExiled/Misc/Features/Spawn/DummySCPs/DummySCP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ public void Set(Player player)

public int GetPreferences(Player player)
{
if (player.IsNPC)
{
return 0;
}

return player.ScpPreferences.Preferences[Role];
}

Expand Down
Loading
Loading