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

[Species] InterPersonal Conflict #97

Merged
merged 68 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
0cf1ff5
Added a new mob typed named Hologram, set up a clone of the Drone whi…
Pspritechologist Feb 7, 2023
f26cbf1
adds early scutters, and the basis of a charging system.
Pspritechologist Feb 13, 2023
9bcb278
Working on it
Pspritechologist Feb 14, 2023
3da44f1
Lots more work towards holograms, probably too long without committin…
Pspritechologist Feb 24, 2023
e80ccbc
Committing more
Pspritechologist Feb 25, 2023
3e53704
More work on Holograms. Moved most things over to events, bug where h…
Pspritechologist Feb 26, 2023
a08512d
Fixed holocorgi ID
Pspritechologist Feb 27, 2023
6431633
Fuckin working again. Stuff is networked now, though not to any real …
Pspritechologist Feb 28, 2023
80b458e
Prepared for projected, lightbee, and hardlight holos by separating t…
Pspritechologist Mar 1, 2023
1f90d22
Removed some unneeded things, cleaned some files, made it Holograms c…
Pspritechologist Mar 2, 2023
c274806
Added damage sets for Holograms, kinda fixed rotation on spawn, begun…
Pspritechologist Mar 18, 2023
a2d96a1
Absolute overhaul. Silicon component is set up with an abundance of v…
Pspritechologist Mar 21, 2023
e1924e7
Functioning IPC species! Still needs to be fine tuned, as it takes a …
Pspritechologist Mar 24, 2023
dedbb69
Far more work on IPCs as a race, some sprites for future use, unfucke…
Pspritechologist Mar 26, 2023
81ca98f
Added silicon chargers in the form of a charging pad and industrial c…
Pspritechologist Mar 28, 2023
1fa8672
Finally found the positronic brain sprites. Temp usage for now.
Pspritechologist Mar 28, 2023
99e5e84
Fix posi brain sprite
Pspritechologist Mar 28, 2023
05825b5
Fixed charger burn damage
Pspritechologist Mar 29, 2023
0bed393
Gutted Holograms from the branch to break up the PRs.
Pspritechologist Mar 30, 2023
62a7194
Fixed the dumbass colours on IPCs and set Dionas to use None (because…
Pspritechologist Mar 30, 2023
312d097
Working on IPCs falling asleep when de powered. Sleep sucks
Pspritechologist Apr 15, 2023
7879042
Chargers are awesome now! Recursive check to find all items on an ent…
Pspritechologist Apr 20, 2023
7837d2e
Apply suggestions from code review
Pspritechologist Apr 21, 2023
9cc78de
Cleaned up sleeping files.
Pspritechologist Apr 21, 2023
4527250
Cleaned up a bit, more suggestions
Pspritechologist Apr 21, 2023
c8a227a
False is default, and some suggestions by Death in SiliconChargerSyst…
Pspritechologist Apr 26, 2023
7f8ca85
Added some regions :0
Pspritechologist Apr 27, 2023
ed9de5a
component.Owner no more! >:D
Pspritechologist Apr 27, 2023
b9474ff
component.Owner begone! :D (mostly)
Pspritechologist Apr 28, 2023
81811ca
YA BOI DID IT
Pspritechologist Apr 28, 2023
c7c2e86
Workin' on that sweet sweet APC succ
Pspritechologist Apr 30, 2023
7348c32
Cleaned up a bit post-rebase, fixed TintedHues validator, fixed drink…
Pspritechologist May 15, 2023
2b6d91e
Various small fixes, electrocution charge
Pspritechologist May 21, 2023
5f2508a
Shocked batteries now charge based on damage dealt and DamagePerWatt
Pspritechologist May 22, 2023
54c86ff
Merge branch 'master' of https://github.com/Park-Station/Parkstation …
Pspritechologist May 22, 2023
c26b681
General minor clean up.
Pspritechologist May 22, 2023
56ed80a
Review suggestions
Pspritechologist May 22, 2023
7c358dc
Merge branch 'master' of https://github.com/Park-Station/Parkstation …
Pspritechologist May 24, 2023
af4b891
General, minor cleanup.
Pspritechologist May 24, 2023
1b319d0
Merge remote-tracking branch 'remotes/origin/master' into IPCs
Pspritechologist Jun 17, 2023
ca94a9d
Merge branch 'master' of https://github.com/Park-Station/Parkstation …
Pspritechologist Jun 19, 2023
3a2a6c9
Fixed the errors and cleaned up a bit
Pspritechologist Jun 19, 2023
86965c6
Several changes and fixes.
Pspritechologist Jun 22, 2023
bc85832
New IPC sprites v2
Pspritechologist Jun 22, 2023
e0e3ad2
IPC sprites v3
Pspritechologist Jun 22, 2023
cdf6318
IPCs now use integrated radios!
Pspritechologist Jun 22, 2023
3692d07
IPC encryption keys now work better, and effect the SetOutfit command.
Pspritechologist Jun 22, 2023
e4cd838
Things are localized!
Pspritechologist Jun 23, 2023
3420c0e
Cleaned up tons of stuff.
Pspritechologist Jun 23, 2023
564258b
Fixed issue with IPC charge, and review suggestions.
Pspritechologist Jun 24, 2023
f7cca4f
Lots of general improvements to the systems, lots of cleanup.
Pspritechologist Jun 24, 2023
db3d223
Several improvements.
Pspritechologist Jun 25, 2023
37adeb7
Merge branch 'master' into IPC
Pspritechologist Jun 25, 2023
50a64e7
Update Content.Server/Station/Systems/StationSpawningSystem.cs
Pspritechologist Jun 25, 2023
1a19f87
Add Parkstation tags to skin colours file.
Pspritechologist Jun 25, 2023
fdbff21
Merge branch 'master' of https://github.com/Park-Station/Parkstation …
Pspritechologist Jun 25, 2023
fdaff09
Removed unintended changes.
Pspritechologist Jun 25, 2023
1702ba8
Adjust tv sprite
Pspritechologist Jun 27, 2023
4f33428
Merge branch 'upstream-sync-2' of https://github.com/Park-Station/Par…
Pspritechologist Jul 23, 2023
be28f08
Minor fixes post-merge
Pspritechologist Jul 23, 2023
a8a8b97
Merge branch 'master' of https://github.com/Simple-Station/Parkstatio…
Pspritechologist Jul 24, 2023
d2e503b
Review fixes
Pspritechologist Jul 24, 2023
624c2b9
Batteries should now blow up again
Pspritechologist Jul 24, 2023
989d315
Addressed remaining review issues.
Pspritechologist Jul 25, 2023
93df8ce
Missing FTL fix?
Pspritechologist Jul 25, 2023
b897bd2
Removed unneeded sleep change, added timer for coming back to life
Pspritechologist Jul 25, 2023
8449285
IPCs have names now
Pspritechologist Jul 26, 2023
73acebc
Removed vscode file
Pspritechologist Jul 27, 2023
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
32 changes: 32 additions & 0 deletions Content.Server/Administration/Commands/SetOutfitCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Prototypes;
using Content.Shared.Radio.Components; // Parkstation-IPC
using Content.Shared.Containers; // Parkstation-IPC
using Robust.Shared.Containers; // Parkstation-IPC

namespace Content.Server.Administration.Commands
{
Expand Down Expand Up @@ -128,6 +131,35 @@ public static bool SetOutfit(EntityUid target, string gear, IEntityManager entit
}
}

// Parkstation-IPC-Start
// Pretty much copied from StationSpawningSystem.SpawnStartingGear
if (entityManager.TryGetComponent<EncryptionKeyHolderComponent>(target, out var keyHolderComp))
{
var earEquipString = startingGear.GetGear("ears", profile);
var containerMan = entityManager.System<SharedContainerSystem>();

if (!string.IsNullOrEmpty(earEquipString))
{
var earEntity = entityManager.SpawnEntity(earEquipString, entityManager.GetComponent<TransformComponent>(target).Coordinates);

if (entityManager.TryGetComponent<EncryptionKeyHolderComponent>(earEntity, out _) && // I had initially wanted this to spawn the headset, and simply move all the keys over, but the headset didn't seem to have any keys in it when spawned...
entityManager.TryGetComponent<ContainerFillComponent>(earEntity, out var fillComp) &&
fillComp.Containers.TryGetValue(EncryptionKeyHolderComponent.KeyContainerName, out var defaultKeys))
{
containerMan.CleanContainer(keyHolderComp.KeyContainer);

foreach (var key in defaultKeys)
{
var keyEntity = entityManager.SpawnEntity(key, entityManager.GetComponent<TransformComponent>(target).Coordinates);
keyHolderComp.KeyContainer.Insert(keyEntity, force: true);
}
}

entityManager.QueueDeleteEntity(earEntity);
}
}
// Parkstation-IPC-End

return true;
}
}
Expand Down
3 changes: 2 additions & 1 deletion Content.Server/Bed/BedSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using Content.Shared.Mobs.Systems;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using Content.Shared.SimpleStation14.Silicon.Components; // Parkstation-IPCs // I shouldn't have to modify this.

