* basic radiation generator * might need this * thonk * big thonk * oop * e * werks * sprite * oopsy woopsy * radiation * clean up file * makes it work, probably * minor fixes * resources * progress on component * this will no longer be necessary * radiation go brrrr * finally fix container issues * out var Co-authored-by: Remie Richards <remierichards@gmail.com> * second out fix * another out fix Co-authored-by: Remie Richards <remierichards@gmail.com> * switch case * fix switch * sound and improvements * nullable * basic containment field system * ensure alignment * fix beam placement logic * field generation fully working * fix potential crash * working containment functionality * extremely basic emitter functionality * fix radiation panel naming * emitter stuff * oopsies * fixes * some fixes * cleanup * small fix and move emitter file * add sprite resources for PA * slight rework of the singulo adds rads * pushing for smugleaf :) * added radiationpanels * some fixes for the singulo * containmentfield * pa wip * progress * pa working * emitter fix * works :) * ui works * some work on ui & pa * progress * ui work & misc fixes * GREYSCALE * pa ui polish containmentfieldgen rework * singulo rework added snapgrid * getcomponent get out * singulo rework added collisiongroups underplating & passable * yaml work: - collision boxes - singulo now unshaded * no unlit * misc changes * pa wires * add usability check * nullable enable * minor fix * power need added * reenables containment field energy drain menu close button singularity collider fix * sprite replacement * finished singulo pulling * pjb fixes * fixing sprites & minor adjustments * decrease containmentfield power * some yml adjustments * unlit layers singulogenerator * singulogen * everything works just not the powergetting on the pa i wanna die * Adds PA construction graphs, PA construction works * Snap to grid parts when completing construction * updated to newest master * inb4 i work on power * fixes upstream merge adds power need to particleaccelerator * properly implements power & apc power * Emitters are now fancy. * I have actually no idea how this happened. * Give PA a wiring LayoutId * PA is an acronym * indicators fixes hacking * Singulo is a word you blasphemous IDE. * Rewrite the PA. * Fancy names for PA parts. * Wiring fixes, strength wire cutting. * fixes projectile & ignores components * nullability errors * fixes integration tests Co-authored-by: unusualcrow <unusualcrow@protonmail.com> Co-authored-by: L.E.D <10257081+unusualcrow@users.noreply.github.com> Co-authored-by: Remie Richards <remierichards@gmail.com> Co-authored-by: Víctor Aguilera Puerto <zddm@outlook.es> Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
95 lines
3.7 KiB
C#
95 lines
3.7 KiB
C#
using System;
|
|
using Content.Server.GameObjects.Components.Projectiles;
|
|
using Content.Server.GameObjects.Components.Singularity;
|
|
using Content.Shared.GameObjects.Components;
|
|
using Content.Shared.Physics;
|
|
using Robust.Server.GameObjects;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.GameObjects.Components;
|
|
using Robust.Shared.Interfaces.GameObjects;
|
|
using Robust.Shared.Log;
|
|
using Robust.Shared.Maths;
|
|
using Robust.Shared.Timers;
|
|
|
|
namespace Content.Server.GameObjects.Components.PA
|
|
{
|
|
[RegisterComponent]
|
|
public class ParticleProjectileComponent : Component, ICollideBehavior
|
|
{
|
|
public override string Name => "ParticleProjectile";
|
|
private ParticleAcceleratorPowerState _state;
|
|
public void CollideWith(IEntity collidedWith)
|
|
{
|
|
if (collidedWith.TryGetComponent<SingularityComponent>(out var singularityComponent))
|
|
{
|
|
var multiplier = _state switch
|
|
{
|
|
ParticleAcceleratorPowerState.Standby => 0,
|
|
ParticleAcceleratorPowerState.Level0 => 1,
|
|
ParticleAcceleratorPowerState.Level1 => 3,
|
|
ParticleAcceleratorPowerState.Level2 => 6,
|
|
ParticleAcceleratorPowerState.Level3 => 10,
|
|
_ => 0
|
|
};
|
|
singularityComponent.Energy += 10 * multiplier;
|
|
Owner.Delete();
|
|
}else if (collidedWith.TryGetComponent<SingularityGeneratorComponent>(out var singularityGeneratorComponent)
|
|
)
|
|
{
|
|
singularityGeneratorComponent.Power += _state switch
|
|
{
|
|
ParticleAcceleratorPowerState.Standby => 0,
|
|
ParticleAcceleratorPowerState.Level0 => 1,
|
|
ParticleAcceleratorPowerState.Level1 => 2,
|
|
ParticleAcceleratorPowerState.Level2 => 4,
|
|
ParticleAcceleratorPowerState.Level3 => 8,
|
|
_ => 0
|
|
};
|
|
Owner.Delete();
|
|
}
|
|
}
|
|
|
|
public void Fire(ParticleAcceleratorPowerState state, Angle angle, IEntity firer)
|
|
{
|
|
_state = state;
|
|
|
|
if (!Owner.TryGetComponent<PhysicsComponent>(out var physicsComponent))
|
|
{
|
|
Logger.Error("ParticleProjectile tried firing, but it was spawned without a CollidableComponent");
|
|
return;
|
|
}
|
|
physicsComponent.Status = BodyStatus.InAir;
|
|
|
|
if (!Owner.TryGetComponent<ProjectileComponent>(out var projectileComponent))
|
|
{
|
|
Logger.Error("ParticleProjectile tried firing, but it was spawned without a ProjectileComponent");
|
|
return;
|
|
}
|
|
projectileComponent.IgnoreEntity(firer);
|
|
|
|
var suffix = state switch
|
|
{
|
|
ParticleAcceleratorPowerState.Level0 => "0",
|
|
ParticleAcceleratorPowerState.Level1 => "1",
|
|
ParticleAcceleratorPowerState.Level2 => "2",
|
|
ParticleAcceleratorPowerState.Level3 => "3",
|
|
_ => "0"
|
|
};
|
|
|
|
if (!Owner.TryGetComponent<SpriteComponent>(out var spriteComponent))
|
|
{
|
|
Logger.Error("ParticleProjectile tried firing, but it was spawned without a SpriteComponent");
|
|
return;
|
|
}
|
|
spriteComponent.LayerSetState(0, $"particle{suffix}");
|
|
|
|
physicsComponent
|
|
.EnsureController<BulletController>()
|
|
.LinearVelocity = angle.ToVec() * 20f;
|
|
|
|
Owner.Transform.LocalRotation = new Angle(angle + Angle.FromDegrees(180));
|
|
Timer.Spawn(3000, () => Owner.Delete());
|
|
}
|
|
}
|
|
}
|