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

Upstream sync #2504

Merged
merged 108 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
cc445e0
Update some food spawners w/ entity tables (#30957)
IamVelcroboy Aug 16, 2024
79ae2cc
Add sound for turning on grill (#31099)
themias Aug 17, 2024
9775975
Disabler SMG no longer fits in boots (#31110)
Blackern5000 Aug 17, 2024
3cf2fca
Automatic changelog update
PJBot Aug 17, 2024
63762d8
Fixs suffocation alerts not appearing. (#31115)
Mervill Aug 17, 2024
20786c1
Automatic changelog update
PJBot Aug 17, 2024
4ee9c00
Localization hud layout (#31013)
chavonadelal Aug 17, 2024
2779311
Plants scream mutation now have more scream variety (#30862)
TokenStyle Aug 17, 2024
9f59516
Automatic changelog update
PJBot Aug 17, 2024
969f17a
phlog now ignites when consumed as well (#30955)
Boaz1111 Aug 17, 2024
9343023
Automatic changelog update
PJBot Aug 17, 2024
4692c69
Remove obsolete functions from `RadiationDebugOverlay` (#31111)
Mervill Aug 17, 2024
7066b4a
Modified bone-spear to correctly break into 1-2 bones when breaking (…
thetolbean Aug 17, 2024
aa9bf9f
Fix bluespace anomaly teleporting borg brains and PAIs in container s…
slarticodefast Aug 17, 2024
38e698e
Automatic changelog update
PJBot Aug 17, 2024
1e7fb2f
Fix npcs throwing themselves straight into space (#31118)
EmoGarbage404 Aug 17, 2024
8440fb6
anonymize salvage wrecks (#31087)
EmoGarbage404 Aug 17, 2024
7562b8f
Automatic changelog update
PJBot Aug 17, 2024
ada6455
Make printing from ore procecssors slightly more bearable (#31074)
EmoGarbage404 Aug 17, 2024
633099e
Automatic changelog update
PJBot Aug 17, 2024
3ce8f16
Updated cog (#31117)
Spessmann Aug 17, 2024
5cc2b12
standardize map protos and fill gaps (#31120)
Emisse Aug 17, 2024
3091893
Fix msCompile problem matcher on VScode on Windows (#31068)
TemporalOroboros Aug 17, 2024
f13e4c3
derotate train while i work on it (#31121)
Emisse Aug 17, 2024
ef3de39
Add croissant recipe (#30825)
themias Aug 17, 2024
979661a
Automatic changelog update
PJBot Aug 17, 2024
9d62570
Red crowbars no longer fit in pockets (#30939)
UbaserB Aug 17, 2024
c3b3955
Automatic changelog update
PJBot Aug 17, 2024
a4b0bef
add confirmation to the delete button in objects tab (#30946)
MilonPL Aug 17, 2024
71ef47f
Automatic changelog update
PJBot Aug 17, 2024
1f62232
Cog update (#31129)
Spessmann Aug 17, 2024
ad4d36f
Replace obsolete map functions in disposals code (#31133)
Mervill Aug 17, 2024
9c9bfda
Fix botany bugs (#27210)
Crotalus Aug 18, 2024
16e1c23
Update Credits (#31141)
github-actions[bot] Aug 18, 2024
f09dd46
Cog update (#31148)
Spessmann Aug 18, 2024
1545fd5
fix(fland): Connect the Cell Window Shutters remote signaler to the C…
Brandon-Huu Aug 18, 2024
047a7a4
fix some salvage spawner oversights (#31114)
EmoGarbage404 Aug 18, 2024
77a60bd
bagel update (#31150)
Emisse Aug 18, 2024
517f7ad
Fixed IP bans preventing non-banned players from connecting to SQLite…
TGRCdev Aug 18, 2024
031ddc0
Guidebook typo fixes (#31159)
iztokbajcar Aug 18, 2024
0d969f6
Automatic changelog update
PJBot Aug 18, 2024
7d48cc5
Add atmos directional sign (#31155)
SlamBamActionman Aug 18, 2024
7333141
Coughing and coughing changes (#30893)
Unkn0wnGh0st333 Aug 18, 2024
d673bdf
Automatic changelog update
PJBot Aug 18, 2024
a540b88
Goliath mob (#30839)
EmoGarbage404 Aug 18, 2024
0c078f6
Automatic changelog update
PJBot Aug 18, 2024
f7fd991
Cog updates (#31169)
Spessmann Aug 18, 2024
529f4da
bagel update (#31172)
Emisse Aug 18, 2024
78b3e32
Cutting food now moves the food a little bit. (#31166)
beck-thompson Aug 18, 2024
d38d497
Automatic changelog update
PJBot Aug 18, 2024
c636b3b
Update Oasis (#31174)
IProduceWidgets Aug 18, 2024
d0bd26d
pizza and pizza box tweaks (#31171)
lzk228 Aug 18, 2024
8830e26
small figurines voicelines update (#31167)
lzk228 Aug 18, 2024
2dfcd5c
Automatic changelog update
PJBot Aug 18, 2024
878384d
Sharks Go RAWR! (#31142)
Deatherd Aug 18, 2024
b4ef1e9
Automatic changelog update
PJBot Aug 18, 2024
4fcbb99
Fix collidable held entities blocking themselves while being dropped …
DrSmugleaf Aug 18, 2024
86b358b
Fix raditation collectors gaslighting you (#31175)
slarticodefast Aug 18, 2024
900e57c
Added LV power cables to Marathon library (#31131)
thetolbean Aug 18, 2024
7f5c11a
Automatic changelog update
PJBot Aug 18, 2024
1952618
Tea Plant and Blue Pumpkin (#25092)
potato1234x Aug 18, 2024
6cda6c8
Automatic changelog update
PJBot Aug 18, 2024
ad69193
add memory cell and rework logic construction (#24983)
deltanedas Aug 18, 2024
3cb67a3
Automatic changelog update
PJBot Aug 18, 2024
c48a96a
Trim punctuation marks in the chat emote system (#28612)
geraeumig Aug 18, 2024
9a68cf0
Re-add improved random sentience event (#29123)
Psychpsyo Aug 18, 2024
03f5bf4
Automatic changelog update
PJBot Aug 18, 2024
d9e0681
make ore indestructible (#31182)
EmoGarbage404 Aug 19, 2024
c9854c3
Automatic changelog update
PJBot Aug 19, 2024
3dcfe0d
fix mice and revs being able to toggle suit pieces (#31152)
slarticodefast Aug 19, 2024
7e3b9fb
Allow a specific hand to be passed into TrySpawnVirtualItemInHand (#3…
DrSmugleaf Aug 19, 2024
0754a0f
Automatic changelog update
PJBot Aug 19, 2024
864956c
Pancakes Fix (#31123)
Goldminermac Aug 19, 2024
45b0543
Automatic changelog update
PJBot Aug 19, 2024
68d6506
Made hydroponics alert light more orange (#31088)
tosatur Aug 19, 2024
a2c762d
Automatic changelog update
PJBot Aug 19, 2024
9240786
Fix news management console access checks (#31160)
redmushie Aug 19, 2024
19b0ce3
Automatic changelog update
PJBot Aug 19, 2024
91e2fdc
Fix news management console publish timeout activating when nothing w…
redmushie Aug 19, 2024
529e4b7
Added a pitcher for the chef to use in serving beverages (#31105)
Moomoobeef Aug 19, 2024
db427dc
Fix cooking sizzle noise (#31096)
themias Aug 19, 2024
3e15e00
fix admin pda health analyzer popup (#31097)
MilonPL Aug 19, 2024
edc9162
fix selfunremoveable component being bypassed by hand pickup verb (#3…
EmoGarbage404 Aug 19, 2024
da3c3b5
Automatic changelog update
PJBot Aug 19, 2024
0a05ee9
add space carp and sharkminnow teeth (#31070)
EmoGarbage404 Aug 19, 2024
171884d
Tweaking things that restrict freedom (#31095)
chavonadelal Aug 19, 2024
ebf62aa
Automatic changelog update
PJBot Aug 19, 2024
ed3e107
New Projectile Effect:Temperature Change (#31004)
Boaz1111 Aug 19, 2024
f272097
Device-list limiting (#30997)
Magicalus Aug 19, 2024
e2ecd80
Automatic changelog update
PJBot Aug 19, 2024
2577eb1
Guidebook updates for Antagonist entries (#31075)
UBlueberry Aug 19, 2024
9b8e30a
Automatic changelog update
PJBot Aug 19, 2024
1c29310
ERT chaplains can now use bibles (#30993)
TheWaffleJesus Aug 19, 2024
1ba508a
Automatic changelog update
PJBot Aug 19, 2024
802d478
Security Helmet Reshape (#30961)
DieselMohawk Aug 19, 2024
dd36c85
add(AdminGhost): Add a multitool to the admin ghost backpack (#31002)
Brandon-Huu Aug 19, 2024
d11a4ba
Automatic changelog update
PJBot Aug 19, 2024
18c146c
increase material prices (#30869)
EmoGarbage404 Aug 19, 2024
7ba049b
Convert bookshelves from StorageFill to EntityTables (#30895)
Plykiya Aug 19, 2024
1a3dc66
Automatic changelog update
PJBot Aug 19, 2024
94c746a
Minor vox customization update: new hairstyles & facial hair (#30815)
Flareguy Aug 19, 2024
1fa447f
Automatic changelog update
PJBot Aug 19, 2024
476c775
Recycler Overhaul (#30802)
EmoGarbage404 Aug 19, 2024
2c98d0a
clarify what is an important role in rule 12 (#30818)
Killerqu00 Aug 19, 2024
e85ab91
Automatic changelog update
PJBot Aug 19, 2024
8572f60
Merge remote-tracking branch 'refs/remotes/upstream/master' into upst…
Morb0 Aug 19, 2024
3a9aa64
Remove duplicate from diasses emotes
Morb0 Aug 19, 2024
8c43b69
Update locale
Morb0 Aug 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"args": [
"build",
"/property:GenerateFullPaths=true", // Ask dotnet build to generate full paths for file names.
"/consoleloggerparameters:NoSummary" // Do not generate summary otherwise it leads to duplicate errors in Problems panel
"/consoleloggerparameters:'ForceNoAlign;NoSummary'" // Do not generate summary otherwise it leads to duplicate errors in Problems panel
],
"group": {
"kind": "build",
Expand All @@ -29,9 +29,9 @@
"build",
"${workspaceFolder}/Content.YAMLLinter/Content.YAMLLinter.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
"/consoleloggerparameters:'ForceNoAlign;NoSummary'"
],
"problemMatcher": "$msCompile"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Client.Administration.Managers;
using Content.Client.Administration.Managers;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
Expand All @@ -13,6 +13,7 @@ public sealed partial class ObjectsTabEntry : PanelContainer

public Action<NetEntity>? OnTeleport;
public Action<NetEntity>? OnDelete;
private readonly Dictionary<Button, ConfirmationData> _confirmations = new();

public ObjectsTabEntry(IClientAdminManager manager, string name, NetEntity nent, StyleBox styleBox)
{
Expand All @@ -27,6 +28,13 @@ public ObjectsTabEntry(IClientAdminManager manager, string name, NetEntity nent,
DeleteButton.Disabled = !manager.CanCommand("delete");

TeleportButton.OnPressed += _ => OnTeleport?.Invoke(nent);
DeleteButton.OnPressed += _ => OnDelete?.Invoke(nent);
DeleteButton.OnPressed += _ =>
{
if (!AdminUIHelpers.TryConfirm(DeleteButton, _confirmations))
{
return;
}
OnDelete?.Invoke(nent);
};
}
}
10 changes: 10 additions & 0 deletions Content.Client/Lathe/UI/LatheMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ public void SetEntity(EntityUid uid)
MaterialsList.SetOwner(Entity);
}

protected override void Opened()
{
base.Opened();

if (_entityManager.TryGetComponent<LatheComponent>(Entity, out var latheComp))
{
AmountLineEdit.SetText(latheComp.DefaultProductionAmount.ToString());
}
}

/// <summary>
/// Populates the list of all the recipes
/// </summary>
Expand Down
27 changes: 27 additions & 0 deletions Content.Client/Materials/RecyclerVisualizerSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Content.Shared.Conveyor;
using Content.Shared.Materials;
using Robust.Client.GameObjects;

namespace Content.Client.Materials;

public sealed class RecyclerVisualizerSystem : VisualizerSystem<RecyclerVisualsComponent>
{
protected override void OnAppearanceChange(EntityUid uid, RecyclerVisualsComponent component, ref AppearanceChangeEvent args)
{
if (args.Sprite == null || !args.Sprite.LayerMapTryGet(RecyclerVisualLayers.Main, out var layer))
return;

AppearanceSystem.TryGetData<ConveyorState>(uid, ConveyorVisuals.State, out var running);
AppearanceSystem.TryGetData<bool>(uid, RecyclerVisuals.Bloody, out var bloody);
AppearanceSystem.TryGetData<bool>(uid, RecyclerVisuals.Broken, out var broken);

var activityState = running == ConveyorState.Off ? 0 : 1;
if (broken) //breakage overrides activity
activityState = 2;

var bloodyKey = bloody ? component.BloodyKey : string.Empty;

var state = $"{component.BaseKey}{activityState}{bloodyKey}";
args.Sprite.LayerSetState(layer, state);
}
}
17 changes: 17 additions & 0 deletions Content.Client/Materials/RecyclerVisualsComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace Content.Client.Materials;

[RegisterComponent]
public sealed partial class RecyclerVisualsComponent : Component
{
/// <summary>
/// Key appended to state string if bloody.
/// </summary>
[DataField]
public string BloodyKey = "bld";

/// <summary>
/// Base key for the visual state.
/// </summary>
[DataField]
public string BaseKey = "grinder-o";
}
2 changes: 1 addition & 1 deletion Content.Client/Options/UI/Tabs/MiscTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public MiscTab()
var layoutEntries = new List<OptionDropDownCVar<string>.ValueOption>();
foreach (var layout in Enum.GetValues(typeof(ScreenType)))
{
layoutEntries.Add(new OptionDropDownCVar<string>.ValueOption(layout.ToString()!, layout.ToString()!));
layoutEntries.Add(new OptionDropDownCVar<string>.ValueOption(layout.ToString()!, Loc.GetString($"ui-options-hud-layout-{layout.ToString()!.ToLower()}")));
}

// Channel can be null in replays so.
Expand Down
10 changes: 6 additions & 4 deletions Content.Client/Radiation/Overlays/RadiationDebugOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace Content.Client.Radiation.Overlays;
public sealed class RadiationDebugOverlay : Overlay
{
[Dependency] private readonly IEntityManager _entityManager = default!;
private readonly SharedMapSystem _mapSystem;
private readonly RadiationSystem _radiation;

private readonly Font _font;
Expand All @@ -21,6 +22,7 @@ public RadiationDebugOverlay()
{
IoCManager.InjectDependencies(this);
_radiation = _entityManager.System<RadiationSystem>();
_mapSystem = _entityManager.System<SharedMapSystem>();

var cache = IoCManager.Resolve<IResourceCache>();
_font = new VectorFont(cache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 8);
Expand Down Expand Up @@ -67,7 +69,7 @@ private void DrawScreenRays(OverlayDrawArgs args)

foreach (var (tile, rads) in blockers)
{
var worldPos = grid.GridTileToWorldPos(tile);
var worldPos = _mapSystem.GridTileToWorldPos(gridUid, grid, tile);
var screenCenter = args.ViewportControl.WorldToScreen(worldPos);
handle.DrawString(_font, screenCenter, rads.ToString("F2"), 1.5f, Color.White);
}
Expand Down Expand Up @@ -95,8 +97,8 @@ private void DrawScreenResistance(OverlayDrawArgs args)
var offset = new Vector2(grid.TileSize, -grid.TileSize) * 0.25f;
foreach (var (tile, value) in resMap)
{
var localPos = grid.GridTileToLocal(tile).Position + offset;
var worldPos = grid.LocalToWorld(localPos);
var localPos = _mapSystem.GridTileToLocal(gridUid, grid, tile).Position + offset;
var worldPos = _mapSystem.LocalToWorld(gridUid, grid, localPos);
var screenCenter = args.ViewportControl.WorldToScreen(worldPos);
handle.DrawString(_font, screenCenter, value.ToString("F2"), color: Color.White);
}
Expand Down Expand Up @@ -129,7 +131,7 @@ private void DrawWorld(in OverlayDrawArgs args)
if (!_entityManager.TryGetComponent<MapGridComponent>(gridUid, out var grid))
continue;
var (destTile, _) = blockers.Last();
var destWorld = grid.GridTileToWorldPos(destTile);
var destWorld = _mapSystem.GridTileToWorldPos(gridUid, grid, destTile);
handle.DrawLine(ray.Source, destWorld, Color.Red);
}
}
Expand Down
27 changes: 26 additions & 1 deletion Content.Client/Salvage/UI/SalvageMagnetBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Linq;
using Content.Client.Message;
using Content.Shared.Salvage;
using Content.Shared.Salvage.Magnet;
using Robust.Client.UserInterface;
Expand Down Expand Up @@ -99,7 +100,31 @@ protected override void UpdateState(BoundUserInterfaceState state)

break;
case SalvageOffering salvage:
option.Title = Loc.GetString($"salvage-map-proto-{salvage.SalvageMap.ID}");
option.Title = Loc.GetString($"salvage-map-wreck");

var salvContainer = new BoxContainer
{
Orientation = BoxContainer.LayoutOrientation.Horizontal,
HorizontalExpand = true,
};

var sizeLabel = new Label
{
Text = Loc.GetString("salvage-map-wreck-desc-size"),
HorizontalAlignment = Control.HAlignment.Left,
};

var sizeValueLabel = new RichTextLabel
{
HorizontalAlignment = Control.HAlignment.Right,
HorizontalExpand = true,
};
sizeValueLabel.SetMarkup(Loc.GetString(salvage.SalvageMap.SizeString));

salvContainer.AddChild(sizeLabel);
salvContainer.AddChild(sizeValueLabel);

option.AddContent(salvContainer);
break;
default:
throw new ArgumentOutOfRangeException();
Expand Down
17 changes: 1 addition & 16 deletions Content.Server/Actions/ActionOnInteractSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,21 +154,6 @@ private void OnAfterInteract(EntityUid uid, ActionOnInteractComponent component,
args.Handled = true;
}

private bool ValidAction(BaseActionComponent action, bool canReach = true)
{
if (!action.Enabled)
return false;

if (action.Charges.HasValue && action.Charges <= 0)
return false;

var curTime = _timing.CurTime;
if (action.Cooldown.HasValue && action.Cooldown.Value.End > curTime)
return false;

return canReach || action is BaseTargetActionComponent { CheckCanAccess: false };
}

private List<(EntityUid Id, T Comp)> GetValidActions<T>(List<EntityUid>? actions, bool canReach = true) where T : BaseActionComponent
{
var valid = new List<(EntityUid Id, T Comp)>();
Expand All @@ -180,7 +165,7 @@ private bool ValidAction(BaseActionComponent action, bool canReach = true)
{
if (!_actions.TryGetActionData(id, out var baseAction) ||
baseAction as T is not { } action ||
!ValidAction(action, canReach))
!_actions.ValidAction(action, canReach))
{
continue;
}
Expand Down
8 changes: 5 additions & 3 deletions Content.Server/Anomaly/Effects/BluespaceAnomalySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Content.Shared.Database;
using Content.Shared.Mobs.Components;
using Content.Shared.Teleportation.Components;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Collections;
using Robust.Shared.Random;
Expand Down Expand Up @@ -34,8 +33,11 @@ private void OnPulse(EntityUid uid, BluespaceAnomalyComponent component, ref Ano
var xformQuery = GetEntityQuery<TransformComponent>();
var xform = xformQuery.GetComponent(uid);
var range = component.MaxShuffleRadius * args.Severity * args.PowerModifier;
// get a list of all entities in range with the MobStateComponent
// we filter out those inside a container
// otherwise borg brains get removed from their body, or PAIs from a PDA
var mobs = new HashSet<Entity<MobStateComponent>>();
_lookup.GetEntitiesInRange(xform.Coordinates, range, mobs);
_lookup.GetEntitiesInRange(xform.Coordinates, range, mobs, flags: LookupFlags.Uncontained);
var allEnts = new ValueList<EntityUid>(mobs.Select(m => m.Owner)) { uid };
var coords = new ValueList<Vector2>();
foreach (var ent in allEnts)
Expand All @@ -59,7 +61,7 @@ private void OnSupercritical(EntityUid uid, BluespaceAnomalyComponent component,
var radius = component.SupercriticalTeleportRadius * args.PowerModifier;
var gridBounds = new Box2(mapPos - new Vector2(radius, radius), mapPos + new Vector2(radius, radius));
var mobs = new HashSet<Entity<MobStateComponent>>();
_lookup.GetEntitiesInRange(xform.Coordinates, component.MaxShuffleRadius, mobs);
_lookup.GetEntitiesInRange(xform.Coordinates, component.MaxShuffleRadius, mobs, flags: LookupFlags.Uncontained);
foreach (var comp in mobs)
{
var ent = comp.Owner;
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Body/Systems/RespiratorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ private void TakeSuffocationDamage(Entity<RespiratorComponent> ent)
var organs = _bodySystem.GetBodyOrganEntityComps<LungComponent>((ent, null));
foreach (var entity in organs)
{
_alertsSystem.ShowAlert(entity.Owner, entity.Comp1.Alert);
_alertsSystem.ShowAlert(ent, entity.Comp1.Alert);
}
}

Expand All @@ -306,7 +306,7 @@ private void StopSuffocation(Entity<RespiratorComponent> ent)
var organs = _bodySystem.GetBodyOrganEntityComps<LungComponent>((ent, null));
foreach (var entity in organs)
{
_alertsSystem.ClearAlert(entity.Owner, entity.Comp1.Alert);
_alertsSystem.ClearAlert(ent, entity.Comp1.Alert);
}

_damageableSys.TryChangeDamage(ent, ent.Comp.DamageRecovery);
Expand Down
7 changes: 5 additions & 2 deletions Content.Server/Botany/SeedPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,12 @@ public partial class SeedData

[DataField("plantIconState")] public string PlantIconState { get; set; } = "produce";

/// <summary>
/// Screams random sound, could be strict sound SoundPathSpecifier or collection SoundCollectionSpecifier
/// base class is SoundSpecifier
/// </summary>
[DataField("screamSound")]
public SoundSpecifier ScreamSound = new SoundPathSpecifier("/Audio/Voice/Human/malescream_1.ogg");

public SoundSpecifier ScreamSound = new SoundCollectionSpecifier("PlantScreams", AudioParams.Default.WithVolume(-10));

[DataField("screaming")] public bool CanScream;

Expand Down
22 changes: 20 additions & 2 deletions Content.Server/Botany/Systems/MutationSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ private void MutateFloat(ref float val, float min, float max, int bits, int tota
if (!Random(probBitflip))
return;

if (min == max)
{
val = min;
return;
}

// Starting number of bits that are high, between 0 and bits.
// In other words, it's val mapped linearly from range [min, max] to range [0, bits], and then rounded.
int valInt = (int)MathF.Round((val - min) / (max - min) * bits);
Expand Down Expand Up @@ -186,10 +192,22 @@ private void MutateInt(ref int val, int min, int max, int bits, int totalbits, f
if (!Random(probBitflip))
return;

if (min == max)
{
val = min;
return;
}

// Starting number of bits that are high, between 0 and bits.
// In other words, it's val mapped linearly from range [min, max] to range [0, bits], and then rounded.
int valInt = (int)MathF.Round((val - min) / (max - min) * bits);
// val may be outside the range of min/max due to starting prototype values, so clamp.
valInt = Math.Clamp(valInt, 0, bits);

// Probability that the bit flip increases n.
// The higher the current value is, the lower the probability of increasing value is, and the higher the probability of decreasive it it.
// The higher the current value is, the lower the probability of increasing value is, and the higher the probability of decreasing it.
// In other words, it tends to go to the middle.
float probIncrease = 1 - (float)val / bits;
float probIncrease = 1 - (float)valInt / bits;
int valMutated;
if (Random(probIncrease))
{
Expand Down
26 changes: 17 additions & 9 deletions Content.Server/Botany/Systems/PlantHolderSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,8 @@ private void OnInteractUsing(Entity<PlantHolderComponent> entity, ref InteractUs
var displayName = Loc.GetString(component.Seed.DisplayName);
_popup.PopupCursor(Loc.GetString("plant-holder-component-take-sample-message",
("seedName", displayName)), args.User);

if (component.Seed != null && component.Seed.CanScream)
{
_audio.PlayPvs(component.Seed.ScreamSound, uid, AudioParams.Default.WithVolume(-2));
}

DoScream(entity.Owner, component.Seed);

if (_random.Prob(0.3f))
component.Sampled = true;
Expand Down Expand Up @@ -525,10 +522,9 @@ public void Update(EntityUid uid, PlantHolderComponent? component = null)

var environment = _atmosphere.GetContainingMixture(uid, true, true) ?? GasMixture.SpaceGas;

component.MissingGas = 0;
if (component.Seed.ConsumeGasses.Count > 0)
{
component.MissingGas = 0;

foreach (var (gas, amount) in component.Seed.ConsumeGasses)
{
if (environment.GetMoles(gas) < amount)
Expand Down Expand Up @@ -748,6 +744,19 @@ public bool DoHarvest(EntityUid plantholder, EntityUid user, PlantHolderComponen
return true;
}

/// <summary>
/// Force do scream on PlantHolder (like plant is screaming) using seed's ScreamSound specifier (collection or soundPath)
/// </summary>
/// <returns></returns>
public bool DoScream(EntityUid plantholder, SeedData? seed = null)
{
if (seed == null || seed.CanScream == false)
return false;

_audio.PlayPvs(seed.ScreamSound, plantholder);
return true;
}

public void AutoHarvest(EntityUid uid, PlantHolderComponent? component = null)
{
if (!Resolve(uid, ref component))
Expand All @@ -768,8 +777,7 @@ private void AfterHarvest(EntityUid uid, PlantHolderComponent? component = null)
component.Harvest = false;
component.LastProduce = component.Age;

if (component.Seed != null && component.Seed.CanScream)
_audio.PlayPvs(component.Seed.ScreamSound, uid, AudioParams.Default.WithVolume(-2));
DoScream(uid, component.Seed);

if (component.Seed?.HarvestRepeat == HarvestType.NoRepeat)
RemovePlant(uid, component);
Expand Down
Loading
Loading