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

Major Anomaly Core Functionality Overhaul, Pt. 1 #32839

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
52 changes: 52 additions & 0 deletions Content.Server/Explosion/EntitySystems/SmokeOnUseSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using Content.Shared.Explosion.Components;
using Content.Shared.Explosion.EntitySystems;
using Content.Server.Fluids.EntitySystems;
using Content.Server.Spreader;
using Content.Shared.Chemistry.Components;
using Content.Shared.Coordinates.Helpers;
using Content.Shared.Maps;
using Robust.Server.GameObjects;
using Robust.Shared.Map;
using Content.Shared.Interaction.Events;

namespace Content.Server.Explosion.EntitySystems;

public sealed class SmokeOnUseSystem : SharedSmokeOnUseSystem
{
[Dependency] private readonly IMapManager _mapMan = default!;
[Dependency] private readonly SmokeSystem _smoke = default!;
[Dependency] private readonly TransformSystem _transform = default!;
[Dependency] private readonly SpreaderSystem _spreader = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<SmokeOnUseComponent, UseInHandEvent>(OnUseInHand);
}
private void OnUseInHand(EntityUid uid, SmokeOnUseComponent comp, UseInHandEvent args)
{
var xform = Transform(uid);
var mapCoords = _transform.GetMapCoordinates(uid, xform);
if (!_mapMan.TryFindGridAt(mapCoords, out _, out var grid) ||
!grid.TryGetTileRef(xform.Coordinates, out var tileRef) ||
tileRef.Tile.IsEmpty)
{
return;
}

if (_spreader.RequiresFloorToSpread(comp.SmokePrototype.ToString()) && tileRef.Tile.IsSpace())
return;

var coords = grid.MapToGrid(mapCoords);
var ent = Spawn(comp.SmokePrototype, coords.SnapToGrid());
if (!TryComp<SmokeComponent>(ent, out var smoke))
{
Log.Error($"Smoke prototype {comp.SmokePrototype} was missing SmokeComponent");
Del(ent);
return;
}

_smoke.StartSmoke(ent, comp.Solution, comp.Duration, comp.SpreadAmount, smoke);
}
}
39 changes: 39 additions & 0 deletions Content.Shared/Explosion/Components/SmokeOnUseComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Content.Shared.Explosion.EntitySystems;
using Content.Shared.Chemistry.Components;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;

namespace Content.Shared.Explosion.Components;

[RegisterComponent, NetworkedComponent, Access(typeof(SharedSmokeOnUseSystem))]
public sealed partial class SmokeOnUseComponent : Component
{
/// <summary>
/// How long the smoke stays for, after it has spread.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float Duration = 10;

/// <summary>
/// How much the smoke will spread.
/// </summary>
[DataField(required: true), ViewVariables(VVAccess.ReadWrite)]
public int SpreadAmount;

/// <summary>
/// Smoke entity to spawn.
/// Defaults to smoke but you can use foam if you want.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public EntProtoId SmokePrototype = "Smoke";

/// <summary>
/// Solution to add to each smoke cloud.
/// </summary>
/// <remarks>
/// When using repeating trigger this essentially gets multiplied so dont do anything crazy like omnizine or lexorin.
/// </remarks>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public Solution Solution = new();
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace Content.Shared.Explosion.EntitySystems;

public abstract class SharedSmokeOnUseSystem : EntitySystem
{
}
59 changes: 59 additions & 0 deletions Resources/Prototypes/Entities/Objects/Consumable/Food/meat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,36 @@
- ReagentId: Water
Quantity: 4 #It makes saline if you add salt!

- type: entity
name: anomalous meat mass
parent: FoodMeatRawBase
id: FoodMeatAnomaly
description: An impossibly dense slab of meat. Just looking at it makes you uncomfortable.
components:
- type: Sprite
state: anomalymeat
- type: SolutionContainerManager
solutions:
food:
reagents:
- ReagentId: UncookedAnimalProteins
Quantity: 90
- ReagentId: Fat
Quantity: 90
- type: SliceableFood
count: 10
sliceTime: 5
slice: FoodMeat #That's... So much meat
- type: InternalTemperature
conductivity: 0.43
- type: Construction
graph: AnomalyMeatSteak
node: start
defaultTarget: anomaly steak
- type: Tag
tags:
- Meat

# Cooked

- type: entity
Expand Down Expand Up @@ -1172,6 +1202,35 @@
Burger: MeatSnail
Taco: MeatSnail

- type: entity
name: anomaly steak
parent: FoodMeatBase
id: FoodMeatAnomalyCooked
description: A gigantic mass of cooked meat. A meal for a dinner party, or someone REALLY hungry.
components:
- type: Tag
tags:
- Cooked
- Meat
- type: Sprite
layers:
- state: anomalymeat-cooked #Kinda hard to cook this... thing evenly
- type: SolutionContainerManager
solutions:
food:
reagents:
- ReagentId: Nutriment
Quantity: 100
- ReagentId: Protein
Quantity: 50
- type: SliceableFood
count: 10
sliceTime: 5
slice: FoodMeatCooked
- type: Construction
graph: AnomalyMeatSteak
node: anomaly steak

# Cutlets

# Raw
Expand Down
Loading
Loading