Skip to content

Commit

Permalink
Merge branch 'halloween-2023' into origin/halloween-2023
Browse files Browse the repository at this point in the history
  • Loading branch information
louis1706 authored Nov 11, 2023
2 parents 3d145bb + 842f9d7 commit ebe3378
Show file tree
Hide file tree
Showing 16 changed files with 151 additions and 74 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/halloween.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Exiled Halloween CI

on:
push:
branches:
- 'halloween-2023'
pull_request:
branches:
- 'halloween-2023'
workflow_dispatch:

env:
EXILED_REFERENCES_URL: https://exiled.host/build_deps/Dev.zip
EXILED_REFERENCES_PATH: ${{ github.workspace }}/References

jobs:

build:

runs-on: windows-latest
# Prevent double running for push & pull_request events from the main repo
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'Exiled-Team/Exiled'

steps:

- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v1.7.2

- name: Setup Nuget
uses: iRebbok/setup-nuget@master

- uses: actions/checkout@v2.3.4

- name: Get references
shell: pwsh
run: |
Invoke-WebRequest -Uri ${{ env.EXILED_REFERENCES_URL }} -OutFile ${{ github.workspace }}/References.zip
Expand-Archive -Path References.zip -DestinationPath ${{ env.EXILED_REFERENCES_PATH }}
- name: Build
env:
EXILED_REFERENCES: ${{ env.EXILED_REFERENCES_PATH }}
shell: pwsh
run: |
./build.ps1 -BuildNuGet
$File = (Get-ChildItem -Path . -Include 'EXILED.*.nupkg' -Recurse).Name
Out-File -FilePath ${{ github.env }} -InputObject "PackageFile=$File" -Encoding utf-8 -Append
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: Build Results
path: bin/Release
2 changes: 1 addition & 1 deletion EXILED.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<PropertyGroup>
<!-- This is the global version and is used for all projects that don't have a version -->
<Version Condition="$(Version) == ''">8.3.9</Version>
<Version Condition="$(Version) == ''">8.3.11</Version>
<!-- Enables public beta warning via the PUBLIC_BETA constant -->
<PublicBeta>false</PublicBeta>

Expand Down
4 changes: 2 additions & 2 deletions Exiled.API/Features/Intercom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public static class Intercom
/// </summary>
public static string DisplayText
{
get => IntercomDisplay._overrideText;
set => IntercomDisplay._overrideText = value;
get => IntercomDisplay.Network_overrideText;
set => IntercomDisplay.Network_overrideText = value;
}

/// <summary>
Expand Down
10 changes: 10 additions & 0 deletions Exiled.API/Features/Items/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,16 @@ public ushort Serial
/// </summary>
public bool IsWeapon => this is Firearm;

/// <summary>
/// Gets a value indicating whether or not this item emits light.
/// </summary>
public bool IsLightEmitter => this is ILightEmittingItem;

/// <summary>
/// Gets a value indicating whether or not this item can be used to disarm players.
/// </summary>
public bool IsDisarmer => this is IDisarmingItem;

