Skip to content

Commit

Permalink
[Port] Hristov / Христов | [Port] Manual Sending Of The Cartridge / Р…
Browse files Browse the repository at this point in the history
…учное Досылание Патрона (#58)

* tweak: hristov

* WD EDIT

* fix
  • Loading branch information
Spatison authored Sep 21, 2024
1 parent d044cde commit 2ed017c
Show file tree
Hide file tree
Showing 22 changed files with 129 additions and 17 deletions.
3 changes: 2 additions & 1 deletion Content.Server/Weapons/Ranged/Systems/GunSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ public override void Shoot(EntityUid gunUid, GunComponent gun, List<(EntityUid?
}

// Something like ballistic might want to leave it in the container still
if (!cartridge.DeleteOnSpawn && !Containers.IsEntityInContainer(ent!.Value))
if (!cartridge.DeleteOnSpawn && !Containers.IsEntityInContainer(ent!.Value) &&
(!TryComp(gunUid, out BallisticAmmoProviderComponent? ballistic) || ballistic.AutoCycle)) // WD EDIT
EjectCartridge(ent.Value, angle);

Dirty(ent!.Value, cartridge);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ public sealed partial class BallisticAmmoProviderComponent : Component
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
public bool Cycleable = true;

// WD EDIT START
/// <summary>
/// Automatically cycles the firearm after firing a round
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField]
[AutoNetworkedField]
public bool AutoCycle = true;
// WD EDIT END

/// <summary>
/// Is it okay for this entity to directly transfer its valid ammunition into another provider?
/// </summary>
Expand Down
19 changes: 17 additions & 2 deletions Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,29 @@ private void OnBallisticTakeAmmo(EntityUid uid, BallisticAmmoProviderComponent c
entity = component.Entities[^1];

args.Ammo.Add((entity, EnsureShootable(entity)));
component.Entities.RemoveAt(component.Entities.Count - 1);
Containers.Remove(entity, component.Container);

if (component.AutoCycle) // WD EDIT
{
component.Entities.RemoveAt(component.Entities.Count - 1);
Containers.Remove(entity, component.Container);
}
else
break;
}
else if (component.UnspawnedCount > 0)
{
component.UnspawnedCount--;
entity = Spawn(component.Proto, args.Coordinates);
args.Ammo.Add((entity, EnsureShootable(entity)));

// WD EDIT START
if (!component.AutoCycle && HasComp<CartridgeAmmoComponent>(entity))
{
component.Entities.Add(entity);
Containers.Insert(entity, component.Container);
break;
}
// WD EDIT END
}
}

