@@ -1,11 +1,16 @@
|
||||
using Content.Server._CP14.GameTicking.Rules.Components;
|
||||
using Content.Server.Mind;
|
||||
using Content.Shared.Random.Helpers;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.GameTicking.Rules;
|
||||
|
||||
public sealed class CP14ExpeditionObjectivesRule : GameRuleSystem<CP14ExpeditionObjectivesRuleComponent>
|
||||
{
|
||||
[Dependency] private readonly MindSystem _mind = default!;
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -25,9 +30,38 @@ public sealed class CP14ExpeditionObjectivesRule : GameRuleSystem<CP14Expedition
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var objective in expedition.Objectives)
|
||||
foreach (var (job, groups) in expedition.RoleObjectives)
|
||||
{
|
||||
_mind.TryAddObjective(mindId.Value, mind, objective);
|
||||
if (args.JobId is null || args.JobId != job)
|
||||
continue;
|
||||
|
||||
foreach (var weightGroupProto in groups)
|
||||
{
|
||||
if (!_proto.TryIndex(weightGroupProto, out var weightGroup))
|
||||
continue;
|
||||
|
||||
_mind.TryAddObjective(mindId.Value, mind, weightGroup.Pick(_random));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var (departmentProto, objectives) in expedition.DepartmentObjectives)
|
||||
{
|
||||
if (args.JobId is null)
|
||||
continue;
|
||||
|
||||
if (!_proto.TryIndex(departmentProto, out var department))
|
||||
continue;
|
||||
|
||||
if (!department.Roles.Contains(args.JobId))
|
||||
continue;
|
||||
|
||||
foreach (var weightGroupProto in objectives)
|
||||
{
|
||||
if (!_proto.TryIndex(weightGroupProto, out var weightGroup))
|
||||
continue;
|
||||
|
||||
_mind.TryAddObjective(mindId.Value, mind, weightGroup.Pick(_random));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Content.Server.GameTicking.Rules;
|
||||
using Content.Shared.Random;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server._CP14.GameTicking.Rules.Components;
|
||||
@@ -10,5 +12,8 @@ namespace Content.Server._CP14.GameTicking.Rules.Components;
|
||||
public sealed partial class CP14ExpeditionObjectivesRuleComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
public List<EntProtoId> Objectives = new();
|
||||
public Dictionary<ProtoId<JobPrototype>, List<ProtoId<WeightedRandomPrototype>>> RoleObjectives = new();
|
||||
|
||||
[DataField]
|
||||
public Dictionary<ProtoId<DepartmentPrototype>, List<ProtoId<WeightedRandomPrototype>>> DepartmentObjectives = new();
|
||||
}
|
||||
|
||||
@@ -7,13 +7,13 @@ tilemap:
|
||||
2: CP14FloorDirt
|
||||
3: CP14FloorFoundation
|
||||
4: CP14FloorGrass
|
||||
10: CP14FloorOakWoodPlanks
|
||||
11: CP14FloorOakWoodPlanksBig
|
||||
5: CP14FloorSand
|
||||
6: CP14FloorStonebricks
|
||||
7: CP14FloorStonebricksSmallCarved1
|
||||
8: CP14FloorStonebricksSmallCarved2
|
||||
9: CP14FloorStonebricksSquareCarved
|
||||
10: CP14FloorWoodPlanks
|
||||
11: CP14FloorWoodPlanksBig
|
||||
entities:
|
||||
- proto: ""
|
||||
entities:
|
||||
@@ -2187,6 +2187,13 @@ entities:
|
||||
rot: -1.5707963267948966 rad
|
||||
pos: 4.5,16.5
|
||||
parent: 2
|
||||
- proto: CP14BaseShovel
|
||||
entities:
|
||||
- uid: 234
|
||||
components:
|
||||
- type: Transform
|
||||
pos: 7.4584475,-2.61353
|
||||
parent: 2
|
||||
- proto: CP14BaseSickle
|
||||
entities:
|
||||
- uid: 227
|
||||
@@ -44799,6 +44806,22 @@ entities:
|
||||
- type: Physics
|
||||
canCollide: False
|
||||
- type: InsideEntityStorage
|
||||
- proto: CP14ClothingShirtCottonBlack
|
||||
entities:
|
||||
- uid: 9832
|
||||
components:
|
||||
- type: Transform
|
||||
parent: 9819
|
||||
- type: Physics
|
||||
canCollide: False
|
||||
- type: InsideEntityStorage
|
||||
- uid: 9835
|
||||
components:
|
||||
- type: Transform
|
||||
parent: 9819
|
||||
- type: Physics
|
||||
canCollide: False
|
||||
- type: InsideEntityStorage
|
||||
- proto: CP14ClothingShirtCottonBlue
|
||||
entities:
|
||||
- uid: 9836
|
||||
@@ -44815,22 +44838,6 @@ entities:
|
||||
- type: Physics
|
||||
canCollide: False
|
||||
- type: InsideEntityStorage
|
||||
- proto: CP14ClothingShirtCottonBlueDark
|
||||
entities:
|
||||
- uid: 9832
|
||||
components:
|
||||
- type: Transform
|
||||
parent: 9819
|
||||
- type: Physics
|
||||
canCollide: False
|
||||
- type: InsideEntityStorage
|
||||
- uid: 9835
|
||||
components:
|
||||
- type: Transform
|
||||
parent: 9819
|
||||
- type: Physics
|
||||
canCollide: False
|
||||
- type: InsideEntityStorage
|
||||
- proto: CP14ClothingShirtCottonPurple
|
||||
entities:
|
||||
- uid: 9837
|
||||
@@ -46194,13 +46201,6 @@ entities:
|
||||
- type: Transform
|
||||
pos: 9.299216,-3.5921
|
||||
parent: 2
|
||||
- proto: CP14Shovel
|
||||
entities:
|
||||
- uid: 234
|
||||
components:
|
||||
- type: Transform
|
||||
pos: 7.4584475,-2.61353
|
||||
parent: 2
|
||||
- proto: CP14SpawnPointAdventurer
|
||||
entities:
|
||||
- uid: 647
|
||||
@@ -46285,6 +46285,13 @@ entities:
|
||||
- type: Transform
|
||||
pos: 1.5,0.5
|
||||
parent: 2
|
||||
- proto: CP14SpawnPointCaptain
|
||||
entities:
|
||||
- uid: 779
|
||||
components:
|
||||
- type: Transform
|
||||
pos: 6.5,2.5
|
||||
parent: 2
|
||||
- proto: CP14TableWooden
|
||||
entities:
|
||||
- uid: 85
|
||||
|
||||
@@ -46776,6 +46776,13 @@ entities:
|
||||
rot: -1.5707963267948966 rad
|
||||
pos: -37.5,-19.5
|
||||
parent: 2
|
||||
- proto: CP14SpawnPointCaptain
|
||||
entities:
|
||||
- uid: 751
|
||||
components:
|
||||
- type: Transform
|
||||
pos: 8.5,-0.5
|
||||
parent: 2
|
||||
- proto: CP14TableWooden
|
||||
entities:
|
||||
- uid: 65
|
||||
@@ -51488,6 +51495,11 @@ entities:
|
||||
- type: Transform
|
||||
pos: -17.5,45.5
|
||||
parent: 2
|
||||
- uid: 2210
|
||||
components:
|
||||
- type: Transform
|
||||
pos: -20.5,32.5
|
||||
parent: 2
|
||||
- uid: 2260
|
||||
components:
|
||||
- type: Transform
|
||||
@@ -51503,13 +51515,6 @@ entities:
|
||||
- type: Transform
|
||||
pos: -20.5,39.5
|
||||
parent: 2
|
||||
- proto: CP14WallStoneSilverOre
|
||||
entities:
|
||||
- uid: 2210
|
||||
components:
|
||||
- type: Transform
|
||||
pos: -20.5,32.5
|
||||
parent: 2
|
||||
- proto: CP14WallWhitebrick
|
||||
entities:
|
||||
- uid: 7061
|
||||
|
||||
@@ -22,6 +22,7 @@ entities:
|
||||
- type: MetaData
|
||||
- type: Transform
|
||||
- type: Map
|
||||
mapPaused: True
|
||||
- type: PhysicsMap
|
||||
- type: GridTree
|
||||
- type: MovedGrids
|
||||
@@ -341,6 +342,20 @@ entities:
|
||||
chunkSize: 4
|
||||
- type: GasTileOverlay
|
||||
- type: RadiationGridResistance
|
||||
- proto: CP14SpawnPointAdventurer
|
||||
entities:
|
||||
- uid: 99
|
||||
components:
|
||||
- type: Transform
|
||||
pos: -0.5,-0.5
|
||||
parent: 2
|
||||
- proto: CP14SpawnPointCaptain
|
||||
entities:
|
||||
- uid: 241
|
||||
components:
|
||||
- type: Transform
|
||||
pos: -1.5,-0.5
|
||||
parent: 2
|
||||
- proto: FenceMetalBroken
|
||||
entities:
|
||||
- uid: 217
|
||||
@@ -984,13 +999,6 @@ entities:
|
||||
- type: Transform
|
||||
pos: -0.5,-0.5
|
||||
parent: 2
|
||||
- proto: CP14SpawnPointAdventurer
|
||||
entities:
|
||||
- uid: 99
|
||||
components:
|
||||
- type: Transform
|
||||
pos: -0.5,-0.5
|
||||
parent: 2
|
||||
- proto: WallPlastitaniumIndestructible
|
||||
entities:
|
||||
- uid: 51
|
||||
|
||||
@@ -21,6 +21,20 @@
|
||||
components:
|
||||
- type: SpawnPoint
|
||||
job_id: CP14Alchemist
|
||||
- type: Sprite
|
||||
layers:
|
||||
- state: green
|
||||
- state: zookeeper #TODO Replace
|
||||
|
||||
- type: entity
|
||||
id: CP14SpawnPointCaptain
|
||||
parent: SpawnPointJobBase
|
||||
name: captain
|
||||
categories:
|
||||
- Spawner
|
||||
components:
|
||||
- type: SpawnPoint
|
||||
job_id: CP14Captain
|
||||
- type: Sprite
|
||||
layers:
|
||||
- state: green
|
||||
|
||||
@@ -12,10 +12,9 @@
|
||||
noSpawn: true
|
||||
components:
|
||||
- type: CP14ExpeditionObjectivesRule
|
||||
objectives:
|
||||
#- CP14ExpeditionCollectGoldObjective
|
||||
- CP14PersonalCurrencyCollectObjectiveMedium
|
||||
# Expedition random objectives
|
||||
# main objective + sub objective?
|
||||
# motivations
|
||||
departmentObjectives:
|
||||
CP14Command:
|
||||
- CP14ExpeditionCollectObjectiveGroup
|
||||
CP14Mercenary:
|
||||
- CP14PersonalCurrencyCollectObjectiveGroup
|
||||
# antags
|
||||
@@ -11,7 +11,7 @@
|
||||
mapNameTemplate: "Meteor Arena"
|
||||
- type: StationJobs
|
||||
availableJobs:
|
||||
CP14Adventurer: [ -1, -1 ] #CrystallPunk Dev replacement
|
||||
CP14Captain: [ -1, -1 ]
|
||||
|
||||
- type: gameMap
|
||||
id: AlchemyTest
|
||||
@@ -33,6 +33,7 @@
|
||||
availableJobs:
|
||||
CP14Adventurer: [ -1, -1 ]
|
||||
CP14Alchemist: [ -1, -1 ]
|
||||
CP14Captain: [1, 1]
|
||||
|
||||
- type: gameMap
|
||||
id: BattleRoyale
|
||||
@@ -51,6 +52,7 @@
|
||||
availableJobs:
|
||||
CP14Adventurer: [ -1, -1 ]
|
||||
CP14Alchemist: [ -1, -1 ]
|
||||
CP14Captain: [1, 1]
|
||||
- type: StationBiome
|
||||
biome: CP14GrassFill
|
||||
- type: CP14StationExpeditionTarget
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
- type: Objective
|
||||
issuer: cp14-objective-issuer-expedition
|
||||
|
||||
|
||||
# Collect group
|
||||
- type: entity
|
||||
abstract: true
|
||||
parent: CP14BaseExpeditionObjective
|
||||
@@ -27,4 +29,9 @@
|
||||
verifyMapExistence: false
|
||||
collectGroup: CP14Gold
|
||||
- type: Objective
|
||||
difficulty: 1
|
||||
difficulty: 1
|
||||
|
||||
- type: weightedRandom
|
||||
id: CP14ExpeditionCollectObjectiveGroup
|
||||
weights:
|
||||
CP14ExpeditionCollectGoldObjective: 1
|
||||
@@ -23,6 +23,8 @@
|
||||
sprite: /Textures/_CP14/Objects/Economy/gp_coin.rsi
|
||||
state: coin10
|
||||
|
||||
# Collect currency group
|
||||
|
||||
- type: entity
|
||||
parent: CP14BasePersonalCurrencyCollectObjective
|
||||
id: CP14PersonalCurrencyCollectObjectiveSmall
|
||||
@@ -48,4 +50,11 @@
|
||||
- type: Objective
|
||||
difficulty: 3
|
||||
- type: CP14CurrencyCollectCondition
|
||||
currency: 3000
|
||||
currency: 3000
|
||||
|
||||
- type: weightedRandom
|
||||
id: CP14PersonalCurrencyCollectObjectiveGroup
|
||||
weights:
|
||||
CP14PersonalCurrencyCollectObjectiveSmall: 2
|
||||
CP14PersonalCurrencyCollectObjectiveMedium: 1
|
||||
CP14PersonalCurrencyCollectObjectiveBig: 0.3
|
||||
|
||||
Reference in New Issue
Block a user