Printable drills and constructable thrusters (#12943)

This commit is contained in:
Nemanja
2022-12-18 23:38:30 -05:00
committed by GitHub
parent 494b416999
commit cdc6716859
9 changed files with 128 additions and 26 deletions

View File

@@ -1,5 +1,7 @@
using Content.Server.Shuttles.Systems;
using Content.Shared.Construction.Prototypes;
using Content.Shared.Damage;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Shuttles.Components
{
@@ -41,8 +43,10 @@ namespace Content.Server.Shuttles.Components
public bool IsOn;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("thrust")]
public float Thrust = 750f;
public float Thrust;
[DataField("baseThrust"), ViewVariables(VVAccess.ReadWrite)]
public float BaseThrust = 750f;
[DataField("thrusterType")]
public ThrusterType Type = ThrusterType.Linear;
@@ -68,6 +72,12 @@ namespace Content.Server.Shuttles.Components
public List<EntityUid> Colliding = new();
public bool Firing = false;
[DataField("machinePartThrust", customTypeSerializer: typeof(PrototypeIdSerializer<MachinePartPrototype>))]
public string MachinePartThrust = "Laser";
[DataField("partRatingThrustMultiplier")]
public float PartRatingThrustMultiplier = 1.5f;
}
public enum ThrusterType

View File

@@ -1,6 +1,7 @@
using System.Linq;
using System.Runtime.CompilerServices;
using Content.Server.Audio;
using Content.Server.Construction;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Server.Shuttles.Components;
@@ -58,6 +59,9 @@ namespace Content.Server.Shuttles.Systems
SubscribeLocalEvent<ThrusterComponent, ExaminedEvent>(OnThrusterExamine);
SubscribeLocalEvent<ThrusterComponent, RefreshPartsEvent>(OnRefreshParts);
SubscribeLocalEvent<ThrusterComponent, UpgradeExamineEvent>(OnUpgradeExamine);
_mapManager.TileChanged += OnTileChange;
}
@@ -515,6 +519,18 @@ namespace Content.Server.Shuttles.Systems
}
}
private void OnRefreshParts(EntityUid uid, ThrusterComponent component, RefreshPartsEvent args)
{
var thrustRating = args.PartRatings[component.MachinePartThrust];
component.Thrust = component.BaseThrust * MathF.Pow(component.PartRatingThrustMultiplier, thrustRating - 1);
}
private void OnUpgradeExamine(EntityUid uid, ThrusterComponent component, UpgradeExamineEvent args)
{
args.AddPercentageUpgrade("thruster-comp-upgrade-thrust", component.Thrust / component.BaseThrust);
}
#endregion
[MethodImpl(MethodImplOptions.AggressiveInlining)]

View File

@@ -3,3 +3,5 @@ thruster-comp-disabled = The thruster is turned [color=red]off[/color].
thruster-comp-nozzle-direction = The nozzle is facing [color=yellow]{$direction}[/color].
thruster-comp-nozzle-exposed = The nozzle [color=green]exposed[/color] to space.
thruster-comp-nozzle-not-exposed = The nozzle [color=red]is not exposed[/color] to space.
thruster-comp-upgrade-thrust = Thrust strength

View File

@@ -239,7 +239,7 @@
- BasicResearch
unlockedRecipes:
- AppraisalTool
#TODO- MiningDrill
- MiningDrill
- OreProcessorMachineCircuitboard
- type: technology
@@ -256,8 +256,8 @@
unlockedRecipes:
- ShuttleConsoleCircuitboard
- RadarConsoleCircuitboard
#TODO- Gyroscope
#TODO- Thruster
- ThrusterMachineCircuitboard
- GyroscopeMachineCircuitboard
- type: technology
name: technologies-ripley-technology
@@ -359,6 +359,7 @@
unlockedRecipes:
- RCD
- RCDAmmo
- PowerDrill
- SMESMachineCircuitboard
- PowerComputerCircuitboard
- GeneratorPlasmaMachineCircuitboard

View File

@@ -449,6 +449,32 @@
materialRequirements:
CableHV: 5
- type: entity
id: ThrusterMachineCircuitboard
parent: BaseMachineCircuitboard
name: thruster machine board
components:
- type: MachineBoard
prototype: Thruster
requirements:
Laser: 4
Capacitor: 1
materialRequirements:
Steel: 5
- type: entity
id: GyroscopeMachineCircuitboard
parent: BaseMachineCircuitboard
name: gyroscope machine board
components:
- type: MachineBoard
prototype: Gyroscope
requirements:
ScanningModule: 2
Capacitor: 1
materialRequirements:
Glass: 2
- type: entity
id: GeneratorUraniumMachineCircuitboard
parent: BaseMachineCircuitboard

