2020-06-28 09:23:26 -06:00
|
|
|
|
using System;
|
2020-06-22 05:47:15 +10:00
|
|
|
|
using System.Collections.Generic;
|
2020-08-18 14:39:08 +02:00
|
|
|
|
using System.Threading.Tasks;
|
2020-07-25 15:11:16 +02:00
|
|
|
|
using Content.Server.GameObjects.Components.GUI;
|
2020-08-13 14:40:27 +02:00
|
|
|
|
using Content.Server.GameObjects.Components.Items.Storage;
|
2020-06-22 05:47:15 +10:00
|
|
|
|
using Content.Server.GameObjects.Components.Power;
|
|
|
|
|
|
using Content.Server.GameObjects.Components.Projectiles;
|
Bodysystem and damagesystem rework (#1544)
* Things and stuff with grids, unfinished w/ code debug changes.
* Updated submodule and also lost some progress cause I fucked it up xd
* First unfinished draft of the BodySystem. Doesn't compile.
* More changes to make it compile, but still just a framework. Doesn't do anything at the moment.
* Many cleanup changes.
* Revert "Merge branch 'master' of https://github.com/GlassEclipse/space-station-14 into body_system"
This reverts commit ddd4aebbc76cf2a0b7b102f72b93d55a0816c88c, reversing
changes made to 12d0dd752706bdda8879393bd8191a1199a0c978.
* Commit human.yml
* Updated a lot of things to be more classy, more progress overall, etc. etc.
* Latest update with many changes
* Minor changes
* Fixed Travis build bug
* Adds first draft of Body Scanner console, apparently I also forgot to tie Mechanisms into body parts so now a heart just sits in the Torso like a good boy :)
* Commit rest of stuff
* Latest changes
* Latest changes again
* 14 naked cowboys
* Yay!
* Latest changes (probably doesnt compile)
* Surgery!!!!!!!!!~1116y
* Cleaned some stuff up
* More cleanup
* Refactoring of code. Basic surgery path now done.
* Removed readme, has been added to HackMD
* Fixes typo (and thus test errors)
* WIP changes, committing so I can pull latest master changes
* Still working on that god awful merge
* Latest changes
* Latest changes!!
* Beginning of refactor to BoundUserInterface
* Surgery!
* Latest changes - fixes pr change requests and random fixes
* oops
* Fixes bodypart recursion
* Beginning of work on revamping the damage system.
* More latest changes
* Latest changes
* Finished merge
* Commit before removing old healthcode
* Almost done with removing speciescomponent...
* It compiles!!!
* yahoo more work
* Fixes to make it work
* Merge conflict fixes
* Deleting species visualizer was a mistake
* IDE warnings are VERBOTEN
* makes the server not kill itself on startup, some cleanup (#1)
* Namespaces, comments and exception fixes
* Fix conveyor and conveyor switch serialization
SS14 in reactive when
* Move damage, acts and body to shared
Damage cleanup
Comment cleanup
* Rename SpeciesComponent to RotationComponent and cleanup
Damage cleanup
Comment cleanup
* Fix nullable warnings
* Address old reviews
Fix off welder suicide damage type, deathmatch and suspicion
* Fix new test fail with units being able to accept items when unpowered
* Remove RotationComponent, change references to IBodyManagerComponent
* Add a bloodstream to humans
* More cleanups
* Add body conduits, connections, connectors substances and valves
* Revert "Add body conduits, connections, connectors substances and valves"
This reverts commit 9ab0b50e6b15fe98852d7b0836c0cdbf4bd76d20.
* Implement the heart mechanism behavior with the circulatory network
* Added network property to mechanism behaviors
* Changed human organ sprites and added missing ones
* Fix tests
* Add individual body part sprite rendering
* Fix error where dropped mechanisms are not initialized
* Implement client/server body damage
* Make DamageContainer take care of raising events
* Reimplement medical scanner with the new body system
* Improve the medical scanner ui
* Merge conflict fixes
* Fix crash when colliding with something
* Fix microwave suicides and eyes sprite rendering
* Fix nullable reference error
* Fix up surgery client side
* Fix missing using from merge conflict
* Add breathing
*inhale
* Merge conflict fixes
* Fix accumulatedframetime being reset to 0 instead of decreased by the threshold
https://github.com/space-wizards/space-station-14/pull/1617
* Use and add to the new AtmosHelpers
* Fix feet
* Add proper coloring to dropped body parts
* Fix Urist's lungs being too strong
* Merge conflict fixes
* Merge conflict fixes
* Merge conflict fixes
Co-authored-by: GlassEclipse <tsymall5@gmail.com>
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
Co-authored-by: AJCM-git <60196617+AJCM-git@users.noreply.github.com>
2020-08-17 01:42:42 +02:00
|
|
|
|
using Content.Shared.Damage;
|
2020-08-27 16:31:29 +02:00
|
|
|
|
using Content.Shared.GameObjects;
|
2020-06-22 05:47:15 +10:00
|
|
|
|
using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels;
|
2020-08-27 16:31:29 +02:00
|
|
|
|
using Content.Shared.GameObjects.EntitySystems;
|
|
|
|
|
|
using Content.Shared.GameObjects.Verbs;
|
2020-07-18 22:51:56 -07:00
|
|
|
|
using Content.Shared.Interfaces.GameObjects.Components;
|
2020-06-22 05:47:15 +10:00
|
|
|
|
using Robust.Server.GameObjects;
|
|
|
|
|
|
using Robust.Server.GameObjects.Components.Container;
|
|
|
|
|
|
using Robust.Server.GameObjects.EntitySystems;
|
|
|
|
|
|
using Robust.Shared.Audio;
|
|
|
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
|
using Robust.Shared.GameObjects.Systems;
|
|
|
|
|
|
using Robust.Shared.Interfaces.GameObjects;
|
2020-08-29 13:36:02 +02:00
|
|
|
|
using Robust.Shared.Localization;
|
2020-06-24 20:00:31 +02:00
|
|
|
|
using Robust.Shared.Map;
|
2020-06-22 05:47:15 +10:00
|
|
|
|
using Robust.Shared.Serialization;
|
|
|
|
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
|
|
|
|
|
{
|
|
|
|
|
|
[RegisterComponent]
|
|
|
|
|
|
public sealed class ServerBatteryBarrelComponent : ServerRangedBarrelComponent
|
|
|
|
|
|
{
|
|
|
|
|
|
public override string Name => "BatteryBarrel";
|
2020-08-27 16:31:29 +02:00
|
|
|
|
public override uint? NetID => ContentNetIDs.BATTERY_BARREL;
|
2020-06-22 05:47:15 +10:00
|
|
|
|
|
|
|
|
|
|
// The minimum change we need before we can fire
|
|
|
|
|
|
[ViewVariables] private float _lowerChargeLimit;
|
|
|
|
|
|
[ViewVariables] private int _baseFireCost;
|
|
|
|
|
|
// What gets fired
|
|
|
|
|
|
[ViewVariables] private string _ammoPrototype;
|
|
|
|
|
|
|
|
|
|
|
|
[ViewVariables] public IEntity PowerCellEntity => _powerCellContainer.ContainedEntity;
|
2020-06-28 09:23:26 -06:00
|
|
|
|
public BatteryComponent PowerCell => _powerCellContainer.ContainedEntity.GetComponent<BatteryComponent>();
|
2020-06-22 05:47:15 +10:00
|
|
|
|
private ContainerSlot _powerCellContainer;
|
|
|
|
|
|
private ContainerSlot _ammoContainer;
|
|
|
|
|
|
private string _powerCellPrototype;
|
|
|
|
|
|
[ViewVariables] private bool _powerCellRemovable;
|
|
|
|
|
|
|
|
|
|
|
|
public override int ShotsLeft
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
var powerCell = _powerCellContainer.ContainedEntity;
|
|
|
|
|
|
|
|
|
|
|
|
if (powerCell == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-06-28 09:23:26 -06:00
|
|
|
|
return (int) Math.Ceiling(powerCell.GetComponent<BatteryComponent>().CurrentCharge / _baseFireCost);
|
2020-06-22 05:47:15 +10:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override int Capacity
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
var powerCell = _powerCellContainer.ContainedEntity;
|
|
|
|
|
|
|
|
|
|
|
|
if (powerCell == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-06-28 09:23:26 -06:00
|
|
|
|
return (int) Math.Ceiling((float) (powerCell.GetComponent<BatteryComponent>().MaxCharge / _baseFireCost));
|
2020-06-22 05:47:15 +10:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-07-06 14:27:03 -07:00
|
|
|
|
|
2020-06-22 05:47:15 +10:00
|
|
|
|
private AppearanceComponent _appearanceComponent;
|
2020-07-06 14:27:03 -07:00
|
|
|
|
|
2020-06-22 05:47:15 +10:00
|
|
|
|
// Sounds
|
|
|
|
|
|
private string _soundPowerCellInsert;
|
|
|
|
|
|
private string _soundPowerCellEject;
|
|
|
|
|
|
|
|
|
|
|
|
public override void ExposeData(ObjectSerializer serializer)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.ExposeData(serializer);
|
|
|
|
|
|
|
2020-07-23 01:46:09 +02:00
|
|
|
|
serializer.DataField(ref _powerCellPrototype, "powerCellPrototype", null);
|
2020-06-22 05:47:15 +10:00
|
|
|
|
serializer.DataField(ref _powerCellRemovable, "powerCellRemovable", false);
|
|
|
|
|
|
serializer.DataField(ref _baseFireCost, "fireCost", 300);
|
|
|
|
|
|
serializer.DataField(ref _ammoPrototype, "ammoPrototype", null);
|
|
|
|
|
|
serializer.DataField(ref _lowerChargeLimit, "lowerChargeLimit", 10);
|
|
|
|
|
|
serializer.DataField(ref _soundPowerCellInsert, "soundPowerCellInsert", null);
|
|
|
|
|
|
serializer.DataField(ref _soundPowerCellEject, "soundPowerCellEject", null);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-08-27 16:31:29 +02:00
|
|
|
|
public override ComponentState GetComponentState()
|
|
|
|
|
|
{
|
|
|
|
|
|
(int, int)? count = (ShotsLeft, Capacity);
|
|
|
|
|
|
|
|
|
|
|
|
return new BatteryBarrelComponentState(
|
|
|
|
|
|
FireRateSelector,
|
|
|
|
|
|
count);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-06-22 05:47:15 +10:00
|
|
|
|
public override void Initialize()
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Initialize();
|
|
|
|
|
|
_powerCellContainer = ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-powercell-container", Owner, out var existing);
|
|
|
|
|
|
if (!existing && _powerCellPrototype != null)
|
|
|
|
|
|
{
|
2020-09-06 16:11:53 +02:00
|
|
|
|
var powerCellEntity = Owner.EntityManager.SpawnEntity(_powerCellPrototype, Owner.Transform.Coordinates);
|
2020-06-22 05:47:15 +10:00
|
|
|
|
_powerCellContainer.Insert(powerCellEntity);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (_ammoPrototype != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_ammoContainer = ContainerManagerComponent.Ensure<ContainerSlot>($"{Name}-ammo-container", Owner);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (Owner.TryGetComponent(out AppearanceComponent appearanceComponent))
|
|
|
|
|
|
{
|
|
|
|
|
|
_appearanceComponent = appearanceComponent;
|
|
|
|
|
|
}
|
2020-07-06 14:27:03 -07:00
|
|
|
|
|
2020-08-27 16:31:29 +02:00
|
|
|
|
Dirty();
|
2020-06-22 05:47:15 +10:00
|
|
|
|
UpdateAppearance();
|
|
|
|
|
|
}
|
2020-07-06 14:27:03 -07:00
|
|
|
|
|
2020-06-22 05:47:15 +10:00
|
|
|
|
public void UpdateAppearance()
|
|
|
|
|
|
{
|
|
|
|
|
|
_appearanceComponent?.SetData(MagazineBarrelVisuals.MagLoaded, _powerCellContainer.ContainedEntity != null);
|
|
|
|
|
|
_appearanceComponent?.SetData(AmmoVisuals.AmmoCount, ShotsLeft);
|
|
|
|
|
|
_appearanceComponent?.SetData(AmmoVisuals.AmmoMax, Capacity);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override IEntity PeekAmmo()
|
|
|
|
|
|
{
|
|
|
|
|
|
// Spawn a dummy entity because it's easier to work with I guess
|
|
|
|
|
|
// This will get re-used for the projectile
|
|
|
|
|
|
var ammo = _ammoContainer.ContainedEntity;
|
|
|
|
|
|
if (ammo == null)
|
|
|
|
|
|
{
|
2020-09-06 16:11:53 +02:00
|
|
|
|
ammo = Owner.EntityManager.SpawnEntity(_ammoPrototype, Owner.Transform.Coordinates);
|
2020-06-22 05:47:15 +10:00
|
|
|
|
_ammoContainer.Insert(ammo);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return ammo;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-09-06 16:11:53 +02:00
|
|
|
|
public override IEntity TakeProjectile(EntityCoordinates spawnAtGrid, MapCoordinates spawnAtMap)
|
2020-06-22 05:47:15 +10:00
|
|
|
|
{
|
|
|
|
|
|
var powerCellEntity = _powerCellContainer.ContainedEntity;
|
|
|
|
|
|
|
|
|
|
|
|
if (powerCellEntity == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-06-28 09:23:26 -06:00
|
|
|
|
var capacitor = powerCellEntity.GetComponent<BatteryComponent>();
|
|
|
|
|
|
if (capacitor.CurrentCharge < _lowerChargeLimit)
|
2020-06-22 05:47:15 +10:00
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Can fire confirmed
|
|
|
|
|
|
// Multiply the entity's damage / whatever by the percentage of charge the shot has.
|
|
|
|
|
|
IEntity entity;
|
2020-06-28 09:23:26 -06:00
|
|
|
|
var chargeChange = Math.Min(capacitor.CurrentCharge, _baseFireCost);
|
|
|
|
|
|
capacitor.UseCharge(chargeChange);
|
2020-06-22 05:47:15 +10:00
|
|
|
|
var energyRatio = chargeChange / _baseFireCost;
|
|
|
|
|
|
|
|
|
|
|
|
if (_ammoContainer.ContainedEntity != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
entity = _ammoContainer.ContainedEntity;
|
|
|
|
|
|
_ammoContainer.Remove(entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2020-07-10 01:53:36 +02:00
|
|
|
|
entity = Owner.Transform.GridID != GridId.Invalid ?
|
2020-09-06 16:11:53 +02:00
|
|
|
|
Owner.EntityManager.SpawnEntity(_ammoPrototype, Owner.Transform.Coordinates)
|
2020-07-10 01:53:36 +02:00
|
|
|
|
: Owner.EntityManager.SpawnEntity(_ammoPrototype, Owner.Transform.MapPosition);
|
2020-06-22 05:47:15 +10:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (entity.TryGetComponent(out ProjectileComponent projectileComponent))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (energyRatio < 1.0)
|
|
|
|
|
|
{
|
2020-06-22 23:19:01 +10:00
|
|
|
|
var newDamages = new Dictionary<DamageType, int>(projectileComponent.Damages.Count);
|
2020-06-22 05:47:15 +10:00
|
|
|
|
foreach (var (damageType, damage) in projectileComponent.Damages)
|
|
|
|
|
|
{
|
|
|
|
|
|
newDamages.Add(damageType, (int) (damage * energyRatio));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
projectileComponent.Damages = newDamages;
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (entity.TryGetComponent(out HitscanComponent hitscanComponent))
|
|
|
|
|
|
{
|
|
|
|
|
|
hitscanComponent.Damage *= energyRatio;
|
|
|
|
|
|
hitscanComponent.ColorModifier = energyRatio;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new InvalidOperationException("Ammo doesn't have hitscan or projectile?");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-08-27 16:31:29 +02:00
|
|
|
|
Dirty();
|
2020-06-22 05:47:15 +10:00
|
|
|
|
UpdateAppearance();
|
|
|
|
|
|
return entity;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool TryInsertPowerCell(IEntity entity)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_powerCellContainer.ContainedEntity != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-06-28 09:23:26 -06:00
|
|
|
|
if (!entity.HasComponent<BatteryComponent>())
|
2020-06-22 05:47:15 +10:00
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (_soundPowerCellInsert != null)
|
|
|
|
|
|
{
|
2020-09-06 16:11:53 +02:00
|
|
|
|
EntitySystem.Get<AudioSystem>().PlayAtCoords(_soundPowerCellInsert, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2));
|
2020-06-22 05:47:15 +10:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_powerCellContainer.Insert(entity);
|
2020-08-27 16:31:29 +02:00
|
|
|
|
|
|
|
|
|
|
Dirty();
|
2020-06-22 05:47:15 +10:00
|
|
|
|
UpdateAppearance();
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-08-27 16:31:29 +02:00
|
|
|
|
public override bool UseEntity(UseEntityEventArgs eventArgs)
|
2020-06-22 05:47:15 +10:00
|
|
|
|
{
|
2020-08-27 16:31:29 +02:00
|
|
|
|
if (!_powerCellRemovable)
|
2020-06-22 05:47:15 +10:00
|
|
|
|
{
|
2020-08-27 16:31:29 +02:00
|
|
|
|
return false;
|
2020-06-22 05:47:15 +10:00
|
|
|
|
}
|
2020-07-06 14:27:03 -07:00
|
|
|
|
|
2020-08-27 16:31:29 +02:00
|
|
|
|
if (PowerCellEntity == null)
|
2020-06-22 05:47:15 +10:00
|
|
|
|
{
|
2020-08-27 16:31:29 +02:00
|
|
|
|
return false;
|
2020-06-22 05:47:15 +10:00
|
|
|
|
}
|
2020-07-06 14:27:03 -07:00
|
|
|
|
|
2020-08-27 16:31:29 +02:00
|
|
|
|
return TryEjectCell(eventArgs.User);
|
2020-06-22 05:47:15 +10:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-08-27 16:31:29 +02:00
|
|
|
|
private bool TryEjectCell(IEntity user)
|
2020-06-22 05:47:15 +10:00
|
|
|
|
{
|
2020-08-27 16:31:29 +02:00
|
|
|
|
if (PowerCell == null || !_powerCellRemovable)
|
2020-06-22 05:47:15 +10:00
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2020-07-06 14:27:03 -07:00
|
|
|
|
|
2020-08-27 16:31:29 +02:00
|
|
|
|
if (!user.TryGetComponent(out HandsComponent hands))
|
2020-06-22 05:47:15 +10:00
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-08-27 16:31:29 +02:00
|
|
|
|
var cell = PowerCell;
|
|
|
|
|
|
if (!_powerCellContainer.Remove(cell.Owner))
|
2020-06-22 05:47:15 +10:00
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2020-07-06 14:27:03 -07:00
|
|
|
|
|
2020-08-27 16:31:29 +02:00
|
|
|
|
Dirty();
|
|
|
|
|
|
UpdateAppearance();
|
|
|
|
|
|
|
|
|
|
|
|
if (!hands.PutInHand(cell.Owner.GetComponent<ItemComponent>()))
|
|
|
|
|
|
{
|
2020-09-06 16:11:53 +02:00
|
|
|
|
cell.Owner.Transform.Coordinates = user.Transform.Coordinates;
|
2020-08-27 16:31:29 +02:00
|
|
|
|
}
|
2020-06-22 05:47:15 +10:00
|
|
|
|
|
2020-08-27 16:31:29 +02:00
|
|
|
|
if (_soundPowerCellEject != null)
|
|
|
|
|
|
{
|
2020-09-06 16:11:53 +02:00
|
|
|
|
EntitySystem.Get<AudioSystem>().PlayAtCoords(_soundPowerCellEject, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2));
|
2020-08-27 16:31:29 +02:00
|
|
|
|
}
|
2020-06-22 05:47:15 +10:00
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-08-18 14:39:08 +02:00
|
|
|
|
public override async Task<bool> InteractUsing(InteractUsingEventArgs eventArgs)
|
2020-06-22 05:47:15 +10:00
|
|
|
|
{
|
2020-06-28 09:23:26 -06:00
|
|
|
|
if (!eventArgs.Using.HasComponent<BatteryComponent>())
|
2020-06-22 05:47:15 +10:00
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return TryInsertPowerCell(eventArgs.Using);
|
|
|
|
|
|
}
|
2020-08-27 16:31:29 +02:00
|
|
|
|
|
|
|
|
|
|
[Verb]
|
|
|
|
|
|
public sealed class EjectCellVerb : Verb<ServerBatteryBarrelComponent>
|
|
|
|
|
|
{
|
|
|
|
|
|
protected override void GetData(IEntity user, ServerBatteryBarrelComponent component, VerbData data)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!ActionBlockerSystem.CanInteract(user) || !component._powerCellRemovable)
|
|
|
|
|
|
{
|
|
|
|
|
|
data.Visibility = VerbVisibility.Invisible;
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (component.PowerCell == null)
|
|
|
|
|
|
{
|
2020-08-29 13:36:02 +02:00
|
|
|
|
data.Text = Loc.GetString("Eject cell (cell missing)");
|
2020-08-27 16:31:29 +02:00
|
|
|
|
data.Visibility = VerbVisibility.Disabled;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2020-08-29 13:36:02 +02:00
|
|
|
|
data.Text = Loc.GetString("Eject cell");
|
2020-08-27 16:31:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void Activate(IEntity user, ServerBatteryBarrelComponent component)
|
|
|
|
|
|
{
|
|
|
|
|
|
component.TryEjectCell(user);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-06-22 05:47:15 +10:00
|
|
|
|
}
|
|
|
|
|
|
}
|