namespace Content.Server.Bed
{
Expand Down Expand Up @@ -74,7 +75,7 @@ public override void Update(float frameTime)

foreach (var healedEntity in strapComponent.BuckledEntities)
{
if (_mobStateSystem.IsDead(healedEntity))
if (_mobStateSystem.IsDead(healedEntity) || HasComp<SiliconComponent>(healedEntity)) // Parkstation-IPCs // I shouldn't have to modify this.
continue;

var damage = bedComponent.Damage;
Expand Down
6 changes: 3 additions & 3 deletions Content.Server/Electrocution/ElectrocutionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public sealed class ElectrocutionSystem : SharedElectrocutionSystem
private const string DamageType = "Shock";

// Yes, this is absurdly small for a reason.
private const float ElectrifiedDamagePerWatt = 0.0015f;
public const float ElectrifiedDamagePerWatt = 0.0015f; // Parkstation-IPC // This information is allowed to be public, and was needed in BatteryElectrocuteChargeSystem.cs

private const float RecursiveDamageMultiplier = 0.75f;
private const float RecursiveTimeMultiplier = 0.8f;
Expand Down Expand Up @@ -292,7 +292,7 @@ public bool TryDoElectrocution(
|| !DoCommonElectrocution(uid, sourceUid, shockDamage, time, refresh, siemensCoefficient, statusEffects))
return false;

RaiseLocalEvent(uid, new ElectrocutedEvent(uid, sourceUid, siemensCoefficient), true);
RaiseLocalEvent(uid, new ElectrocutedEvent(uid, sourceUid, siemensCoefficient, shockDamage), true); // Parkstation-IPC
return true;
}

Expand Down Expand Up @@ -338,7 +338,7 @@ private bool TryDoElectrocutionPowered(
electrocutionComponent.Electrocuting = uid;
electrocutionComponent.Source = sourceUid;

RaiseLocalEvent(uid, new ElectrocutedEvent(uid, sourceUid, siemensCoefficient), true);
RaiseLocalEvent(uid, new ElectrocutedEvent(uid, sourceUid, siemensCoefficient, shockDamage), true); // Parkstation-IPC

return true;
}
Expand Down
3 changes: 2 additions & 1 deletion Content.Server/Nyanotrasen/Borgs/CyborgComponent.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace Content.Server.Borgs
{
[Obsolete("CyborgComponent is unused on Parkstation, see SiliconComponent")] // Parkstation-IPCs
[RegisterComponent]
public sealed class CyborgComponent : Component
{}
}
}
7 changes: 4 additions & 3 deletions Content.Server/Nyanotrasen/Borgs/CyborgSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace Content.Server.Borgs
{
[Obsolete("'Cyborg' should be unused on Parkstation, see SiliconSystem")] // Parkstation-IPCs
public sealed class Cyborg : EntitySystem
{
[Dependency] private readonly ChatSystem _chatSystem = default!;
Expand All @@ -15,7 +16,7 @@ public override void Initialize()
base.Initialize();
SubscribeLocalEvent<CyborgComponent, MobStateChangedEvent>(OnChangeState);
}

private void OnChangeState(EntityUid uid, CyborgComponent component, MobStateChangedEvent args)
{
if (args.NewMobState == MobState.Dead){
Expand All @@ -27,7 +28,7 @@ private void OnChangeState(EntityUid uid, CyborgComponent component, MobStateCha

// Stop dead borg from being movable AA cards by removing their ability to bump doors.
_tagSystem.RemoveTag(uid, "DoorBumpOpener");

}
else if(args.NewMobState == MobState.Alive && args.OldMobState == MobState.Dead)
{
Expand All @@ -38,4 +39,4 @@ private void OnChangeState(EntityUid uid, CyborgComponent component, MobStateCha
return;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ namespace Content.Server.Radio.Components;
public sealed class IntrinsicRadioTransmitterComponent : Component
{
[DataField("channels", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<RadioChannelPrototype>))]
public readonly HashSet<string> Channels = new() { SharedChatSystem.CommonChannel };
public HashSet<string> Channels = new() { SharedChatSystem.CommonChannel }; // Parkstation-IPC // Did this really need to be readonly? :prerealization:
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
namespace Content.Server.SimpleStation14.Power;

[RegisterComponent]
public sealed class BatteryDrinkerComponent : Component
{
/// <summary>
/// Is this drinker allowed to drink batteries not tagged as <see cref="BatteryDrinkSource"/>?
/// </summary>
[DataField("drinkAll"), ViewVariables(VVAccess.ReadWrite)]
public bool DrinkAll = false;

/// <summary>
/// How long it takes to drink from a battery, in seconds.
/// Is multiplied by the source.
/// </summary>
[DataField("drinkSpeed"), ViewVariables(VVAccess.ReadWrite)]
public float DrinkSpeed = 1.5f;

/// <summary>
/// The multiplier for the amount of power to attempt to drink.
/// Default amount is 1000
/// </summary>
[DataField("drinkMultiplier"), ViewVariables(VVAccess.ReadWrite)]
public float DrinkMultiplier = 5f;

/// <summary>
/// The multiplier for how long it takes to drink a non-source battery, if <see cref="DrinkAll"/> is true.
/// </summary>
[DataField("drinkAllMultiplier"), ViewVariables(VVAccess.ReadWrite)]
public float DrinkAllMultiplier = 2.5f;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System.Numerics;

namespace Content.Server.SimpleStation14.Power.Components;

[RegisterComponent]
public sealed class RandomBatteryChargeComponent : Component
{
/// <summary>
/// The minimum and maximum max charge the battery can have.
/// </summary>
[DataField("batteryMaxMinMax")]
public Vector2 BatteryMaxMinMax = new(0.85f, 1.15f);

/// <summary>
/// The minimum and maximum current charge the battery can have.
/// </summary>
[DataField("batteryChargeMinMax")]
public Vector2 BatteryChargeMinMax = new(1f, 1f);

/// <summary>
/// False if the randomized charge of the battery should be a multiple of the preexisting current charge of the battery.
/// True if the randomized charge of the battery should be a multiple of the max charge of the battery post max charge randomization.
/// </summary>
[DataField("basedOnMaxCharge")]
public bool BasedOnMaxCharge = true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.ComponentModel.DataAnnotations;
using Robust.Shared.Audio;
using Content.Server.Sound.Components;

namespace Content.Server.SimpleStation14.Silicon;

/// <summary>
/// Applies a <see cref="SpamEmitSoundComponent"/> to a Silicon when its battery is drained, and removes it when it's not.
/// </summary>
[RegisterComponent]
public sealed class SiliconEmitSoundOnDrainedComponent : Component
{
[DataField("sound"), Required]
public SoundSpecifier Sound = default!;

[DataField("interval")]
public float Interval = 8f;

[DataField("playChance")]
public float PlayChance = 1f;

[DataField("popUp")]
public string? PopUp;
}
146 changes: 146 additions & 0 deletions Content.Server/SimpleStation14/Power/Systems/BatteryDrinkerSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
using System.Diagnostics.CodeAnalysis;
using Content.Server.Power.Components;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.DoAfter;
using Content.Shared.PowerCell.Components;
using Content.Shared.SimpleStation14.Silicon;
using Content.Shared.Verbs;
using Robust.Shared.Utility;
using Content.Server.SimpleStation14.Silicon.Charge;
using Content.Server.Power.EntitySystems;
using Content.Server.Popups;

namespace Content.Server.SimpleStation14.Power;

public sealed class BatteryDrinkerSystem : EntitySystem
{
[Dependency] private readonly ItemSlotsSystem _slots = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly BatterySystem _battery = default!;
[Dependency] private readonly SiliconChargeSystem _silicon = default!;
[Dependency] private readonly PopupSystem _popup = default!;

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

SubscribeLocalEvent<BatteryComponent, GetVerbsEvent<AlternativeVerb>>(AddAltVerb);

SubscribeLocalEvent<BatteryDrinkerComponent, BatteryDrinkerDoAfterEvent>(OnDoAfter);
}

private void AddAltVerb(EntityUid uid, BatteryComponent batteryComponent, GetVerbsEvent<AlternativeVerb> args)
{
if (!args.CanAccess || !args.CanInteract)
return;

if (!TryComp<BatteryDrinkerComponent>(args.User, out var drinkerComp) ||
!TestDrinkableBattery(uid, drinkerComp) ||
!TryGetFillableBattery(args.User, out var drinkerBattery, out _))
return;

AlternativeVerb verb = new()
{
Act = () => DrinkBattery(uid, args.User, drinkerComp),
Text = Loc.GetString("battery-drinker-verb-drink"),
Icon = new SpriteSpecifier.Texture(new ResPath("/Textures/Interface/VerbIcons/smite.svg.192dpi.png")),
};

args.Verbs.Add(verb);
}

private bool TestDrinkableBattery(EntityUid target, BatteryDrinkerComponent drinkerComp)
{
if (!drinkerComp.DrinkAll && !HasComp<BatteryDrinkerSourceComponent>(target))
return false;

return true;
}

private bool TryGetFillableBattery(EntityUid uid, [NotNullWhen(true)] out BatteryComponent? battery, [NotNullWhen(true)] out EntityUid batteryUid)
{
if (_silicon.TryGetSiliconBattery(uid, out battery, out batteryUid))
return true;

if (TryComp(uid, out battery))
return true;

if (TryComp<PowerCellSlotComponent>(uid, out var powerCellSlot) &&
_slots.TryGetSlot(uid, powerCellSlot.CellSlotId, out var slot) &&
slot.Item != null &&
TryComp(slot.Item.Value, out battery))
{
batteryUid = slot.Item.Value;
return true;
}

return false;
}

private void DrinkBattery(EntityUid target, EntityUid user, BatteryDrinkerComponent drinkerComp)
{
var doAfterTime = drinkerComp.DrinkSpeed;

if (TryComp<BatteryDrinkerSourceComponent>(target, out var sourceComp))
doAfterTime *= sourceComp.DrinkSpeedMulti;
else
doAfterTime *= drinkerComp.DrinkAllMultiplier;

var args = new DoAfterArgs(user, doAfterTime, new BatteryDrinkerDoAfterEvent(), user, target) // TODO: Make this doafter loop, once we merge Upstream.
{
BreakOnDamage = true,
BreakOnTargetMove = true,
Broadcast = false,
DistanceThreshold = 1.35f,
RequireCanInteract = true,
CancelDuplicate = false
};

_doAfter.TryStartDoAfter(args);
}

private void OnDoAfter(EntityUid uid, BatteryDrinkerComponent drinkerComp, DoAfterEvent args)
{
if (args.Cancelled || args.Target == null)
return;

var source = args.Target.Value;
var drinker = uid;
var sourceBattery = Comp<BatteryComponent>(source);

TryGetFillableBattery(drinker, out var drinkerBattery, out var drinkerBatteryUid);

TryComp<BatteryDrinkerSourceComponent>(source, out var sourceComp);

DebugTools.AssertNotNull(drinkerBattery);

if (drinkerBattery == null)
return;

var amountToDrink = drinkerComp.DrinkMultiplier * 1000;

amountToDrink = MathF.Min(amountToDrink, sourceBattery.CurrentCharge);
amountToDrink = MathF.Min(amountToDrink, drinkerBattery.MaxCharge - drinkerBattery.CurrentCharge);

if (sourceComp != null && sourceComp.MaxAmount > 0)
amountToDrink = MathF.Min(amountToDrink, (float) sourceComp.MaxAmount);

if (amountToDrink <= 0)
{
_popup.PopupEntity(Loc.GetString("battery-drinker-empty", ("target", source)), drinker, drinker);
return;
}

if (_battery.TryUseCharge(source, amountToDrink, sourceBattery))
_battery.SetCharge(drinkerBatteryUid, drinkerBattery.Charge + amountToDrink, drinkerBattery);
else
{
_battery.SetCharge(drinker, sourceBattery.Charge + drinkerBattery.Charge, drinkerBattery);
_battery.SetCharge(source, 0, sourceBattery);
}

if (sourceComp != null && sourceComp.DrinkSound != null)
_audio.PlayPvs(sourceComp.DrinkSound, source);
}
}
Loading
Loading