/// <summary>
/// Gets the <see cref="Player"/> who owns the item.
/// </summary>
Expand Down
9 changes: 7 additions & 2 deletions Exiled.API/Features/Items/Scp330.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public enum CandyAddStatus
/// <summary>
/// A wrapper class for SCP-330 bags.
/// </summary>
public partial class Scp330 : Usable, IWrapper<Scp330Bag>
public class Scp330 : Usable, IWrapper<Scp330Bag>
{
/// <summary>
/// Initializes a new instance of the <see cref="Scp330"/> class.
Expand All @@ -64,8 +64,14 @@ public Scp330(Scp330Bag itemBase)
internal Scp330()
: this((Scp330Bag)Server.Host.Inventory.CreateItemInstance(new(ItemType.SCP330, 0), false))
{
Base.Candies.Add(Scp330Candies.GetRandom());
}

/// <summary>
/// Gets the <see cref="Dictionary{TKey,TValue}"/> with all presented in game candies.
/// </summary>
public static Dictionary<CandyKindID, ICandy> AvailableCandies { get; } = Scp330Candies.CandiesById;

/// <summary>
/// Gets the <see cref="Scp330Bag"/> that this class is encapsulating.
/// </summary>
Expand Down Expand Up @@ -282,7 +288,6 @@ public override Item Clone()
internal override void ChangeOwner(Player oldOwner, Player newOwner)
{
Base.Owner = newOwner.ReferenceHub;
Base.ServerRefreshBag();
}
}
}
2 changes: 1 addition & 1 deletion Exiled.API/Features/Npc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public static Npc Spawn(string name, RoleTypeId role, int id = 0, string userId

int conId = id == 0 ? ReferenceHub.AllHubs.Count + 1 : id;

NetworkServer.AddPlayerForConnection(new(conId), newObject);
NetworkServer.AddPlayerForConnection(new FakeConnection(conId), newObject);

try
{
Expand Down
4 changes: 1 addition & 3 deletions Exiled.API/Features/Pickups/Pickup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public Quaternion Rotation
/// <summary>
/// Gets a value indicating whether this pickup is spawned.
/// </summary>
public bool IsSpawned { get; internal set; }
public bool IsSpawned => NetworkServer.spawned.ContainsValue(Base.netIdentity);

/// <summary>
/// Gets an existing <see cref="Pickup"/> or creates a new instance of one.
Expand Down Expand Up @@ -541,7 +541,6 @@ public void Spawn()
if (!IsSpawned)
{
NetworkServer.Spawn(GameObject);
IsSpawned = true;
}
}

Expand Down Expand Up @@ -572,7 +571,6 @@ public void UnSpawn()
{
if (IsSpawned)
{
IsSpawned = false;
NetworkServer.UnSpawn(GameObject);
}
}
Expand Down
14 changes: 5 additions & 9 deletions Exiled.API/Features/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2555,14 +2555,10 @@ public Item AddItem(ItemBase itemBase, Item item = null)

item.ChangeOwner(item.Owner, this);

Timing.CallDelayed(0.02f, () =>
if (itemBase is IAcquisitionConfirmationTrigger acquisitionConfirmationTrigger)
{
if (itemBase is IAcquisitionConfirmationTrigger acquisitionConfirmationTrigger)
{
acquisitionConfirmationTrigger.ServerConfirmAcqusition();
acquisitionConfirmationTrigger.AcquisitionAlreadyReceived = true;
}
});
acquisitionConfirmationTrigger.AcquisitionAlreadyReceived = false;
}

ItemsValue.Add(item);

Expand Down Expand Up @@ -2924,8 +2920,8 @@ public bool EnableEffect(StatusEffectBase statusEffect, byte intensity, float du
if (statusEffect is null)
return false;

statusEffect.ServerSetState(intensity);
statusEffect.ServerChangeDuration(duration, addDurationIfActive);
statusEffect.ServerSetState(intensity, duration, addDurationIfActive);

return statusEffect is not null && statusEffect.IsEnabled;
}

Expand Down
17 changes: 17 additions & 0 deletions Exiled.API/Features/Roles/Scp3114Role.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ internal Scp3114Role(Scp3114GameRole baseRole)
Log.Error("Scp3114Disguise not found in Scp3114Role::ctor");

Disguise = scp3114Disguise;

if (!SubroutineModule.TryGetSubroutine(out Scp3114VoiceLines scp3114VoiceLines))
Log.Error("Scp3114VoiceLines not found in Scp3114Role::ctor");

VoiceLines = scp3114VoiceLines;
}

/// <inheritdoc/>
Expand Down Expand Up @@ -121,6 +126,11 @@ internal Scp3114Role(Scp3114GameRole baseRole)
/// </summary>
public Scp3114Disguise Disguise { get; }

