Files
wwdpublic/Content.Server/_EE/Xelthia/XelthiaSystem.cs
ZetaNull 718078de24 Add New Species: Xelthia (#2214)
<!--
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
-->

# Description

<!--
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 is a PR to add a new species, the Xelthia. I find that most of the
species in this game don't feel particularly alien, and I'm aware that
they aren't as alien as some might want, but I feel like they're
decently alien, personally. In addition to this, I've tried to set them
up to fill niches that aren't particularly common with other species,
such as having a heat resistance and cold weakness where other species
tend to have cold resistances and heat weaknesses.

Here's their current list of (planned) traits, which is tentative and
I'm open to adjusting.
### Negatives
- Cold weaknesses
- Lack of a gloves slot thanks to having tentacle arms
- Carnivores, will only eat things containing meat for the most part
### Positives
- Heat resistances
- Arm Regrowth, dropping their current arms
- Acid blood (Currently slippable)
- Caustic immunity (so they don't burn from falling in their own blood)
### ???
- Dropped arms are able to be eaten and/or cooked.

I've not worked with C# before now, so apologies if the code is a little
bit scuffed or anything

---

# TODO

<!--
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
-->

- [x] Implement Xelthia Species, complete with sprites and a language
- [x] Add species default names
- [x] Add displacement maps and such to make sure they look right
- [x] Implement primary YAML-based species functions, basically
everything that isnt the limb regrowth function
- [x] Axe the initial psionics bit
- [x] Add the actual function for limb regrowth
- [x] Add proper lore
- [x] Any other possible considerations with adding Xelthia
characteristics

---

<!--
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>

https://github.com/user-attachments/assets/4fd3cb4f-4d5d-44dd-b5c0-62fd392e8920

![image](https://github.com/user-attachments/assets/3e5db9cc-a2b3-424e-a75c-cd410d57a0b2)

![image](https://github.com/user-attachments/assets/0a8e3f50-e20c-406e-8c1e-78cdd4eb1496)

![image](https://github.com/user-attachments/assets/bc860e97-6180-484c-afb1-e539decbb425)

![image](https://github.com/user-attachments/assets/331a620b-4c7f-4913-81db-a3fe235f58c1)

</p>
</details>

---

# Changelog

<!--
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
-->

🆑 Zeta_Null
- add: Added Xelthia, a custom alien species
- add: Added an insulated jacket, to account for Xelthia not having
access to a glove slot.
- add: Xelthia tentacle item that drops when arms are regrown. This is
able to be cooked.

---------

Signed-off-by: ZetaNull <93877175+ZetaNull@users.noreply.github.com>
(cherry picked from commit 5de2bd074f7ee852774c11fd92996f7c14fd3d1b)
2025-04-26 12:13:13 +03:00

107 lines
4.8 KiB
C#

using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Shared._EE.Xelthia;
using Content.Shared.Abilities.Psionics;
using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Markings;
using Content.Shared.Psionics;
using Content.Shared.Bed.Sleep;
using Content.Shared.Damage.Components;
using Content.Shared.Damage.Systems;
using Content.Shared.Shadowkin;
using Content.Shared.Rejuvenate;
using Content.Shared.Alert;
using Content.Shared.Rounding;
using Content.Shared.Actions;
using Robust.Shared.Prototypes;
using Content.Shared.Examine;
using Content.Shared.Actions.Events;
using Content.Shared.Body.Components;
using Content.Shared.Body.Part;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Placement;
using Robust.Shared.Random;
using Robust.Shared.Serialization.Manager;
using Robust.Shared.Timing;
using Content.Shared.Chemistry.Components;
namespace Content.Server._EE.Xelthia;
/// <summary>
/// Xelthia Arm Regrowth stuff
/// </summary>
public sealed class XelthiaSystem : EntitySystem
{
/// <inheritdoc/>
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly BloodstreamSystem _bloodstreamSystem = default!;
//public const string XelthiaRegenerateActionId = "XelthiaRegenerateAction";
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<XelthiaComponent, ComponentStartup>(OnInit);
SubscribeLocalEvent<XelthiaComponent, ArmRegrowthEvent>(OnRegrowthAction);
}
private void OnInit(EntityUid uid, XelthiaComponent component, ComponentStartup args)
{
_actionsSystem.AddAction(uid, ref component.XelthiaRegenerateAction, out var regenerateAction, "XelthiaRegenerateAction");
if (regenerateAction?.UseDelay != null)
component.UseDelay = regenerateAction.UseDelay.Value;
}
private void OnRegrowthAction(EntityUid uid, XelthiaComponent component, ArmRegrowthEvent args)
{
var start = _gameTiming.CurTime;
var end = _gameTiming.CurTime + component.UseDelay;
_actionsSystem.SetCooldown(component.XelthiaRegenerateAction!.Value, start, end); // Cooldown
//IEntityManager entityManager = uid;
var bodySystem = _entityManager.System<BodySystem>();
var transformSystem = _entityManager.System<SharedTransformSystem>();
if (!_entityManager.TryGetComponent(uid, out BodyComponent? body)
|| !_entityManager.TryGetComponent(uid, out TransformComponent? xform))
return;
var root = bodySystem.GetRootPartOrNull(uid, body);
if (root is null)
return;
var parts = bodySystem.GetBodyChildrenOfType(uid, BodyPartType.Arm, body); // Deletes Arms and hands
foreach (var part in parts)
{
foreach (var child in bodySystem.GetBodyPartChildren(part.Id, part.Component))
_entityManager.QueueDeleteEntity(child.Id);
transformSystem.AttachToGridOrMap(part.Id);
_entityManager.QueueDeleteEntity(part.Id);
_entityManager.SpawnAtPosition("FoodMeatXelthiaTentacle", xform.Coordinates); // Should drop arms equal to the number attached
}
// Right Side
var newLimb = _entityManager.SpawnAtPosition("RightArmXelthia", xform.Coordinates); // Copy-Pasted Code for arm spawning
if (_entityManager.TryGetComponent(newLimb, out BodyPartComponent? limbComp))
bodySystem.AttachPart(root.Value.Entity, "right arm", newLimb, root.Value.BodyPart, limbComp);
var newerLimb = _entityManager.SpawnAtPosition("RightHandXelthia", xform.Coordinates); // Spawns the hand
Enum.TryParse<BodyPartType>("Hand", out var partType);
bodySystem.TryCreatePartSlotAndAttach(newLimb, "right hand", newerLimb, partType);
// Left Side
newLimb = _entityManager.SpawnAtPosition("LeftArmXelthia", xform.Coordinates); // Copy-Pasted Code for arm spawning
if (_entityManager.TryGetComponent(newLimb, out BodyPartComponent? limbComp2))
bodySystem.AttachPart(root.Value.Entity, "left arm", newLimb, root.Value.BodyPart, limbComp2);
newerLimb = _entityManager.SpawnAtPosition("LeftHandXelthia", xform.Coordinates); // Spawns the hand
bodySystem.TryCreatePartSlotAndAttach(newLimb, "left hand", newerLimb, partType);
_entityManager.EntitySysManager.GetEntitySystem<SharedAudioSystem>()
.PlayPvs("/Audio/_EE/Voice/Xelthia/regrow.ogg", uid, null);
var solution = new Solution();
TryComp<BloodstreamComponent>(uid, out var stream);
solution.AddReagent("XelthiaArmJuice", 3.5);
_bloodstreamSystem.TryAddToChemicals(uid, solution, stream);
}
}