Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Content.Server/NPC/Systems/NPCUtilitySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
using Content.Shared.Atmos.Components;
using System.Linq;
using Content.Shared.StatusEffect; // Frontier
using Robust.Shared.Map; //LuaM

namespace Content.Server.NPC.Systems;

Expand Down Expand Up @@ -567,6 +568,26 @@ private void RecursiveAdd(EntityUid uid, HashSet<EntityUid> entities)
RecursiveAdd(child, entities);
}
}
// LuaM-start: in range drone target check
public bool CheckDroneTarget(MapCoordinates coords, float range)
{
foreach (var (target, targetComp) in _lookup.GetEntitiesInRange<ShipNpcTargetComponent>(coords, range))
{
var targetXform = Transform(target);
var targetGrid = targetXform.GridUid;

if (targetComp.NeedGrid != NpcTargetGridMode.Either
&& (targetComp.NeedGrid == NpcTargetGridMode.OnGrid) == (targetGrid == null))
continue;

if (targetComp.NeedPower && !this.IsPowered(target, EntityManager))
continue;

return true;
}
return false;
}
// LuaM-end

private void Filter(NPCBlackboard blackboard, HashSet<EntityUid> entities, UtilityQueryFilter filter)
{
Expand Down
14 changes: 14 additions & 0 deletions Content.Server/Worldgen/Prototypes/BiomePrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,20 @@ private set
public int? MaxY;
// Mono / EE end

// LuaM-start:
/// <summary>
/// Drone target condition.
/// </summary>
[DataField("needDroneTarget")]
public bool NeedDroneTarget;

/// <summary>
/// Search radius for the drone target.
/// </summary>
[DataField("droneTargetRange")]
public float DroneTargetRange = 1400f;
// LuaM-end

//TODO: Get someone to make this a method on componentregistry that does it Correctly.
/// <summary>
/// Applies the worldgen config to the given target (presumably a map.)
Expand Down
20 changes: 18 additions & 2 deletions Content.Server/Worldgen/Systems/Biomes/BiomeSelectionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using Content.Server.Worldgen.Prototypes;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager;
using Content.Server.NPC.Systems; // LuaM
using Robust.Shared.Map; // LuaM

namespace Content.Server.Worldgen.Systems.Biomes;

Expand All @@ -14,6 +16,7 @@ public sealed partial class BiomeSelectionSystem : BaseWorldSystem
[Dependency] private NoiseIndexSystem _noiseIdx = default!;
[Dependency] private IPrototypeManager _proto = default!;
[Dependency] private ISerializationManager _ser = default!;
[Dependency] private NPCUtilitySystem _npcUtility = default!; // LuaM

/// <inheritdoc />
public override void Initialize()
Expand All @@ -25,8 +28,11 @@ public override void Initialize()
private void OnWorldChunkAdded(EntityUid uid, BiomeSelectionComponent component, ref WorldChunkAddedEvent args)
{
var coords = args.Coords;
var lengthSquared = WorldGen.ChunkToWorldCoordsCentered(coords).LengthSquared(); // Frontier: cache world coords of center of chunk

// var lengthSquared = WorldGen.ChunkToWorldCoordsCentered(coords).LengthSquared(); // LuaM comented
// LuaM-start:
var worldPos = WorldGen.ChunkToWorldCoordsCentered(coords);
var lengthSquared = worldPos.LengthSquared();
// LuaM-end
foreach (var biomeId in component.Biomes)
{
var biome = _proto.Index<BiomePrototype>(biomeId);
Expand All @@ -39,6 +45,16 @@ private void OnWorldChunkAdded(EntityUid uid, BiomeSelectionComponent component,
if (!CheckBiomeValidity(args.Chunk, biome, coords))
continue;

// LuaM-start:
if (biome.NeedDroneTarget)
{
var mapCoords = new MapCoordinates(worldPos, Transform(uid).MapID);

if (!_npcUtility.CheckDroneTarget(mapCoords, biome.DroneTargetRange))
continue;
}
// LuaM-end

biome.Apply(args.Chunk, _ser, EntityManager);
return;
}
Expand Down
42 changes: 22 additions & 20 deletions Resources/Maps/_NF/POI/lpbravo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17583,26 +17583,28 @@ entities:
- type: Transform
pos: 39.5,-1.5
parent: 1
- proto: NpcStationAiAttackerStaticSmart
entities:
- uid: 2584
components:
- type: Transform
rot: 3.141592653589793 rad
pos: 46.5,-0.5
parent: 1
- uid: 2655
components:
- type: Transform
rot: 3.141592653589793 rad
pos: -2.5,-19.5
parent: 1
- uid: 2795
components:
- type: Transform
rot: 3.141592653589793 rad
pos: 18.5,1.5
parent: 1
# Lua-comented-start:
# - proto: NpcStationAiAttackerStaticSmart
# entities:
# - uid: 2584
# components:
# - type: Transform
# rot: 3.141592653589793 rad
# pos: 46.5,-0.5
# parent: 1
# - uid: 2655
# components:
# - type: Transform
# rot: 3.141592653589793 rad
# pos: -2.5,-19.5
# parent: 1
# - uid: 2795
# components:
# - type: Transform
# rot: 3.141592653589793 rad
# pos: 18.5,1.5
# parent: 1
# Lua-comented-end
- proto: OxygenCanister
entities:
- uid: 2449
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,10 @@
- type: DetectionRangeMultiplier # same as mass scanner
infraredMultiplier: 0.5
visualMultiplier: 0.75
- type: ShipNpcTarget
needGrid: NoGrid
# LuaM-comented-start:
# - type: ShipNpcTarget
# needGrid: NoGrid
# LuaM-comented-end
- type: RetroMonitorView
# </Mono>

Expand Down
6 changes: 4 additions & 2 deletions Resources/Prototypes/Entities/Mobs/Species/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,10 @@
- type: SurgeryTarget # Shitmed Change
- type: ExaminableCharacter # WWDP
# Mono
- type: ShipNpcTarget
needGrid: NoGrid
# LuaM-comented-start:
# - type: ShipNpcTarget
# needGrid: NoGrid
# LuaM-comented-end

- type: entity
save: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,10 @@
components:
- type: ShuttleConsole
- type: TargetSeekingTarget # Mono
- type: ShipNpcTarget # Mono
needPower: true
# LuaM-comented-start:
# - type: ShipNpcTarget # Mono
# needPower: true
# LuaM-comented-end
- type: ShuttleConsoleLock
- type: ActivatableUI
key: enum.ShuttleConsoleUiKey.Key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@
shape:
- 0, 0, 4, 4
- 0, 3, 6, 5
# LuaM-comented-start:
# Mono
- type: ShipNpcTarget
needGrid: NoGrid
# - type: ShipNpcTarget
# needGrid: NoGrid
# LuaM-comented-end
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
- type: constructionGraph
id: MachineGunneryServer
start: start
graph:
- node: start
actions:
- !type:SpawnPrototype
prototype: SheetSteel1
- !type:DeleteEntity
edges:
- to: missingWires
completed:
- !type:SetAnchor
value: false
steps:
- material: Steel
amount: 5
doAfter: 2.5
- to: destroyedMachineFrame
steps:
- material: Steel
amount: 5
doAfter: 2.5

- node: missingWires
entity: UnfinishedMachineFrame
actions:
- !type:EmptyAllContainers
edges:
- to: machineFrame
conditions:
- !type:EntityAnchored
steps:
- material: Cable

- to: start
completed:
- !type:SpawnPrototype
prototype: SheetSteel1
amount: 5
- !type:DeleteEntity
steps:
- tool: Screwing
doAfter: 2

- node: machineFrame
entity: MachineFrame
actions:
- !type:AddContainer
container: machine_parts
- !type:AddContainer
container: machine_board
- !type:MachineFrameRegenerateProgress
edges:
- to: machine
conditions:
- !type:EntityAnchored
- !type:MachineFrameComplete
guideIconBoard:
sprite: Objects/Misc/module.rsi
state: id_mod
guideIconParts:
sprite: _NF/Objects/Misc/stock_parts.rsi
state: scan_module
steps:
- tool: Screwing
doAfter: 0.5

- to: machineFrame
conditions:
- !type:EntityAnchored
- !type:ContainerNotEmpty
container: machine_board
steps:
- tool: Prying
doAfter: 2
completed:
- !type:EmptyAllContainers
- !type:MachineFrameRegenerateProgress

- to: missingWires
conditions:
- !type:EntityAnchored
- !type:ContainerEmpty
container: machine_board
examineText: construction-condition-machine-container-empty
completed:
- !type:SpawnPrototype
prototype: CableApcStack1
steps:
- tool: Cutting
doAfter: 0.25

- node: machine
entity: !type:BoardNodeEntity { container: machine_board }
edges:
- to: machineFrame
completed:
- !type:RaiseEvent
event: !type:MachineDeconstructedEvent
broadcast: false
conditions:
- !type:EntityAnchored
- !type:WirePanel
steps:
- tool: Prying
doAfter: 40

- node: destroyedMachineFrame
entity: MachineFrameDestroyed
edges:
- to: start
steps:
- tool: Welding
doAfter: 5
completed:
- !type:SpawnPrototype
prototype: SheetSteel1
amount: 3
- !type:DeleteEntity {}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
True: { visible: true }
False: { visible: false }
- type: Construction # Mono
graph: Machine
graph: MachineGunneryServer # LuaM Machine > MachineGunneryServer
node: machine
containers:
- machine_board
Expand All @@ -43,6 +43,8 @@
id: GunneryServer
- type: StaticPrice
price: 200
- type: Anchorable # LuaM
delay: 15

- type: entity
id: GunneryServerLow
Expand Down Expand Up @@ -87,6 +89,9 @@
- type: ShipRepairable
repairTime: 13
repairCost: 40
- type: ShipNpcTarget # LuaM
needPower: true


- type: entity
id: GunneryServerHigh
Expand All @@ -109,6 +114,8 @@
- type: ShipRepairable
repairTime: 20
repairCost: 70
- type: ShipNpcTarget # LuaM
needPower: true

- type: entity
id: GunneryServerUltra
Expand All @@ -133,6 +140,8 @@
- type: ShipRepairable
repairTime: 25
repairCost: 100
- type: ShipNpcTarget # LuaM
needPower: true

- type: entity
id: GunneryServerOmega
Expand All @@ -157,6 +166,8 @@
- type: ShipRepairable
repairTime: 40
repairCost: 150
- type: ShipNpcTarget # LuaM
needPower: true

- type: entity
id: GunneryServerStation
Expand Down Expand Up @@ -238,8 +249,10 @@
- map: [ "enum.WiresVisualLayers.MaintenancePanel" ]
state: generic_panel_open
- type: FireControlConsole
- type: ShipNpcTarget
needPower: true
# LuaM-comented-start:
# - type: ShipNpcTarget
# needPower: true
# LuaM-comented-end
- type: TargetSeekingTarget
- type: ActivatableUI
key: enum.FireControlConsoleUiKey.Key
Expand Down
Loading
Loading