Add a LOT more dakka (#1033)

* Start adding flashy flash

* Change slop

Might give a smoother decline

* flashy flash

* Add flashbang and flash projectiles

Bang bang bang pull my flash trigger

* Add collision check to area flash

* Flash cleanupo

* flash.ogg mixed to mono
* Adjusted flash curve again

* Enhancing flashes with unshaded and lights and shit

Still a WIP

* Add the other ballistic gun types

Re-organised some of the gun stuff so the powercell guns share the shooting code with the ballistic guns.

* Re-merging branch with master

Also fixed some visualizer bugs

* Last cleanup

Fixed some crashes
Fixed Deckard sprite
Fixed Hitscan effects
Re-applied master changes
Re-factor to using soundsystem
Add some more audio effects

* Cleanup flashes for merge

Can put flashbangs in lockers so you don't get blinded

Fix some bugs

* Fix shotties

Also removed some redundant code

* Bulldoze some legacycode

brrrrrrrrt

* Fix clientignore warnings

* Add the other Stunnable types to StunnableProjectile

* Some gun refactoring

* Removed extra visualizers
* All casing ejections use the same code
* Speed loaders can have their ammo pulled out
* Bolt sound less loud

* Stop ThrowController from throwing

* Fix speed loader visuals

* Update hitscan collision mask and fix typo

* Cleanup

* Fit hitscan and flashbang collisions
* Use the new flags support

* Update taser placeholder description

* Update protonames per style guide

* Add yaml flag support for gun firerates

* Cleanup crew

* Fix Audio up (components, audio file, + remove global sounds)
* Add server-side recoil back-in (forgot that I was testing this client-side)
* Add Flag support for fire-rate selectors

* Wrong int you dolt

* Fix AI conflicts

Haha ranged bulldozer go BRR
(I'll rewrite it after the other AI systems are done).

* Mix bang.ogg from stereo to mono

* Make sure serializer's reading for guns

Fixes integration test

* Change EntitySystem calls to use the static function

Also removed the Pumpbarrel commented-out code

* Change StunnableProjectile defaults to 0

* Fix taser paralyse

Apparently removing defaults means you have to specify the values, whodathunkit

* Add slowdown to stunnableprojectiles and fix tasers

* Remove FlagsFor from gun components

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
This commit is contained in:
metalgearsloth
2020-06-22 05:47:15 +10:00
committed by GitHub
parent ac19ad7eac
commit 95995b6232
1977 changed files with 13600 additions and 11229 deletions

View File

@@ -1,4 +1,5 @@
using System;
using Content.Server.GameObjects.Components.Weapon.Ranged.Barrels;
using Content.Shared.GameObjects.Components.Power;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.Components.Container;
@@ -13,7 +14,7 @@ namespace Content.Server.GameObjects.Components.Power.Chargers
public abstract class BaseCharger : Component
{
public IEntity HeldItem { get; protected set; }
protected IEntity _heldItem;
protected ContainerSlot _container;
protected PowerDeviceComponent _powerDevice;
public CellChargerStatus Status => _status;
@@ -58,37 +59,28 @@ namespace Content.Server.GameObjects.Components.Power.Chargers
}
/// <summary>
/// This will remove the item directly into the user's hand rather than the floor
/// This will remove the item directly into the user's hand / floor
/// </summary>
/// <param name="user"></param>
public void RemoveItemToHand(IEntity user)
public void RemoveItem(IEntity user)
{
var heldItem = _container.ContainedEntity;
if (heldItem == null)
{
return;
}
RemoveItem();
if (user.TryGetComponent(out HandsComponent handsComponent) &&
heldItem.TryGetComponent(out ItemComponent itemComponent))
_container.Remove(heldItem);
if (user.TryGetComponent(out HandsComponent handsComponent))
{
handsComponent.PutInHand(itemComponent);
}
}
/// <summary>
/// Will put the charger's item on the floor if available
/// </summary>
public void RemoveItem()
{
if (_container.ContainedEntity == null)
{
return;
handsComponent.PutInHandOrDrop(heldItem.GetComponent<ItemComponent>());
}
_container.Remove(HeldItem);
HeldItem = null;
if (heldItem.TryGetComponent(out ServerBatteryBarrelComponent batteryBarrelComponent))
{
batteryBarrelComponent.UpdateAppearance();
}
UpdateStatus();
}
@@ -135,8 +127,6 @@ namespace Content.Server.GameObjects.Components.Power.Chargers
}
_appearanceComponent?.SetData(CellVisual.Occupied, _container.ContainedEntity != null);
_status = status;
}
public void OnUpdate(float frameTime)

View File