View File

@@ -167,6 +167,8 @@
- CableStack
- CableMVStack
- CableHVStack
- PowerDrill
- MiningDrill
- ConveyorBeltAssembly
- AppraisalTool
- RCDAmmo
@@ -300,6 +302,8 @@
- WallmountGeneratorAPUElectronics
- WallmountSubstationElectronics
- EmitterCircuitboard
- ThrusterMachineCircuitboard
- GyroscopeMachineCircuitboard
- GasRecyclerMachineCircuitboard
- SeedExtractorMachineCircuitboard
- AnalysisComputerCircuitboard

View File

@@ -44,9 +44,14 @@
- type: entity
id: Thruster
parent: BaseThruster
parent: [ BaseThruster, ConstructibleMachine ]
components:
- type: Thruster
- type: Machine
board: ThrusterMachineCircuitboard
- type: UpgradePowerDraw
powerDrawMultiplier: 0.75
scaling: Exponential
- type: Sprite
sprite: Structures/Shuttles/thruster.rsi
layers:
@@ -85,12 +90,13 @@
- type: entity
id: Gyroscope
parent: BaseThruster
parent: [ BaseThruster, ConstructibleMachine ]
components:
- type: Thruster
thrusterType: Angular
requireSpace: false
thrust: 5000
baseThrust: 5000
machinePartThrust: ScanningModule
- type: Sprite
# Listen I'm not the biggest fan of the sprite but it was the most appropriate thing I could find.
sprite: Structures/Shuttles/gyroscope.rsi
@@ -114,28 +120,36 @@
autoRot: true
offset: "0, 0.1" # shine from the top, not bottom of the computer
color: "#4246b3"
- type: Machine
board: GyroscopeMachineCircuitboard
- type: UpgradePowerDraw
powerDrawMultiplier: 0.75
scaling: Exponential
- type: StaticPrice
price: 2000
- type: entity
id: DebugGyroscope
parent: Gyroscope
parent: BaseThruster
suffix: DEBUG
components:
- type: Thruster
requireSpace: false
- type: ApcPowerReceiver
needsPower: false
powerLoad: 0
- type: Sprite
sprite: Structures/Shuttles/gyroscope.rsi
layers:
- state: base
map: ["enum.ThrusterVisualLayers.Base"]
- state: thrust
map: ["enum.ThrusterVisualLayers.ThrustOn"]
shader: unshaded
- state: thrust_burn_unshaded
map: ["enum.ThrusterVisualLayers.ThrustingUnshaded"]
shader: unshaded
offset: 0, 1
- type: Thruster
thrusterType: Angular
requireSpace: false
baseThrust: 5000
- type: ApcPowerReceiver
needsPower: false
powerLoad: 0
- type: Sprite
sprite: Structures/Shuttles/gyroscope.rsi
snapCardinals: true
layers:
- state: base
map: ["enum.ThrusterVisualLayers.Base"]
- state: thrust
map: ["enum.ThrusterVisualLayers.ThrustOn"]
shader: unshaded
- state: thrust_burn_unshaded
map: ["enum.ThrusterVisualLayers.ThrustingUnshaded"]
shader: unshaded
offset: 0, 1

View File

@@ -491,6 +491,24 @@
Steel: 100
Glass: 900
- type: latheRecipe
id: ThrusterMachineCircuitboard
icon: { sprite: Objects/Misc/module.rsi, state: id_mod }
result: ThrusterMachineCircuitboard
completetime: 4
materials:
Steel: 100
Glass: 900
- type: latheRecipe
id: GyroscopeMachineCircuitboard
icon: { sprite: Objects/Misc/module.rsi, state: id_mod }
result: GyroscopeMachineCircuitboard
completetime: 4
materials:
Steel: 100
Glass: 900
- type: latheRecipe
id: GasRecyclerMachineCircuitboard
icon: { sprite: Objects/Misc/module.rsi, state: id_mod }

View File

@@ -201,3 +201,14 @@
Steel: 650
Plastic: 150
Gold: 50
- type: latheRecipe
id: MiningDrill
icon:
sprite: Objects/Tools/handdrill.rsi
state: handdrill
result: MiningDrill
completetime: 3
materials:
Steel: 500
Plastic: 100