mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-18 14:07:53 +03:00
<!-- This is a semi-strict format, you can add/remove sections as needed but the order/format should be kept the same Remove these comments before submitting --> <!-- Explain this PR in as much detail as applicable Some example prompts to consider: How might this affect the game? The codebase? What might be some alternatives to this? How/Who does this benefit/hurt [the game/codebase]? --> This PR ports https://github.com/Goob-Station/Goob-Station/pull/2409 https://github.com/Goob-Station/Goob-Station/pull/2591 https://github.com/Goob-Station/Goob-Station/pull/2599 This PR was initially intended to be merged into White Dream repo, so my changes are marked as WD edit. <!-- A list of everything you have to do before this PR is "complete" You probably won't have to complete everything before merging but it's good to leave future references --> - [ ] Port pain numbness - [ ] Port nullrods - [ ] Port tile movement --- <!-- This is default collapsed, readers click to expand it and see all your media The PR media section can get very large at times, so this is a good way to keep it clean The title is written using HTML tags The title must be within the <summary> tags or you won't see it --> <details><summary><h1>Media</h1></summary> <p>     </p> </details> --- <!-- You can add an author after the `🆑` to change the name that appears in the changelog (ex: `🆑 Death`) Leaving it blank will default to your GitHub display name This includes all available types for the changelog --> 🆑 - add: Ported Devil antag from Goobstation --------- Signed-off-by: Kai5 <68296202+Kai518@users.noreply.github.com> Signed-off-by: VMSolidus <evilexecutive@gmail.com> Co-authored-by: Solstice <solsticeofthewinter@gmail.com> Co-authored-by: VMSolidus <evilexecutive@gmail.com>
120 lines
4.2 KiB
C#
120 lines
4.2 KiB
C#
// SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
|
|
// SPDX-FileCopyrightText: 2025 Solstice <solsticeofthewinter@gmail.com>
|
|
// SPDX-FileCopyrightText: 2025 SolsticeOfTheWinter <solsticeofthewinter@gmail.com>
|
|
// SPDX-FileCopyrightText: 2025 gluesniffler <159397573+gluesniffler@users.noreply.github.com>
|
|
// SPDX-FileCopyrightText: 2025 gluesniffler <linebarrelerenthusiast@gmail.com>
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
using System.Linq;
|
|
using Content.Shared._Goobstation.Devil;
|
|
using Content.Server.Body.Components;
|
|
using Content.Shared._Shitmed.Body.Events;
|
|
using Content.Shared.Body.Components;
|
|
using Content.Shared.Body.Part;
|
|
using Robust.Shared.Random;
|
|
|
|
namespace Content.Server._Goobstation.Devil.Contract;
|
|
|
|
public sealed partial class DevilContractSystem
|
|
{
|
|
private void InitializeSpecialActions()
|
|
{
|
|
SubscribeLocalEvent<DevilContractSoulOwnershipEvent>(OnSoulOwnership);
|
|
SubscribeLocalEvent<DevilContractLoseHandEvent>(OnLoseHand);
|
|
SubscribeLocalEvent<DevilContractLoseLegEvent>(OnLoseLeg);
|
|
SubscribeLocalEvent<DevilContractLoseOrganEvent>(OnLoseOrgan);
|
|
SubscribeLocalEvent<DevilContractChanceEvent>(OnChance);
|
|
}
|
|
private void OnSoulOwnership(DevilContractSoulOwnershipEvent args)
|
|
{
|
|
if (args.Contract?.ContractOwner is not { } contractOwner)
|
|
return;
|
|
|
|
TryTransferSouls(contractOwner, args.Target, 1);
|
|
}
|
|
|
|
private void OnLoseHand(DevilContractLoseHandEvent args)
|
|
{
|
|
if (!TryComp<BodyComponent>(args.Target, out var body))
|
|
return;
|
|
//
|
|
// var hands = _bodySystem.GetBodyChildrenOfType(args.Target, BodyPartType.Hand, body).ToList();
|
|
//
|
|
// if (hands.Count <= 0)
|
|
// return;
|
|
//
|
|
// var pick = _random.Pick(hands);
|
|
|
|
// if (!TryComp<WoundableComponent>(pick.Id, out var woundable)
|
|
// || !woundable.ParentWoundable.HasValue)
|
|
// return;
|
|
//
|
|
// _wounds.AmputateWoundableSafely(woundable.ParentWoundable.Value, pick.Id, woundable);
|
|
// QueueDel(pick.Id);
|
|
//
|
|
// Dirty(args.Target, body);
|
|
// _sawmill.Debug($"Removed part {ToPrettyString(pick.Id)} from {ToPrettyString(args.Target)}");
|
|
// QueueDel(pick.Id);
|
|
|
|
var baseXform = Transform(args.Target);
|
|
foreach (var part in _bodySystem.GetBodyChildrenOfType(args.Target, BodyPartType.Hand, body))
|
|
{
|
|
_transform.AttachToGridOrMap(part.Id);
|
|
break;
|
|
}
|
|
}
|
|
|
|
private void OnLoseLeg(DevilContractLoseLegEvent args)
|
|
{
|
|
if (!TryComp<BodyComponent>(args.Target, out var body))
|
|
return;
|
|
|
|
// var legs = _bodySystem.GetBodyChildrenOfType(args.Target, BodyPartType.Leg, body).ToList();
|
|
//
|
|
// if (legs.Count <= 0)
|
|
// return;
|
|
//
|
|
// var pick = _random.Pick(legs);
|
|
//
|
|
// if (!TryComp<WoundableComponent>(pick.Id, out var woundable)
|
|
// || !woundable.ParentWoundable.HasValue)
|
|
// return;
|
|
//
|
|
// _wounds.AmputateWoundableSafely(woundable.ParentWoundable.Value, pick.Id, woundable);
|
|
//
|
|
// Dirty(args.Target, body);
|
|
// _sawmill.Debug($"Removed part {ToPrettyString(pick.Id)} from {ToPrettyString(args.Target)}");
|
|
// QueueDel(pick.Id);
|
|
var baseXform = Transform(args.Target);
|
|
foreach (var part in _bodySystem.GetBodyChildrenOfType(args.Target, BodyPartType.Leg, body))
|
|
{
|
|
_transform.AttachToGridOrMap(part.Id);
|
|
break;
|
|
}
|
|
}
|
|
|
|
private void OnLoseOrgan(DevilContractLoseOrganEvent args)
|
|
{
|
|
// don't remove the brain, as funny as that is.
|
|
var eligibleOrgans = _bodySystem.GetBodyOrgans(args.Target)
|
|
.Where(o => !HasComp<BrainComponent>(o.Id))
|
|
.ToList();
|
|
|
|
if (eligibleOrgans.Count <= 0)
|
|
return;
|
|
|
|
var pick = _random.Pick(eligibleOrgans);
|
|
|
|
_bodySystem.RemoveOrgan(pick.Id, pick.Component);
|
|
_sawmill.Debug($"Removed part {ToPrettyString(pick.Id)} from {ToPrettyString(args.Target)}");
|
|
QueueDel(pick.Id);
|
|
}
|
|
|
|
// LETS GO GAMBLING!!!!!
|
|
private void OnChance(DevilContractChanceEvent args)
|
|
{
|
|
AddRandomClause(args.Target);
|
|
}
|
|
}
|