-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding functionality for plasma cutters (#327)
* Plasma-recharge system for cutters * Cutters rebalance * Asteroid rock fix * Remove ATLAS from pull, yea (#326) * How did it get here? * Shit happens * Cutters system upgrade * Add funny shape for cutters (+RP) * Adv cutter recipe & craft nerf * "Ion cutters" are no more! * "shitty code" is now less "shitty" * "Equipment" to "Weapon" * Clear code * Add `technologyPrerequisites:` * I don't know how this happen * `AddCharge` raises localevent now # Conflicts: # Resources/Locale/en-US/research/technologies.ftl # Resources/Locale/en-US/ss14-ru/prototypes/entities/objects/weapons/guns/battery/battery_guns.ftl # Resources/Locale/ru-RU/research/technologies.ftl # Resources/Locale/ru-RU/ss14-ru/prototypes/entities/objects/weapons/guns/battery/battery_guns.ftl # Resources/Prototypes/Entities/Objects/Weapons/Guns/Battery/battery_guns.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml # Resources/Prototypes/Entities/Structures/Machines/lathe.yml # Resources/Prototypes/Recipes/Lathes/security.yml
- Loading branch information
Showing
34 changed files
with
349 additions
and
4 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
Content.Server/ADT/PlasmaCutter/BatteryRechargeComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
///TAKEN FROM: https://github.com/Workbench-Team/space-station-14/pull/327 | ||
|
||
namespace Content.Server.AruMoon.Plasmacutter; | ||
|
||
[RegisterComponent] | ||
public sealed partial class BatteryRechargeComponent : Component | ||
{ | ||
|
||
/// <summary> | ||
/// NOT (material.Amount * Multiplier) | ||
/// This is (material.materialComposition * Multiplier) | ||
/// 1 plasma sheet = 100 material units | ||
/// 1 plasma ore = 500 material units | ||
/// </summary> | ||
/// | ||
[DataField("multiplier"), ViewVariables(VVAccess.ReadWrite)] | ||
public float Multiplier = 1.0f; | ||
|
||
|
||
/// <summary> | ||
/// Max material storage limit | ||
/// 7500 = 15 plasma ore | ||
/// </summary> | ||
[DataField("storageMaxCapacity"), ViewVariables(VVAccess.ReadWrite)] | ||
public int StorageMaxCapacity = 7500; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
///TAKEN FROM: https://github.com/Workbench-Team/space-station-14/pull/327 | ||
|
||
using Content.Server.Materials; | ||
using Content.Shared.Materials; | ||
using Content.Server.Power.EntitySystems; | ||
using Content.Server.Power.Components; | ||
|
||
namespace Content.Server.AruMoon.Plasmacutter | ||
{ | ||
|
||
/// <summary> | ||
/// This CODE FULL OF SHICODE!!! | ||
/// <see cref="BatteryRechargeComponent"/> | ||
/// </summary> | ||
public sealed class BatteryRechargeSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly MaterialStorageSystem _materialStorage = default!; | ||
[Dependency] private readonly BatterySystem _batterySystem = default!; | ||
|
||
|
||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<MaterialStorageComponent, MaterialEntityInsertedEvent>(OnMaterialAmountChanged); | ||
SubscribeLocalEvent<BatteryRechargeComponent, ChargeChangedEvent>(OnChargeChanged); | ||
} | ||
|
||
private void OnMaterialAmountChanged(EntityUid uid, MaterialStorageComponent component, MaterialEntityInsertedEvent args) | ||
{ | ||
if (component.MaterialWhiteList != null) | ||
foreach (var fuelType in component.MaterialWhiteList) | ||
{ | ||
FuelAddCharge(uid, fuelType); | ||
} | ||
} | ||
|
||
private void OnChargeChanged(EntityUid uid, BatteryRechargeComponent component, ChargeChangedEvent args) | ||
{ | ||
ChangeStorageLimit(uid, component.StorageMaxCapacity); | ||
} | ||
|
||
private void ChangeStorageLimit( | ||
EntityUid uid, | ||
int value, | ||
BatteryComponent? battery = null) | ||
{ | ||
if (!Resolve(uid, ref battery)) | ||
return; | ||
if (battery.CurrentCharge == battery.MaxCharge) | ||
value = 0; | ||
_materialStorage.TryChangeStorageLimit(uid, value); | ||
} | ||
|
||
private void FuelAddCharge( | ||
EntityUid uid, | ||
string fuelType, | ||
BatteryRechargeComponent? recharge = null) | ||
{ | ||
if (!Resolve(uid, ref recharge)) | ||
return; | ||
|
||
var availableMaterial = _materialStorage.GetMaterialAmount(uid, fuelType); | ||
var chargePerMaterial = availableMaterial * recharge.Multiplier; | ||
|
||
if (_materialStorage.TryChangeMaterialAmount(uid, fuelType, -availableMaterial)) | ||
{ | ||
_batterySystem.TryAddCharge(uid, chargePerMaterial); | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
research-technology-salvage-weapons-adv = Продвинутое оружие утилизаторов |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
- type: latheRecipe | ||
id: ADTWeaponCutter | ||
result: ADTWeaponCutter | ||
completetime: 10 | ||
materials: | ||
Steel: 1100 | ||
Glass: 200 | ||
Gold: 300 | ||
Plasma: 800 | ||
|
||
- type: latheRecipe | ||
id: ADTWeaponCutterAdv | ||
result: ADTWeaponCutterAdv | ||
completetime: 10 | ||
materials: | ||
Steel: 1700 | ||
Glass: 200 | ||
Gold: 300 | ||
Plasma: 900 | ||
Diamond: 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
- type: technology | ||
id: AdvSalvageWeapons | ||
name: research-technology-salvage-weapons-adv | ||
icon: | ||
sprite: ADT/Objects/Weapons/Guns/Battery/cutteradv.rsi | ||
state: icon | ||
discipline: Arsenal | ||
tier: 2 | ||
cost: 10000 | ||
recipeUnlocks: | ||
- ADTWeaponCutterAdv | ||
technologyPrerequisites: | ||
- SalvageWeapons |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+1.04 KB
Resources/Textures/ADT/Objects/Weapons/Guns/Battery/cutter.rsi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.04 KB
Resources/Textures/ADT/Objects/Weapons/Guns/Battery/cutter.rsi/inhand-left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.03 KB
Resources/Textures/ADT/Objects/Weapons/Guns/Battery/cutter.rsi/inhand-right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions
22
Resources/Textures/ADT/Objects/Weapons/Guns/Battery/cutter.rsi/meta.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"version": 1, | ||
"license": "CC-BY-SA-3.0", | ||
"copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/commit/2b8b045d5a237147d736e3ba3c77c8cc5fb66cb5", | ||
"size": { | ||
"x": 32, | ||
"y": 32 | ||
}, | ||
"states": [ | ||
{ | ||
"name": "icon" | ||
}, | ||
{ | ||
"name": "inhand-left", | ||
"directions": 4 | ||
}, | ||
{ | ||
"name": "inhand-right", | ||
"directions": 4 | ||
} | ||
] | ||
} |
Binary file added
BIN
+895 Bytes
Resources/Textures/ADT/Objects/Weapons/Guns/Battery/cutteradv.rsi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.03 KB
Resources/Textures/ADT/Objects/Weapons/Guns/Battery/cutteradv.rsi/inhand-left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.04 KB
Resources/Textures/ADT/Objects/Weapons/Guns/Battery/cutteradv.rsi/inhand-right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.