@@ -53,7 +53,7 @@ namespace Content.Server.GameObjects.Components.Power.Chargers
void IActivate.Activate(ActivateEventArgs eventArgs)
{
RemoveItemToHand(eventArgs.User);
RemoveItem(eventArgs.User);
}
[Verb]
@@ -111,7 +111,7 @@ namespace Content.Server.GameObjects.Components.Power.Chargers
protected override void Activate(IEntity user, PowerCellChargerComponent component)
{
component.RemoveItem();
component.RemoveItem(user);
}
}
@@ -122,9 +122,8 @@ namespace Content.Server.GameObjects.Components.Power.Chargers
{
return false;
}
HeldItem = entity;
if (!_container.Insert(HeldItem))
if (!_container.Insert(entity))
{
return false;
}
@@ -157,7 +156,7 @@ namespace Content.Server.GameObjects.Components.Power.Chargers
{
// Two numbers: One for how much power actually goes into the device (chargeAmount) and
// chargeLoss which is how much is drawn from the powernet
_container.ContainedEntity.TryGetComponent(out PowerCellComponent cellComponent);
var cellComponent = _container.ContainedEntity.GetComponent<PowerCellComponent>();
var chargeLoss = cellComponent.RequestCharge(frameTime) * _transferRatio;
_powerDevice.Load = chargeLoss;

View File

@@ -1,18 +1,13 @@
using System;
using Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan;
using Content.Server.GameObjects.Components.Weapon.Ranged.Barrels;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Utility;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Power;
using Content.Shared.Interfaces;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.Components.Container;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Power.Chargers
{
@@ -26,8 +21,8 @@ namespace Content.Server.GameObjects.Components.Power.Chargers
{
public override string Name => "WeaponCapacitorCharger";
public override double CellChargePercent => _container.ContainedEntity != null ?
_container.ContainedEntity.GetComponent<HitscanWeaponCapacitorComponent>().Charge /
_container.ContainedEntity.GetComponent<HitscanWeaponCapacitorComponent>().Capacity * 100 : 0.0f;
_container.ContainedEntity.GetComponent<ServerBatteryBarrelComponent>().PowerCell.Charge /
_container.ContainedEntity.GetComponent<ServerBatteryBarrelComponent>().PowerCell.Capacity * 100 : 0.0f;
bool IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
{
@@ -43,7 +38,7 @@ namespace Content.Server.GameObjects.Components.Power.Chargers
void IActivate.Activate(ActivateEventArgs eventArgs)
{
RemoveItemToHand(eventArgs.User);
RemoveItem(eventArgs.User);
}
[Verb]
@@ -106,21 +101,19 @@ namespace Content.Server.GameObjects.Components.Power.Chargers
protected override void Activate(IEntity user, WeaponCapacitorChargerComponent component)
{
component.RemoveItem();
component.RemoveItem(user);
}
}
public bool TryInsertItem(IEntity entity)
{
if (!entity.HasComponent<HitscanWeaponCapacitorComponent>() ||
if (!entity.HasComponent<ServerBatteryBarrelComponent>() ||
_container.ContainedEntity != null)
{
return false;
}
HeldItem = entity;
if (!_container.Insert(HeldItem))
if (!_container.Insert(entity))
{
return false;
}
@@ -140,8 +133,8 @@ namespace Content.Server.GameObjects.Components.Power.Chargers
return CellChargerStatus.Empty;
}
if (_container.ContainedEntity.TryGetComponent(out HitscanWeaponCapacitorComponent component) &&
Math.Abs(component.Capacity - component.Charge) < 0.01)
if (_container.ContainedEntity.TryGetComponent(out ServerBatteryBarrelComponent component) &&
Math.Abs(component.PowerCell.Capacity - component.PowerCell.Charge) < 0.01)
{
return CellChargerStatus.Charged;
}
@@ -153,8 +146,8 @@ namespace Content.Server.GameObjects.Components.Power.Chargers
{
// Two numbers: One for how much power actually goes into the device (chargeAmount) and
// chargeLoss which is how much is drawn from the powernet
_container.ContainedEntity.TryGetComponent(out HitscanWeaponCapacitorComponent weaponCapacitorComponent);
var chargeLoss = weaponCapacitorComponent.RequestCharge(frameTime) * _transferRatio;
var powerCell = _container.ContainedEntity.GetComponent<ServerBatteryBarrelComponent>().PowerCell;
var chargeLoss = powerCell.RequestCharge(frameTime) * _transferRatio;
_powerDevice.Load = chargeLoss;
if (!_powerDevice.Powered)
@@ -165,14 +158,13 @@ namespace Content.Server.GameObjects.Components.Power.Chargers
var chargeAmount = chargeLoss * _transferEfficiency;
weaponCapacitorComponent.AddCharge(chargeAmount);
powerCell.AddCharge(chargeAmount);
// Just so the sprite won't be set to 99.99999% visibility
if (weaponCapacitorComponent.Capacity - weaponCapacitorComponent.Charge < 0.01)
if (powerCell.Capacity - powerCell.Charge < 0.01)
{
weaponCapacitorComponent.Charge = weaponCapacitorComponent.Capacity;
powerCell.Charge = powerCell.Capacity;
}
UpdateStatus();
}
}
}