From 8000b29fa919b66871d05142bfe3fc517a131f75 Mon Sep 17 00:00:00 2001 From: Qulibly Date: Thu, 27 Jul 2023 03:21:26 +0200 Subject: [PATCH 1/3] Got basic space artillery structure working --- .../Entities/Structures/space_artillery.yml | 61 ++++++++++++++++++ .../Structures/space_artillery.rsi/meta.json | 15 +++++ .../space_artillery.rsi/space_artillery.png | Bin 0 -> 3046 bytes 3 files changed, 76 insertions(+) create mode 100644 Resources/Prototypes/Entities/Structures/space_artillery.yml create mode 100644 Resources/Textures/Structures/space_artillery.rsi/meta.json create mode 100644 Resources/Textures/Structures/space_artillery.rsi/space_artillery.png diff --git a/Resources/Prototypes/Entities/Structures/space_artillery.yml b/Resources/Prototypes/Entities/Structures/space_artillery.yml new file mode 100644 index 00000000000..b6a5b113387 --- /dev/null +++ b/Resources/Prototypes/Entities/Structures/space_artillery.yml @@ -0,0 +1,61 @@ +- type: entity + id: Space_Artillery + name: space artillery + parent: ConstructibleMachine + description: It's like from 20th century second planet wars! Old and reliable. + placement: + mode: SnapgridCenter + components: + - type: Clickable + - type: InteractionOutline + - type: Physics + bodyType: Static + - type: Fixtures + fixtures: + fix1: + shape: + !type:PhysShapeAabb + bounds: "-0.25,-0.25,0.25,0.25" + density: 600 + mask: + - MachineMask + layer: + - MachineLayer + - type: Transform + anchored: true + - type: Sprite + sprite: Structures/space_artillery.rsi + layers: + - state: space_artillery + - type: Anchorable + - type: Pullable + - type: Rotatable + rotateWhilePulling: false + - type: Appearance + - type: Storage + capacity: 120 + - type: UserInterface + interfaces: + - key: enum.StorageUiKey.Key + type: StorageBoundUserInterface + - type: ContainerContainer + containers: + storagebase: !type:Container + ents: [] + - type: ContainerAmmoProvider + container: storagebase + - type: PneumaticCannon + gasUsage: 0 + baseProjectileSpeed: 25 + toolModifyPower: Screwing + throwItems: false + - type: Gun + fireRate: 10 + selectedMode: FullAuto + availableModes: + - SemiAuto + - FullAuto + soundGunshot: + path: /Audio/Effects/thunk.ogg + soundEmpty: + path: /Audio/Items/hiss.ogg \ No newline at end of file diff --git a/Resources/Textures/Structures/space_artillery.rsi/meta.json b/Resources/Textures/Structures/space_artillery.rsi/meta.json new file mode 100644 index 00000000000..798889e4759 --- /dev/null +++ b/Resources/Textures/Structures/space_artillery.rsi/meta.json @@ -0,0 +1,15 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Taken from tgstation at https://github.com/tgstation/tgstation/commit/da354ba4e28fcaf73002d25cab0da4815808be60", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "space_artillery", + "directions": 4 + } + ] +} diff --git a/Resources/Textures/Structures/space_artillery.rsi/space_artillery.png b/Resources/Textures/Structures/space_artillery.rsi/space_artillery.png new file mode 100644 index 0000000000000000000000000000000000000000..ef59df7509c1a832925042e37cd12703e0288049 GIT binary patch literal 3046 zcmVPx=ph-kQRCt{2ntNx=E&YhOdUPHTRWW&7Okp6_waJ?EbD9hhT|Uo;w}3+?Ug|4lnm;^4u9BEat5 zyEStE<*-;RvgPyd#en+ydQq>>9GBY!|_{JNQ-$xLt zs;Z=}KQ=a|No+7z~p0spwZj!bjlDx^)2e+yg{W7G#U+NvsslPiTEjdfZ~hLci(-7+wBHm`SRsbc}YnLIXO8L6ck9#WoKstFgiMl z)9I92z~}SfbUGOs8Bt}79HCGsr5@1H(Ls56IRHQW@I%u26$9XMxinU*Rea!q2c)u+ zk`l(p$LZ{oUGBPqK zDJcQMFE(-w0C#5tH6(l$jsyY1z2K8iK0&9`QB+h!US3{|tjFV_p`n4jd-rnw{CNOI zMn>-2d97AUAP|t8A0HoQVq#)OBV=c1V>BAE+wBw-6fiI_Kw4T_()v}e1$ujXF_}z2 zcu<;{n3y3`R8$1O`t|GCw{M@?sui(Xt>Tg;OQcudXs08s9$|EJl+n>qDl02#ZEcmx zZ8n?O*x0Dp2&w|m-QA7ZY-VC&0znX{tgHm!=+UD9)YQ}f(AwHcdU`r0lZl3g2DN_5 zVzpYuRjXDpJv|MC8z4VFpVHD&ApAJS53t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y1Ki&rQZ>f*%k~2$;!%-e2QnrBOnL@&$qS3 zl=*x(;H4K59|AM`;F-v(4x8#mGG0))tdliZG)GghC-U0(-q) z1VNy`zn{#^Ok6G(BO@bH#qkQF2?m4G_4pQ3L;O8HpD(7)c%p3@8XA&p?(gqM5Cptl zFB^gFQDa(!83Ay)TpBDE@%r`aEM2;kJ$v?GHk)xeow!`Cq$jna5d=XxFQgW^d(`S1 z8yh1hCkLz5N_BNL-QC^1^2#exj?v|EX;i%lo+W%RqNJpRLx&D=^5jW;J|BgJg$Ykv zL_49;gs0n7*9GzNRaI5u`1m-2AgBsNVPPR{ZEd*SZhSr;B_$SlF#s-HxPTxCM9%C-e*oz_6bdmpIXNqfqL!8x&E({yG$lvtivI|L zAZv5u@NhUmDnr7>Q16e2oDb#ZN@bx?2(4Bdb5AJl+0tsYJp1%oDmMRdRu)5TC*Bi3 zINc?yC*F?evX_R30Wd{5AO8p>-4m>;suI_ig{QLfJr@;QRju5;GFx_}v?tiy=n&5w zchLW>pWE}&`19cxr2Jcq+z}bMBQxdhmF6Q3@y~}};P$*U`oHya=D0(){^mv*IT?GS zNxCC6dObV^dA(j%nv@SdtChP~R+`LsyPx#07*qoM6N<$f>JEd^8f$< literal 0 HcmV?d00001 From 552c37a06bccd6ce4a21ebe401cf4c0fd49b674b Mon Sep 17 00:00:00 2001 From: Qulibly Date: Fri, 28 Jul 2023 19:22:12 +0200 Subject: [PATCH 2/3] WIP Attempting at allowing the space artillery to be fired without need to be held --- .../Components/SpaceArtilleryComponent.txt | 23 ++++++++ .../SpaceArtillery/SpaceArtillerySystem.cs | 49 +++++++++++++++++ .../SharedSpaceArtilleryComponent.cs | 23 ++++++++ .../SharedSpaceArtillerySystem.txt | 53 +++++++++++++++++++ .../Entities/Structures/space_artillery.yml | 1 + 5 files changed, 149 insertions(+) create mode 100644 Content.Server/SpaceArtillery/Components/SpaceArtilleryComponent.txt create mode 100644 Content.Server/SpaceArtillery/SpaceArtillerySystem.cs create mode 100644 Content.Shared/SpaceArtillery/Components/SharedSpaceArtilleryComponent.cs create mode 100644 Content.Shared/SpaceArtillery/SharedSpaceArtillerySystem.txt diff --git a/Content.Server/SpaceArtillery/Components/SpaceArtilleryComponent.txt b/Content.Server/SpaceArtillery/Components/SpaceArtilleryComponent.txt new file mode 100644 index 00000000000..0e0afd4bf66 --- /dev/null +++ b/Content.Server/SpaceArtillery/Components/SpaceArtilleryComponent.txt @@ -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.Components; + +[RegisterComponent, NetworkedComponent] +public sealed class SpaceArtilleryComponent : Component +{ + + /// + /// Signal port that makes space artillery fire. + /// + [DataField("firePort", customTypeSerializer: typeof(PrototypeIdSerializer))] + public string FirePort = "Fire"; + +} \ No newline at end of file diff --git a/Content.Server/SpaceArtillery/SpaceArtillerySystem.cs b/Content.Server/SpaceArtillery/SpaceArtillerySystem.cs new file mode 100644 index 00000000000..645035f1638 --- /dev/null +++ b/Content.Server/SpaceArtillery/SpaceArtillerySystem.cs @@ -0,0 +1,49 @@ +using Content.Server.Storage.EntitySystems; +using Content.Shared.Containers.ItemSlots; +using Content.Shared.Interaction; +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(OnInteractHand); + //SubscribeLocalEvent>(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(user, null); + RaiseLocalEvent(gunUid, ref attemptEv); + } + + +// private void Fire(EntityUid uid, EmitterComponent component) +// { +// if (!TryComp(uid, out var gunComponent)) +// return; +// +// var xform = Transform(uid); +// var ent = Spawn(component.BoltType, xform.Coordinates); +// var proj = EnsureComp(ent); +// _projectile.SetShooter(proj, uid); +// +// var targetPos = new EntityCoordinates(uid, new Vector2(0, -1)); +// +// _gun.Shoot(uid, gunComponent, ent, xform.Coordinates, targetPos, out _); +// } + } +} diff --git a/Content.Shared/SpaceArtillery/Components/SharedSpaceArtilleryComponent.cs b/Content.Shared/SpaceArtillery/Components/SharedSpaceArtilleryComponent.cs new file mode 100644 index 00000000000..f0819bb4c6d --- /dev/null +++ b/Content.Shared/SpaceArtillery/Components/SharedSpaceArtilleryComponent.cs @@ -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.Shared.SpaceArtillery.Components; + +[RegisterComponent, NetworkedComponent] +public sealed class SpaceArtilleryComponent : Component +{ + + /// + /// Signal port that makes space artillery fire. + /// + [DataField("firePort", customTypeSerializer: typeof(PrototypeIdSerializer))] + public string FirePort = "Fire"; + +} \ No newline at end of file diff --git a/Content.Shared/SpaceArtillery/SharedSpaceArtillerySystem.txt b/Content.Shared/SpaceArtillery/SharedSpaceArtillerySystem.txt new file mode 100644 index 00000000000..cab1fa9b842 --- /dev/null +++ b/Content.Shared/SpaceArtillery/SharedSpaceArtillerySystem.txt @@ -0,0 +1,53 @@ +using Content.Server.Storage.EntitySystems; +using Content.Shared.Containers.ItemSlots; +using Content.Shared.Interaction; +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 +{ + [UsedImplicitly] + public sealed class SharedSpaceArtillerySystem : EntitySystem + { + // [Dependency] private readonly SharedPopupSystem _popup = default!; + // [Dependency] private readonly ProjectileSystem _projectile = default!; + // [Dependency] private readonly GunSystem _gun = default!; + + //public override void Initialize() + //{ + // base.Initialize(); + // + // SubscribeLocalEvent(OnInteractHand); + // //SubscribeLocalEvent>(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, EmitterComponent component, InteractHandEvent args) + //{ + // if (args.Handled) + // return; + // + //var attemptEv = new AttemptShootEvent(user, null); + //RaiseLocalEvent(gunUid, ref attemptEv); + //} + + +// private void Fire(EntityUid uid, EmitterComponent component) +// { +// if (!TryComp(uid, out var gunComponent)) +// return; +// +// var xform = Transform(uid); +// var ent = Spawn(component.BoltType, xform.Coordinates); +// var proj = EnsureComp(ent); +// _projectile.SetShooter(proj, uid); +// +// var targetPos = new EntityCoordinates(uid, new Vector2(0, -1)); +// +// _gun.Shoot(uid, gunComponent, ent, xform.Coordinates, targetPos, out _); +// } + } +} diff --git a/Resources/Prototypes/Entities/Structures/space_artillery.yml b/Resources/Prototypes/Entities/Structures/space_artillery.yml index b6a5b113387..ceb2f1e8b4a 100644 --- a/Resources/Prototypes/Entities/Structures/space_artillery.yml +++ b/Resources/Prototypes/Entities/Structures/space_artillery.yml @@ -6,6 +6,7 @@ placement: mode: SnapgridCenter components: + - type: SpaceArtillery - type: Clickable - type: InteractionOutline - type: Physics From 2683a43910151692b716d28f5036eb0cf3f38456 Mon Sep 17 00:00:00 2001 From: Qulibly Date: Sat, 29 Jul 2023 21:33:30 +0200 Subject: [PATCH 3/3] WIP further attempts at trying to get the firing of space artillery working --- .../Components/SpaceArtilleryComponent.cs | 2 +- .../Components/SpaceArtilleryComponent.txt | 23 -------- .../SpaceArtillery/SpaceArtillerySystem.cs | 7 +-- .../SharedSpaceArtillerySystem.txt | 53 ------------------- 4 files changed, 5 insertions(+), 80 deletions(-) rename Content.Shared/SpaceArtillery/Components/SharedSpaceArtilleryComponent.cs => Content.Server/SpaceArtillery/Components/SpaceArtilleryComponent.cs (93%) delete mode 100644 Content.Server/SpaceArtillery/Components/SpaceArtilleryComponent.txt delete mode 100644 Content.Shared/SpaceArtillery/SharedSpaceArtillerySystem.txt diff --git a/Content.Shared/SpaceArtillery/Components/SharedSpaceArtilleryComponent.cs b/Content.Server/SpaceArtillery/Components/SpaceArtilleryComponent.cs similarity index 93% rename from Content.Shared/SpaceArtillery/Components/SharedSpaceArtilleryComponent.cs rename to Content.Server/SpaceArtillery/Components/SpaceArtilleryComponent.cs index f0819bb4c6d..266ce287aae 100644 --- a/Content.Shared/SpaceArtillery/Components/SharedSpaceArtilleryComponent.cs +++ b/Content.Server/SpaceArtillery/Components/SpaceArtilleryComponent.cs @@ -8,7 +8,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary; -namespace Content.Shared.SpaceArtillery.Components; +namespace Content.Server.SpaceArtillery; [RegisterComponent, NetworkedComponent] public sealed class SpaceArtilleryComponent : Component diff --git a/Content.Server/SpaceArtillery/Components/SpaceArtilleryComponent.txt b/Content.Server/SpaceArtillery/Components/SpaceArtilleryComponent.txt deleted file mode 100644 index 0e0afd4bf66..00000000000 --- a/Content.Server/SpaceArtillery/Components/SpaceArtilleryComponent.txt +++ /dev/null @@ -1,23 +0,0 @@ -//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.Components; - -[RegisterComponent, NetworkedComponent] -public sealed class SpaceArtilleryComponent : Component -{ - - /// - /// Signal port that makes space artillery fire. - /// - [DataField("firePort", customTypeSerializer: typeof(PrototypeIdSerializer))] - public string FirePort = "Fire"; - -} \ No newline at end of file diff --git a/Content.Server/SpaceArtillery/SpaceArtillerySystem.cs b/Content.Server/SpaceArtillery/SpaceArtillerySystem.cs index 645035f1638..71255b24f97 100644 --- a/Content.Server/SpaceArtillery/SpaceArtillerySystem.cs +++ b/Content.Server/SpaceArtillery/SpaceArtillerySystem.cs @@ -1,6 +1,7 @@ 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; @@ -25,9 +26,9 @@ private void OnInteractHand(EntityUid uid, SpaceArtilleryComponent component, In { if (args.Handled) return; - - var attemptEv = new AttemptShootEvent(user, null); - RaiseLocalEvent(gunUid, ref attemptEv); + + var attemptEv = new AttemptShootEvent(uid, null); + RaiseLocalEvent(uid, attemptEv); } diff --git a/Content.Shared/SpaceArtillery/SharedSpaceArtillerySystem.txt b/Content.Shared/SpaceArtillery/SharedSpaceArtillerySystem.txt deleted file mode 100644 index cab1fa9b842..00000000000 --- a/Content.Shared/SpaceArtillery/SharedSpaceArtillerySystem.txt +++ /dev/null @@ -1,53 +0,0 @@ -using Content.Server.Storage.EntitySystems; -using Content.Shared.Containers.ItemSlots; -using Content.Shared.Interaction; -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 -{ - [UsedImplicitly] - public sealed class SharedSpaceArtillerySystem : EntitySystem - { - // [Dependency] private readonly SharedPopupSystem _popup = default!; - // [Dependency] private readonly ProjectileSystem _projectile = default!; - // [Dependency] private readonly GunSystem _gun = default!; - - //public override void Initialize() - //{ - // base.Initialize(); - // - // SubscribeLocalEvent(OnInteractHand); - // //SubscribeLocalEvent>(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, EmitterComponent component, InteractHandEvent args) - //{ - // if (args.Handled) - // return; - // - //var attemptEv = new AttemptShootEvent(user, null); - //RaiseLocalEvent(gunUid, ref attemptEv); - //} - - -// private void Fire(EntityUid uid, EmitterComponent component) -// { -// if (!TryComp(uid, out var gunComponent)) -// return; -// -// var xform = Transform(uid); -// var ent = Spawn(component.BoltType, xform.Coordinates); -// var proj = EnsureComp(ent); -// _projectile.SetShooter(proj, uid); -// -// var targetPos = new EntityCoordinates(uid, new Vector2(0, -1)); -// -// _gun.Shoot(uid, gunComponent, ent, xform.Coordinates, targetPos, out _); -// } - } -}