/// <summary>
/// Gets Scp3114's <see cref="Scp3114VoiceLines"/>.
/// </summary>
public Scp3114VoiceLines VoiceLines { get; }

/// <summary>
/// Gets the <see cref="Scp3114GameRole"/> instance.
/// </summary>
Expand Down Expand Up @@ -218,6 +228,13 @@ public void ResetIdentity()
Identity.ServerResendIdentity();
}

/// <summary>
/// Plays a random Scp3114 voice line.
/// </summary>
/// <param name="voiceLine">The type of voice line to play.</param>
public void PlaySound(Scp3114VoiceLines.VoiceLinesName voiceLine = Scp3114VoiceLines.VoiceLinesName.RandomIdle)
=> VoiceLines.ServerPlayConditionally(voiceLine);

/// <summary>
/// Gets the Spawn Chance of SCP-3114.
/// </summary>
Expand Down
9 changes: 9 additions & 0 deletions Exiled.API/Features/Warhead.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ public static bool IsLocked
set => Controller.IsLocked = value;
}

/// <summary>
/// Gets or sets the amount of kills caused by the warhead (shown on the summary screen).
/// </summary>
public static int Kills
{
get => Controller.WarheadKills;
set => Controller.WarheadKills = value;
}

/// <summary>
/// Gets a value indicating whether or not the warhead can be started.
/// </summary>
Expand Down
6 changes: 4 additions & 2 deletions Exiled.CustomItems/API/Features/CustomItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,8 @@ protected virtual void OnWaitingForPlayers()
/// <param name="player">The <see cref="Player"/> who will be shown the message.</param>
protected virtual void ShowPickedUpMessage(Player player)
{
player.ShowHint(string.Format(Instance!.Config.PickedUpHint.Content, Name, Description), Instance.Config.PickedUpHint.Duration);
if (Instance!.Config.PickedUpHint.Show)
player.ShowHint(string.Format(Instance.Config.PickedUpHint.Content, Name, Description), Instance.Config.PickedUpHint.Duration);
}

/// <summary>
Expand All @@ -987,7 +988,8 @@ protected virtual void ShowPickedUpMessage(Player player)
/// <param name="player">The <see cref="Player"/> who will be shown the message.</param>
protected virtual void ShowSelectedMessage(Player player)
{
player.ShowHint(string.Format(Instance!.Config.SelectedHint.Content, Name, Description), Instance.Config.SelectedHint.Duration);
if (Instance!.Config.SelectedHint.Show)
player.ShowHint(string.Format(Instance.Config.SelectedHint.Content, Name, Description), Instance.Config.SelectedHint.Duration);
}

private void OnInternalOwnerChangingRole(ChangingRoleEventArgs ev)
Expand Down
5 changes: 0 additions & 5 deletions Exiled.Events/Patches/Fixes/GrenadePropertiesFix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
new(OpCodes.Callvirt, PropertyGetter(typeof(ThrownProjectile), nameof(ThrownProjectile.gameObject))),
new(OpCodes.Ldc_I4_1),
new(OpCodes.Callvirt, Method(typeof(GameObject), nameof(GameObject.SetActive))),

// projectile.Spawned = true;
new(OpCodes.Ldloc_S, projectile.LocalIndex),
new(OpCodes.Ldc_I4_1),
new(OpCodes.Callvirt, PropertySetter(typeof(Projectile), nameof(Projectile.IsSpawned))),
});