Expand Down
20 changes: 13 additions & 7 deletions Content.Shared/Wieldable/WieldableSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,10 @@ private void OnMeleeAttempt(EntityUid uid, MeleeRequiresWieldComponent component

private void OnShootAttempt(EntityUid uid, GunRequiresWieldComponent component, ref AttemptShootEvent args)
{
if (TryComp<WieldableComponent>(uid, out var wieldable) &&
!wieldable.Wielded)
if (TryComp<WieldableComponent>(uid, out var wieldable) && !wieldable.Wielded)
{
args.Cancelled = true;

if (!HasComp<MeleeWeaponComponent>(uid) && !HasComp<MeleeRequiresWieldComponent>(uid))
{
args.Message = Loc.GetString("wieldable-component-requires", ("item", uid));
}
args.Message = Loc.GetString("wieldable-component-requires", ("item", uid));
}
}

Expand Down Expand Up @@ -214,6 +209,17 @@ public bool TryWield(EntityUid used, WieldableComponent component, EntityUid use
/// <returns>True if the attempt wasn't blocked.</returns>
public bool TryUnwield(EntityUid used, WieldableComponent component, EntityUid user)
{
// WD EDIT START
if (!component.Wielded)
return false;

if (TryComp<BallisticAmmoProviderComponent>(used, out var ballisticAmmoProvider)
&& ballisticAmmoProvider.Entities.Count != 0
&& TryComp<CartridgeAmmoComponent>(ballisticAmmoProvider.Entities[^1], out var cartridgeAmmo)
&& cartridgeAmmo.Spent)
return false;
// WD EDIT END

var ev = new BeforeUnwieldEvent();
RaiseLocalEvent(used, ev);

Expand Down
4 changes: 4 additions & 0 deletions Resources/Audio/_White/Guns/attributions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- files: ["insert.ogg"]
license: "CC-BY-NC-SA-4.0"
copyright: "Taken from White Dream"
source: "https://github.com/frosty-dev/ss14-core/blob/master/Resources/Audio/White/Gun/insert.ogg"
Binary file added Resources/Audio/_White/Guns/insert.ogg
Binary file not shown.
4 changes: 2 additions & 2 deletions Resources/Prototypes/Catalog/uplink_catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@
description: uplink-sniper-ammo-desc
productEntity: MagazineBoxAntiMateriel
cost:
Telecrystal: 2
Telecrystal: 6 # WD EDIT
categories:
- UplinkAmmo

Expand Down Expand Up @@ -889,7 +889,7 @@
icon: { sprite: /Textures/Objects/Weapons/Guns/Snipers/heavy_sniper.rsi, state: base }
productEntity: BriefcaseSyndieSniperBundleFilled
cost:
Telecrystal: 12
Telecrystal: 20 # WD EDIT
categories:
- UplinkBundles
saleLimit: 1 # WD EDIT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- type: Projectile
damage:
types:
Piercing: 40
Structural: 30
Piercing: 120 #WD edit
Structural: 150 #WD edit
- type: StaminaDamageOnCollide
damage: 35
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
capacity: 1
soundInsert:
path: /Audio/Weapons/Guns/MagIn/batrifle_magin.ogg
autoCycle: false # WD EDIT
- type: MagazineVisuals
magState: mag
steps: 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
- ShellShotgun
capacity: 7
proto: ShellShotgun
autoCycle: false # WD EDIT
soundInsert:
path: /Audio/Weapons/Guns/MagIn/shotgun_insert.ogg
- type: ContainerContainer
Expand Down Expand Up @@ -127,6 +128,7 @@
fireOnDropChance: 0.5
- type: BallisticAmmoProvider
capacity: 2
autoCycle: true # WD EDIT
- type: Construction
graph: ShotgunSawn
node: start
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
whitelist:
tags:
- CartridgeLightRifle
autoCycle: false # WD EDIT
- type: ContainerContainer
containers:
ballistic-ammo: !type:Container
Expand Down Expand Up @@ -75,17 +76,36 @@
id: WeaponSniperHristov
description: A portable anti-materiel rifle. Fires armor piercing 14.5mm shells. Uses .60 anti-materiel ammo.
components:
# WD EDIT START
- type: Sprite
sprite: Objects/Weapons/Guns/Snipers/heavy_sniper.rsi
sprite: _White/Objects/Weapons/Guns/Snipers/hristov-icons.rsi
layers:
- state: base
map: [ "enum.GunVisualLayers.Base" ]
- state: mag-0
map: [ "enum.GunVisualLayers.Mag" ]
- type: Clothing
sprite: Objects/Weapons/Guns/Snipers/heavy_sniper.rsi
sprite: _White/Objects/Weapons/Guns/Snipers/hristov-inhands.rsi
- type: Item
sprite: _White/Objects/Weapons/Guns/Snipers/hristov-inhands.rsi
- type: BallisticAmmoProvider
soundInsert: /Audio/_White/Guns/insert.ogg
whitelist:
tags:
- CartridgeAntiMateriel
capacity: 5
proto: CartridgeAntiMateriel
- type: Telescope # WD EDIT
- type: Gun
fireRate: 0.6
- type: Wieldable
- type: GunRequiresWield
- type: Telescope
- type: MagazineVisuals
magState: mag
steps: 1
zeroVisible: true
- type: Appearance
# WD EDIT END

- type: entity
name: musket
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"version": 1,
"license": "CC-BY-NC-SA-4.0",
"copyright": "WD team",
"size": {
"x": 56,
"y": 32
},
"states": [
{
"name": "base"
},
{
"name": "bolt-open"
},
{
"name": "icon"
},
{
"name": "mag-0"
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"version": 1,
"license": "CC-BY-NC-SA-4.0",
"copyright": "WD team",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "inhand-left",
"directions": 4
},
{
"name": "inhand-right",
"directions": 4
},
{
"name": "wielded-inhand-left",
"directions": 4
},
{
"name": "wielded-inhand-right",
"directions": 4
},
{
"name": "equipped-BACKPACK",
"directions": 4
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2ed017c

Please sign in to comment.