Skip to content

Commit

Permalink
Fixed merge conflic for adding basic machine linking to space artillery
Browse files Browse the repository at this point in the history
  • Loading branch information
Qulibly committed Jul 31, 2023
2 parents 35728bb + 713c131 commit b04bb05
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.Threading;
using Content.Shared.Construction.Prototypes;
using Content.Shared.DeviceLinking;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;

namespace Content.Server.SpaceArtillery;

[RegisterComponent, NetworkedComponent]
public sealed class SpaceArtilleryComponent : Component
{

/// <summary>
/// Signal port that makes space artillery fire.
/// </summary>
[DataField("firePort", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
public string FirePort = "Fire";

}
50 changes: 50 additions & 0 deletions Content.Server/SpaceArtillery/SpaceArtillerySystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using Content.Server.Storage.EntitySystems;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
using Content.Server.PneumaticCannon;
using Content.Shared.PneumaticCannon;
using Content.Shared.Weapons.Ranged.Components;
using Content.Shared.Weapons.Ranged.Systems;
using Robust.Shared.Containers;

namespace Content.Server.SpaceArtillery
{
public sealed class SpaceArtillerySystem : EntitySystem
{

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

SubscribeLocalEvent<SpaceArtilleryComponent, InteractHandEvent>(OnInteractHand);
//SubscribeLocalEvent<SpaceArtilleryComponent, GetVerbsEvent<Verb>>(OnGetVerb);
}

//Idea is that when interacted, the artillery will call attempt at firing as if it was held. Will probably need to think of better way to activate it, like with linkables
private void OnInteractHand(EntityUid uid, SpaceArtilleryComponent component, InteractHandEvent args)
{
if (args.Handled)
return;

var attemptEv = new AttemptShootEvent(uid, null);
RaiseLocalEvent(uid, attemptEv);
}


// private void Fire(EntityUid uid, EmitterComponent component)
// {
// if (!TryComp<GunComponent>(uid, out var gunComponent))
// return;
//
// var xform = Transform(uid);
// var ent = Spawn(component.BoltType, xform.Coordinates);
// var proj = EnsureComp<ProjectileComponent>(ent);
// _projectile.SetShooter(proj, uid);
//
// var targetPos = new EntityCoordinates(uid, new Vector2(0, -1));
//
// _gun.Shoot(uid, gunComponent, ent, xform.Coordinates, targetPos, out _);
// }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
ports:
- SpaceArtilleryFire
- type: Gun
fireRate: 10
fireRate: 3
selectedMode: FullAuto
availableModes:
- SemiAuto
Expand Down

0 comments on commit b04bb05

Please sign in to comment.