for (int z = 0; z < newInstructions.Count; z++)
Expand Down
12 changes: 6 additions & 6 deletions Exiled.Events/Patches/Generic/IndividualFriendlyFire.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static bool CheckFriendlyFirePlayerRules(Footprint attackerFootprint, Ref

// Return false, no custom friendly fire allowed, default to NW logic for FF. No point in processing if FF is enabled across the board.
if (Server.FriendlyFire)
return false;
return HitboxIdentity.CheckFriendlyFire(attackerFootprint.Role, victimHub.roleManager.CurrentRole.RoleTypeId);

// always allow damage from Server.Host
if (attackerFootprint.Hub == Server.Host.ReferenceHub)
Expand Down Expand Up @@ -134,7 +134,7 @@ public static bool CheckFriendlyFirePlayerRules(Footprint attackerFootprint, Ref
if (pairedData.ContainsKey(attacker.Role))
{
ffMultiplier = pairedData[attacker.Role];
return true;
return ffMultiplier != 0;
}
}
}
Expand All @@ -149,7 +149,7 @@ public static bool CheckFriendlyFirePlayerRules(Footprint attackerFootprint, Ref
if (pairedData.ContainsKey(victim.Role))
{
ffMultiplier = pairedData[victim.Role];
return true;
return ffMultiplier != 0;
}
}
}
Expand All @@ -161,16 +161,16 @@ public static bool CheckFriendlyFirePlayerRules(Footprint attackerFootprint, Ref
if (attacker.FriendlyFireMultiplier.TryGetValue(victim.Role, out float ffMulti))
{
ffMultiplier = ffMulti;
return true;
return ffMultiplier != 0;
}
}
}
catch (Exception ex)
{
Log.Debug($"CheckFriendlyFirePlayerRules failed to handle friendly fire because: {ex}");
Log.Error($"CheckFriendlyFirePlayerRules failed to handle friendly fire because: {ex}");
}

return false;
return HitboxIdentity.CheckFriendlyFire(attackerFootprint.Role, victimHub.roleManager.CurrentRole.RoleTypeId);
}
}

Expand Down
10 changes: 2 additions & 8 deletions Exiled.Events/Patches/Generic/PickupControlPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,13 @@ private static IEnumerable<CodeInstruction> Transpiler(
// pickup = Pickup.Get(pickupBase);
new(OpCodes.Ldloc_0),
new(OpCodes.Call, Method(typeof(Pickup), nameof(Pickup.Get), new[] { typeof(ItemPickupBase) })),
new(OpCodes.Dup),

// Item.Get(itemBase);
new(OpCodes.Ldarg_0),
new(OpCodes.Call, Method(typeof(Item), nameof(Item.Get), new[] { typeof(ItemBase) })),

// pickup.ReadItemInfo(item);
new(OpCodes.Callvirt, Method(typeof(Pickup), nameof(Pickup.ReadItemInfo))),

// pickup.IsSpawned = spawn
new(OpCodes.Ldarg_S, 4),
new(OpCodes.Callvirt, PropertySetter(typeof(Pickup), nameof(Pickup.IsSpawned))),
});

for (int z = 0; z < newInstructions.Count; z++)
Expand All @@ -82,11 +77,10 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi

newInstructions.InsertRange(newInstructions.Count - 1, new CodeInstruction[]
{
// Pickup.Get(pickupBase).IsSpawned = true
// Pickup.Get(pickupBase)
new(OpCodes.Ldarg_0),
new(OpCodes.Call, Method(typeof(Pickup), nameof(Pickup.Get), new[] { typeof(ItemPickupBase) })),
new(OpCodes.Ldc_I4_1),
new(OpCodes.Callvirt, PropertySetter(typeof(Pickup), nameof(Pickup.IsSpawned))),
new(OpCodes.Pop),
});

for (int z = 0; z < newInstructions.Count; z++)
Expand Down
7 changes: 5 additions & 2 deletions Exiled.Loader/Features/Configs/CommentsObjectGraphVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ public override bool EnterMapping(IPropertyDescriptor key, IObjectDescriptor val
{
if (value is CommentsObjectDescriptor commentsDescriptor && commentsDescriptor.Comment is not null)
{
context.Emit(new Comment(commentsDescriptor.Comment, false));
foreach (string subComment in commentsDescriptor.Comment.Split('\n'))
{
context.Emit(new Comment(subComment, false));
}
}

return base.EnterMapping(key, value, context);
}
}
}
}
Loading

0 comments on commit ebe3378

Please sign in to comment.