Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chitinid (From Delta-V) #1644

Merged
merged 31 commits into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
aa46d20
Chitinid (#2707)
ElusiveCoin Jan 23, 2025
37fce09
Move to DeltaV
sleepyyapril Jan 23, 2025
537c7a2
Fix location
sleepyyapril Jan 23, 2025
292899e
Merge branch 'master' into species-max
sleepyyapril Jan 23, 2025
86874c1
outdated...
sleepyyapril Jan 23, 2025
40df96a
Merge branch 'species-max' of https://github.com/sleepyyapril/Einstei…
sleepyyapril Jan 23, 2025
63fa069
Fix yml?
sleepyyapril Jan 23, 2025
7e820ad
felinid kill
sleepyyapril Jan 23, 2025
17080fa
yay!
sleepyyapril Jan 23, 2025
3afc1cc
work?
sleepyyapril Jan 23, 2025
5042179
fix...
sleepyyapril Jan 23, 2025
bbb3b39
!
sleepyyapril Jan 23, 2025
fc255bb
Add slowdown to low temperatures (#29692)
EmoGarbage404 Aug 5, 2024
f0f9bc1
remove things
sleepyyapril Jan 23, 2025
4d80be8
deep fryer.
sleepyyapril Jan 23, 2025
92f155f
fix
sleepyyapril Jan 23, 2025
9e6d2f4
use old code!
sleepyyapril Jan 23, 2025
9bb975a
max guidebook
sleepyyapril Jan 23, 2025
c4226ac
rename
sleepyyapril Jan 23, 2025
8e5f36e
reverted EVERY change!
sleepyyapril Jan 24, 2025
4c493b0
Update Resources/Prototypes/DeltaV/Actions/types.yml
sleepyyapril Jan 25, 2025
4d658b5
Update Resources/Locale/en-US/chemistry/components/injector-component…
sleepyyapril Jan 25, 2025
907121c
Merge branch 'master' of https://github.com/Simple-Station/Einstein-E…
sleepyyapril Jan 25, 2025
aaba2c4
Merge branch 'species-max' of https://github.com/sleepyyapril/Einstei…
sleepyyapril Jan 25, 2025
05c713d
Block reason
sleepyyapril Jan 25, 2025
7eb6f4d
Deny reason generalization
sleepyyapril Jan 25, 2025
7a5e960
Oops
sleepyyapril Jan 25, 2025
4a4048c
New Chittin language
sleepyyapril Jan 25, 2025
12d5d47
Finish Chittin
sleepyyapril Jan 25, 2025
a5134b2
alright fuck you heisentest
sleepyyapril Jan 25, 2025
2792e41
Merge branch 'master' into species-max
sleepyyapril Jan 25, 2025
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 Content.Server/Chemistry/EntitySystems/InjectorSystem.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Content.Server.Abilities.Chitinid;
using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Shared.Chemistry;
Expand Down Expand Up @@ -114,6 +115,12 @@ private void OnInjectorAfterInteract(Entity<InjectorComponent> entity, ref After
/// </summary>
private void InjectDoAfter(Entity<InjectorComponent> injector, EntityUid target, EntityUid user)
{
if (HasComp<BlockInjectionComponent>(target)) // DeltaV
{
Popup.PopupEntity(Loc.GetString("injector-component-deny-user"), target, user);
return;
}

// Create a pop-up for the user
if (injector.Comp.ToggleState == InjectorToggleMode.Draw)
{
Expand Down Expand Up @@ -254,6 +261,9 @@ private void TryInjectIntoBloodstream(Entity<InjectorComponent> injector, Entity
private void TryInject(Entity<InjectorComponent> injector, EntityUid targetEntity,
Entity<SolutionComponent> targetSolution, EntityUid user, bool asRefill)
{
if (HasComp<BlockInjectionComponent>(targetEntity)) // DeltaV
return;

if (!SolutionContainers.TryGetSolution(injector.Owner, injector.Comp.SolutionName, out var soln,
out var solution) || solution.Volume == 0)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Content.Server.Administration.Logs;
using Content.Server.Construction.Components;
using Content.Server.Temperature.Components;
using Content.Server.Temperature.Systems;
using Content.Shared.Construction;
using Content.Shared.Construction.Components;
using Content.Shared.Construction.EntitySystems;
Expand All @@ -11,6 +10,7 @@
using Content.Shared.Interaction;
using Content.Shared.Prying.Systems;
using Content.Shared.Radio.EntitySystems;
using Content.Shared.Temperature;
using Content.Shared.Tools.Systems;
using Robust.Shared.Containers;
using Robust.Shared.Utility;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Content.Server.Administration.Logs;
using Content.Server.Audio;
Expand All @@ -15,8 +15,10 @@
using Content.Server.Popups;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Server.Storage.EntitySystems;
using Content.Server.Temperature.Components;
using Content.Server.Temperature.Systems;
using Content.Server.UserInterface;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.EntitySystems;
Expand All @@ -39,7 +41,6 @@
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.Movement.Events;
using Content.Shared.Nutrition;
using Content.Shared.Nyanotrasen.Kitchen;
using Content.Shared.Nyanotrasen.Kitchen.Components;
using Content.Shared.Nyanotrasen.Kitchen.UI;
Expand All @@ -56,7 +57,6 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Timing;
using Robust.Shared.Physics.Components;

namespace Content.Server.Nyanotrasen.Kitchen.EntitySystems;

Expand Down Expand Up @@ -105,15 +105,12 @@ public override void Initialize()

SubscribeLocalEvent<DeepFryerComponent, ComponentInit>(OnInitDeepFryer);
SubscribeLocalEvent<DeepFryerComponent, PowerChangedEvent>(OnPowerChange);
SubscribeLocalEvent<DeepFryerComponent, RefreshPartsEvent>(OnRefreshParts);
SubscribeLocalEvent<DeepFryerComponent, MachineDeconstructedEvent>(OnDeconstruct);
SubscribeLocalEvent<DeepFryerComponent, DestructionEventArgs>(OnDestruction);
SubscribeLocalEvent<DeepFryerComponent, ThrowHitByEvent>(OnThrowHitBy);
SubscribeLocalEvent<DeepFryerComponent, SolutionChangedEvent>(OnSolutionChange);
SubscribeLocalEvent<DeepFryerComponent, ContainerRelayMovementEntityEvent>(OnRelayMovement);
SubscribeLocalEvent<DeepFryerComponent, InteractUsingEvent>(OnInteractUsing);
SubscribeLocalEvent<DeepFryerComponent, CanDropTargetEvent>(OnCanDragDropOn);
SubscribeLocalEvent<DeepFryerComponent, DragDropTargetEvent>(OnDragDropOn);

SubscribeLocalEvent<DeepFryerComponent, BeforeActivatableUIOpenEvent>(OnBeforeActivatableUIOpen);
SubscribeLocalEvent<DeepFryerComponent, DeepFryerRemoveItemMessage>(OnRemoveItem);
Expand All @@ -127,6 +124,24 @@ public override void Initialize()
SubscribeLocalEvent<DeepFriedComponent, ExaminedEvent>(OnExamineFried);
SubscribeLocalEvent<DeepFriedComponent, PriceCalculationEvent>(OnPriceCalculation);
SubscribeLocalEvent<DeepFriedComponent, FoodSlicedEvent>(OnSliceDeepFried);

SubscribeLocalEvent<DeepFryerComponent, CanDropTargetEvent>(OnCanDragDropOn);
SubscribeLocalEvent<DeepFryerComponent, DragDropTargetEvent>(OnDragDropOn);
SubscribeLocalEvent<DeepFryerComponent, RefreshPartsEvent>(OnRefreshParts);
}

private void OnRefreshParts(EntityUid uid, DeepFryerComponent component, RefreshPartsEvent args)
{
var ratingStorage = args.PartRatings[component.MachinePartStorageMax];

component.StorageMaxEntities = component.BaseStorageMaxEntities +
(int) (component.StoragePerPartRating * (ratingStorage - 1));
}

private void OnDragDropOn(EntityUid uid, DeepFryerComponent component, ref DragDropTargetEvent args)
{
_containerSystem.Insert(args.Dragged, component.Storage);
args.Handled = true;
}

private void UpdateUserInterface(EntityUid uid, DeepFryerComponent component)
Expand All @@ -137,7 +152,7 @@ private void UpdateUserInterface(EntityUid uid, DeepFryerComponent component)
component.FryingOilThreshold,
EntityManager.GetNetEntityArray(component.Storage.ContainedEntities.ToArray()));

_uiSystem.SetUiState(new Entity<UserInterfaceComponent?>(uid, null), DeepFryerUiKey.Key, state);
_uiSystem.SetUiState(uid, DeepFryerUiKey.Key, state);
}

/// <summary>
Expand Down Expand Up @@ -167,12 +182,6 @@ public FixedPoint2 GetOilVolume(EntityUid uid, DeepFryerComponent component)
return oilVolume;
}

private void OnDragDropOn(EntityUid uid, DeepFryerComponent component, ref DragDropTargetEvent args)
{
_containerSystem.Insert(args.Dragged, component.Storage);
args.Handled = true;
}

/// <summary>
/// Returns how much total waste is in the vat.
/// </summary>
Expand Down Expand Up @@ -214,7 +223,7 @@ private void CookItem(EntityUid uid, DeepFryerComponent component, EntityUid ite
if (TryComp<TemperatureComponent>(item, out var tempComp))
{
// Push the temperature towards what it should be but no higher.
var delta = (component.PoweredTemperature - tempComp.CurrentTemperature) * tempComp.HeatCapacity;
var delta = (component.PoweredTemperature - tempComp.CurrentTemperature) * _temperature.GetHeatCapacity(item, tempComp);

if (delta > 0f)
_temperature.ChangeHeat(item, delta, false, tempComp);
Expand Down Expand Up @@ -347,12 +356,12 @@ private void DeepFry(EntityUid uid, DeepFryerComponent component, EntityUid item

MakeCrispy(item);

var oilToUse = 0;
var itemComponent = Comp<ItemComponent>(item);

if (HasComp<ItemComponent>(item)) {
var itemComponent = Comp<ItemComponent>(item);

oilToUse = (int) (itemComponent.Size.Id switch
// Determine how much solution to spend on this item.
var solutionQuantity = FixedPoint2.Min(
component.Solution.Volume,
itemComponent.Size.Id switch
{
"Tiny" => 1,
"Small" => 5,
Expand All @@ -362,15 +371,6 @@ private void DeepFry(EntityUid uid, DeepFryerComponent component, EntityUid item
"Ginormous" => 50,
_ => 10
} * component.SolutionSizeCoefficient);
} else {
oilToUse = (int) (TryComp<PhysicsComponent>(item, out var physicsComponent) ? physicsComponent.Mass : 10);
}

// Determine how much solution to spend on this item.
var solutionQuantity = FixedPoint2.Min(
component.Solution.Volume,
oilToUse
);

if (component.Whitelist != null && _whitelistSystem.IsWhitelistPass(component.Whitelist, item) ||
beingEvent.TurnIntoFood)
Expand Down Expand Up @@ -400,6 +400,7 @@ private void OnInitDeepFryer(EntityUid uid, DeepFryerComponent component, Compon
{
//JJ Comment - not sure this works. Need to check if Reagent.ToString is correct.
_prototypeManager.TryIndex<ReagentPrototype>(reagent.Reagent.ToString(), out var proto);

var effectsArgs = new EntityEffectReagentArgs(uid,
EntityManager,
null,
Expand Down Expand Up @@ -453,14 +454,6 @@ private void OnDestruction(EntityUid uid, DeepFryerComponent component, Destruct
_containerSystem.EmptyContainer(component.Storage, true);
}

private void OnRefreshParts(EntityUid uid, DeepFryerComponent component, RefreshPartsEvent args)
{
var ratingStorage = args.PartRatings[component.MachinePartStorageMax];

component.StorageMaxEntities = component.BaseStorageMaxEntities +
(int) (component.StoragePerPartRating * (ratingStorage - 1));
}

/// <summary>
/// Allow thrown items to land in a basket.
/// </summary>
Expand Down Expand Up @@ -522,6 +515,7 @@ private void OnSolutionChange(EntityUid uid, DeepFryerComponent component, Solut
private void OnRelayMovement(EntityUid uid, DeepFryerComponent component,
ref ContainerRelayMovementEntityEvent args)
{

if (!_containerSystem.Remove(args.Entity, component.Storage, destination: Transform(uid).Coordinates))
return;

Expand All @@ -548,7 +542,7 @@ private void OnRemoveItem(EntityUid uid, DeepFryerComponent component, DeepFryer
if (!_containerSystem.Remove(removedItem, component.Storage))
return;

var user = EntityManager.GetEntity(args.Entity);
var user = args.Actor;

_handsSystem.TryPickupAnyHand(user, removedItem);

Expand Down Expand Up @@ -601,9 +595,10 @@ private bool TryGetActiveHandSolutionContainer(

private void OnScoopVat(EntityUid uid, DeepFryerComponent component, DeepFryerScoopVatMessage args)
{
var user = EntityManager.GetEntity(args.Entity);
var user = args.Actor;

if (!TryGetActiveHandSolutionContainer(uid, user, out var heldItem, out var heldSolution,
if (user == null ||
!TryGetActiveHandSolutionContainer(uid, user, out var heldItem, out var heldSolution,
out var transferAmount))
return;

Expand All @@ -622,7 +617,7 @@ private void OnScoopVat(EntityUid uid, DeepFryerComponent component, DeepFryerSc

private void OnClearSlagStart(EntityUid uid, DeepFryerComponent component, DeepFryerClearSlagMessage args)
{
var user = EntityManager.GetEntity(args.Entity);
var user = args.Actor;

if (!TryGetActiveHandSolutionContainer(uid, user, out var heldItem, out var heldSolution,
out var transferAmount))
Expand All @@ -639,7 +634,7 @@ private void OnClearSlagStart(EntityUid uid, DeepFryerComponent component, DeepF
return;
}

var delay = Math.Clamp((float) wasteVolume * 0.1f, 1f, 5f);
var delay = TimeSpan.FromSeconds(Math.Clamp((float) wasteVolume * 0.1f, 1f, 5f));

var ev = new ClearSlagDoAfterEvent(heldSolution.Value.Comp.Solution, transferAmount);

Expand All @@ -655,14 +650,15 @@ private void OnClearSlagStart(EntityUid uid, DeepFryerComponent component, DeepF
_doAfterSystem.TryStartDoAfter(doAfterArgs);
}

[Obsolete("Obsolete")]
private void OnRemoveAllItems(EntityUid uid, DeepFryerComponent component, DeepFryerRemoveAllItemsMessage args)
{
if (component.Storage.ContainedEntities.Count == 0)
return;

_containerSystem.EmptyContainer(component.Storage);

var user = EntityManager.GetEntity(args.Entity);
var user = args.Actor;

_adminLogManager.Add(LogType.Action, LogImpact.Low,
$"{ToPrettyString(user)} removed all items from {ToPrettyString(uid)}.");
Expand Down
14 changes: 2 additions & 12 deletions Content.Server/Temperature/Components/TemperatureComponent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Content.Server.Temperature.Systems;
using Content.Shared.Alert;
using Content.Shared.Atmos;
using Content.Shared.Damage;
Expand Down Expand Up @@ -51,15 +50,6 @@ public sealed partial class TemperatureComponent : Component
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float AtmosTemperatureTransferEfficiency = 0.1f;

[Obsolete("Use system method")]
public float HeatCapacity
{
get
{
return IoCManager.Resolve<IEntityManager>().System<TemperatureSystem>().GetHeatCapacity(Owner, this);
}
}

[DataField, ViewVariables(VVAccess.ReadWrite)]
public DamageSpecifier ColdDamage = new();

Expand All @@ -71,15 +61,15 @@ public float HeatCapacity
/// </summary>
/// <remarks>
/// Okay it genuinely reaches this basically immediately for a plasma fire.
/// </summary>
/// </remarks>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public FixedPoint2 DamageCap = FixedPoint2.New(8);

/// <summary>
/// Used to keep track of when damage starts/stops. Useful for logs.
/// </summary>
[DataField]
public bool TakingDamage = false;
public bool TakingDamage;

[DataField]
public ProtoId<AlertPrototype> HotAlert = "Hot";
Expand Down
14 changes: 0 additions & 14 deletions Content.Server/Temperature/Systems/TemperatureSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -414,17 +414,3 @@ private void RecalculateAndApplyParentThresholds(EntityUid uid,
return (newHeatThreshold, newColdThreshold);
}
}

public sealed class OnTemperatureChangeEvent : EntityEventArgs
{
public float CurrentTemperature { get; }
public float LastTemperature { get; }
public float TemperatureDelta { get; }

public OnTemperatureChangeEvent(float current, float last, float delta)
{
CurrentTemperature = current;
LastTemperature = last;
TemperatureDelta = delta;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespace Content.Server.Abilities.Chitinid;

[RegisterComponent]
public sealed partial class BlockInjectionComponent : Component;
41 changes: 41 additions & 0 deletions Content.Server/_DV/Abilities/Chitinid/ChitinidComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.FixedPoint;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;

namespace Content.Server.Abilities.Chitinid;

[RegisterComponent]
public sealed partial class ChitinidComponent : Component
{
[DataField]
public EntProtoId ChitzitePrototype = "Chitzite";

[DataField]
public EntProtoId ChitziteActionId = "ActionChitzite";

[DataField]
public EntityUid? ChitziteAction;

[DataField]
public FixedPoint2 AmountAbsorbed = 0f;

[DataField]
public DamageSpecifier Healing = new()
{
DamageDict = new()
{
{ "Radiation", -0.5 },
}
};

[DataField]
public FixedPoint2 MaximumAbsorbed = 30f;

[DataField]
public TimeSpan UpdateInterval = TimeSpan.FromSeconds(1);

[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan NextUpdate;
}
Loading
Loading