Demiplan examination (#578)

* demiplan examining

* cargo demiplanes update

* Update positions_buy.ftl

* Update crates.yml
This commit is contained in:
Ed
2024-11-12 13:33:19 +03:00
committed by GitHub
parent b106554cfe
commit df4900e148
20 changed files with 207 additions and 42 deletions

View File

@@ -4,12 +4,16 @@ using Content.Server._CP14.Demiplane.Components;
using Content.Server._CP14.Demiplane.Jobs;
using Content.Shared._CP14.Demiplane.Components;
using Content.Shared._CP14.Demiplane.Prototypes;
using Content.Shared._CP14.MagicManacostModify;
using Content.Shared.Examine;
using Content.Shared.Interaction.Events;
using Content.Shared.Verbs;
using Robust.Shared.CPUJob.JobQueues;
using Robust.Shared.CPUJob.JobQueues.Queues;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Utility;
namespace Content.Server._CP14.Demiplane;
@@ -19,10 +23,70 @@ public sealed partial class CP14DemiplaneSystem
private readonly List<(CP14SpawnRandomDemiplaneJob Job, CancellationTokenSource CancelToken)> _expeditionJobs = new();
private const double JobMaxTime = 0.002;
[Dependency] private readonly ExamineSystemShared _examine = default!;
private void InitGeneration()
{
SubscribeLocalEvent<CP14DemiplaneGeneratorDataComponent, MapInitEvent>(GeneratorMapInit);
SubscribeLocalEvent<CP14DemiplaneGeneratorDataComponent, UseInHandEvent>(GeneratorUsedInHand);
SubscribeLocalEvent<CP14DemiplaneGeneratorDataComponent, GetVerbsEvent<ExamineVerb>>(OnVerbExamine);
}
private void OnVerbExamine(Entity<CP14DemiplaneGeneratorDataComponent> ent, ref GetVerbsEvent<ExamineVerb> args)
{
if (!args.CanInteract || !args.CanAccess)
return;
var markup = GetDemiplanExamine(ent.Comp);
_examine.AddDetailedExamineVerb(
args,
ent.Comp,
markup,
Loc.GetString("cp14-demiplan-examine"),
"/Textures/Interface/VerbIcons/dot.svg.192dpi.png"); //TODO custom icon
}
private FormattedMessage GetDemiplanExamine(CP14DemiplaneGeneratorDataComponent comp)
{
var msg = new FormattedMessage();
if (!_proto.TryIndex(comp.Location, out var indexedLocation))
return msg;
msg.AddMarkupOrThrow(
indexedLocation.Name is not null && _random.Prob(indexedLocation.ExamineProb)
? Loc.GetString("cp14-demiplane-examine-title", ("location", Loc.GetString(indexedLocation.Name)))
: Loc.GetString("cp14-demiplane-examine-title-unknown"));
List<LocId> modifierNames = new();
foreach (var modifier in comp.Modifiers)
{
if (!_proto.TryIndex(modifier, out var indexedModifier))
continue;
if (!_random.Prob(indexedModifier.ExamineProb))
continue;
if (indexedModifier.Name is null)
continue;
if (modifierNames.Contains(indexedModifier.Name.Value))
continue;
modifierNames.Add(indexedModifier.Name.Value);
}
if (modifierNames.Count > 0)
{
msg.AddMarkupOrThrow("\n" + Loc.GetString("cp14-demiplane-examine-modifiers"));
foreach (var name in modifierNames)
{
msg.AddMarkupOrThrow("\n- " + Loc.GetString(name));
}
}
return msg;
}
private void UpdateGeneration(float frameTime)

View File

@@ -26,4 +26,10 @@ public sealed partial class CP14DemiplaneLocationPrototype : IPrototype
/// </summary>
[DataField]
public List<ProtoId<TagPrototype>> Tags = new();
[DataField]
public LocId? Name;
[DataField]
public float ExamineProb = 0.75f;
}

View File

@@ -59,4 +59,10 @@ public sealed partial class CP14DemiplaneModifierPrototype : IPrototype
/// </summary>
[DataField]
public List<ProtoId<TagPrototype>> RequiredTags = new();
[DataField]
public LocId? Name;
[DataField]
public float ExamineProb = 0.75f;
}

View File

@@ -0,0 +1,6 @@
cp14-demiplan-examine = Examine the demiplane
cp14-demiplane-examine-title = Looking into the demiplane crystal, you may find that this demiplane leads to [color=yellow]{$location}[/color].
cp14-demiplane-examine-title-unknown = Looking into the demiplane crystal, you can't figure out where it leads.
cp14-demiplane-examine-modifiers = You may notice a presence here:

View File

@@ -0,0 +1,3 @@
cp14-demiplane-location-cave = Dark caves
cp14-demiplane-location-cave-grass = Overgrown caves
cp14-demiplane-location-grassland-island = Green Island

View File

@@ -0,0 +1,19 @@
cp14-modifier-gold-ore = gold ore
cp14-modifier-iron-ore = iron ore
cp14-modifier-copper-ore = copper ore
cp14-modifier-quartz-crystal = quartz crystals
cp14-modifier-dayflin = dayflins
cp14-modifier-fly-agaric = fly agaric
cp14-modifier-blue-amanita = azure amanita
cp14-modifier-blood-flower = blood flowers
cp14-modifier-wild-sage = wild Sage
cp14-modifier-lumisroom = lumishrooms
cp14-modifier-explosive = explosive mines
cp14-modifier-ruins = ancient ruins
cp14-modifier-xeno = xenomorphs
cp14-modifier-zombie = swarms of undead
cp14-modifier-dyno = prehistoric fauna
cp14-modifier-mole = predatory moles
cp14-modifier-rabbits = rabbits
cp14-modifier-boars = wild boars
cp14-modifier-chasm = bottomless chasms

View File

@@ -12,5 +12,5 @@ cp14-store-buy-alchemy-bureaucracy-desc = Feather pens, inkwells and a big stack
cp14-store-buy-alchemy-farm-seeds-name = Seeds for farming
cp14-store-buy-alchemy-farm-seeds-desc = A set of different seeds, for farming of all kinds! Don't limit yourself, buy several boxes at once, just in case the farmers eat everything and don't have any food left to process into seeds.
cp14-store-buy-alchemy-demiplan-name = Demiplan key
cp14-store-buy-alchemy-demiplan-desc = An unstable pocket dimension where doom or riches may await you? What could be better for your adventurers? Buy from us for a couple of gold pieces - resell to them for more, or bail them out.
cp14-store-buy-alchemy-demiplan-name = 10 demiplane Keys
cp14-store-buy-alchemy-demiplan-desc = Unstable pocket dimensions where doom or riches may await you? What could be better for your adventurers? Buy from us for a couple of gold pieces - resell to them for more, or bail them out.

View File

@@ -0,0 +1,6 @@
cp14-demiplan-examine = Изучить демиплан
cp14-demiplane-examine-title = Вглядываясь в кристалл демиплана, вы можете обнаружить, что этот демиплан ведет в [color=yellow]{$location}[/color].
cp14-demiplane-examine-title-unknown = Вглядываясь в кристалл демиплана, вы не можете понять куда он ведет.
cp14-demiplane-examine-modifiers = Вы можете заметить здесь присутствие:

View File

@@ -0,0 +1,3 @@
cp14-demiplane-location-cave = Темные пещеры
cp14-demiplane-location-cave-grass = Заросшие пещеры
cp14-demiplane-location-grassland-island = Зеленый остров

View File

@@ -0,0 +1,19 @@
cp14-modifier-gold-ore = золотой руды
cp14-modifier-iron-ore = железной руды
cp14-modifier-copper-ore = медной руды
cp14-modifier-quartz-crystal = кварцевых кристаллов
cp14-modifier-dayflin = днецветов
cp14-modifier-fly-agaric = мухоморов
cp14-modifier-blue-amanita = лазурной аманиты
cp14-modifier-blood-flower = кровоцветов
cp14-modifier-wild-sage = дикого Шалфея
cp14-modifier-lumisroom = люмигрибов
cp14-modifier-explosive = взрывных мин
cp14-modifier-ruins = древних руин
cp14-modifier-xeno = ксеноморфов
cp14-modifier-zombie = толп нежити
cp14-modifier-dyno = доисторической фауны
cp14-modifier-mole = хищных кротов
cp14-modifier-rabbits = кроликов
cp14-modifier-boars = диких кабанов
cp14-modifier-chasm = бездонных пропастей

View File

@@ -12,5 +12,5 @@ cp14-store-buy-alchemy-bureaucracy-desc = Ручки, чернильницы и
cp14-store-buy-alchemy-farm-seeds-name = Семена для фермерства
cp14-store-buy-alchemy-farm-seeds-desc = Набор разных семян, для фермерства всех видов! Не ограничивайте себя, купите сразу несколько ящиков, на случай, если фермеры все съедят и не оставят еды на переработку в семена.
cp14-store-buy-alchemy-demiplan-name = Ключ демиплана
cp14-store-buy-alchemy-demiplan-desc = Нестабильное карманное измерение, в котором вас может поджидать гибель или богатства? Что может быть лучше для ваших авантюристов? Купите у нас за пару золотых - перепродайте им подороже, или под залог.
cp14-store-buy-alchemy-demiplan-name = 10 ключей демиплана
cp14-store-buy-alchemy-demiplan-desc = Нестабильные карманные измерения, в котором вас может поджидать гибель или богатства? Что может быть лучше для ваших авантюристов? Купите у нас за пару золотых - перепродайте им подороже, или под залог.

View File

@@ -59,4 +59,20 @@
- id: CP14SeedCucumber
amount: 3
- id: CP14SeedTomato
amount: 3
amount: 3
- type: entity
parent: CP14BrassChest
id: CP14BrassChestFilledDemiplanes
suffix: Demiplanes
components:
- type: StorageFill
contents:
- id: CP14DemiplanKey
amount: 9
- id: CP14DemiplanKey
amount: 1
prob: 0.5
- id: CP14DemiplanKey
amount: 1
prob: 0.5

View File

@@ -26,26 +26,6 @@
difficultyLimit: 0.75
maxModifiers: 6
- type: entity
id: CP14DemiplanKeyHard
parent: CP14BaseSubdimensionalKey
name: hard demiplan key - hard
components:
- type: CP14DemiplaneGeneratorData
rewardLimit: 2.25
difficultyLimit: 1.75
maxModifiers: 10
- type: entity
id: CP14DemiplanKeyHardcore
parent: CP14BaseSubdimensionalKey
name: demiplan key - HARDCORE
components:
- type: CP14DemiplaneGeneratorData
rewardLimit: 4.25
difficultyLimit: 2.75
maxModifiers: 15
- type: entity
id: CP14DemiplanRiftCore
categories: [ ForkFiltered ]

View File

@@ -1,6 +1,7 @@
- type: cp14DemiplaneLocation
id: T1Caves
locationConfig: CP14DemiplaneCaves
name: cp14-demiplane-location-cave
tags:
- CP14DemiplaneCave
- CP14DemiplaneUnderground

View File

@@ -1,6 +1,7 @@
- type: cp14DemiplaneLocation
id: T1CavesRing
locationConfig: CP14DemiplaneCavesRing
name: cp14-demiplane-location-cave
tags:
- CP14DemiplaneCave
- CP14DemiplaneUnderground

View File

@@ -1,6 +1,7 @@
- type: cp14DemiplaneLocation
id: T1GrassGeode
locationConfig: CP14DemiplaneGrassGeode
name: cp14-demiplane-location-cave-grass
tags:
- CP14DemiplaneCave
- CP14DemiplaneGrass

View File

@@ -1,6 +1,7 @@
- type: cp14DemiplaneLocation
id: T1GrasslandIsland
locationConfig: CP14DemiplaneGrasslandIsland
name: cp14-demiplane-location-grassland-island
tags:
- CP14DemiplaneCave
- CP14DemiplaneOpenSky

View File

@@ -1,6 +1,7 @@
- type: cp14DemiplaneLocation
id: T1GrasslandIslandRing
locationConfig: CP14DemiplaneGrasslandIslandRing
name: cp14-demiplane-location-grassland-island
tags:
- CP14DemiplaneOpenSky
- CP14DemiplaneGrass

View File

@@ -1,5 +1,6 @@
- type: cp14DemiplaneModifier
id: GoldOre
name: cp14-modifier-gold-ore
unique: false
reward: 0.5
requiredTags:
@@ -15,6 +16,7 @@
- type: cp14DemiplaneModifier
id: IronOre
name: cp14-modifier-iron-ore
unique: false
reward: 0.4
requiredTags:
@@ -30,6 +32,7 @@
- type: cp14DemiplaneModifier
id: CopperOre
name: cp14-modifier-copper-ore
unique: false
reward: 0.3
requiredTags:
@@ -45,6 +48,7 @@
- type: cp14DemiplaneModifier
id: QuartzCrystal
name: cp14-modifier-quartz-crystal
reward: 0.1
requiredTags:
- CP14DemiplaneCave
@@ -59,6 +63,7 @@
- type: cp14DemiplaneModifier
id: QuartzCrystalRubies
name: cp14-modifier-quartz-crystal
reward: 0.2
generationWeight: 0.1
requiredTags:
@@ -75,6 +80,7 @@
- type: cp14DemiplaneModifier
id: QuartzCrystalTopazes
name: cp14-modifier-quartz-crystal
reward: 0.2
generationWeight: 0.1
requiredTags:
@@ -91,6 +97,7 @@
- type: cp14DemiplaneModifier
id: QuartzCrystalEmeralds
name: cp14-modifier-quartz-crystal
reward: 0.2
generationWeight: 0.1
requiredTags:
@@ -109,6 +116,7 @@
- type: cp14DemiplaneModifier
id: QuartzCrystalSapphires
name: cp14-modifier-quartz-crystal
reward: 0.2
generationWeight: 0.1
requiredTags:
@@ -127,6 +135,7 @@
- type: cp14DemiplaneModifier
id: QuartzCrystalAmethysts
name: cp14-modifier-quartz-crystal
reward: 0.2
generationWeight: 0.1
requiredTags:
@@ -143,6 +152,7 @@
- type: cp14DemiplaneModifier
id: QuartzCrystalDiamonds
name: cp14-modifier-quartz-crystal
reward: 0.2
generationWeight: 0.1
requiredTags:
@@ -160,6 +170,7 @@
- type: cp14DemiplaneModifier
id: Dayflin
name: cp14-modifier-dayflin
reward: 0.2
requiredTags:
- CP14DemiplaneGrass
@@ -175,8 +186,27 @@
minGroupSize: 3
maxGroupSize: 5
- type: cp14DemiplaneModifier
id: FlyAgaric
name: cp14-modifier-fly-agaric
reward: 0.2
requiredTags:
- CP14DemiplaneGrass
layers:
- !type:OreDunGen
tileMask:
- CP14FloorBase
- CP14FloorGrass
- CP14FloorGrassLight
- CP14FloorGrassTall
entity: CP14GatherableFlyAgaric
count: 10
minGroupSize: 3
maxGroupSize: 5
- type: cp14DemiplaneModifier
id: BlueAmanita
name: cp14-modifier-blue-amanita
reward: 0.2
requiredTags:
- CP14DemiplaneGrass
@@ -193,6 +223,7 @@
- type: cp14DemiplaneModifier
id: BloodFlower
name: cp14-modifier-blood-flower
reward: 0.2
requiredTags:
- CP14DemiplaneGrass
@@ -209,6 +240,7 @@
- type: cp14DemiplaneModifier
id: WildSage
name: cp14-modifier-wild-sage
reward: 0.2
requiredTags:
- CP14DemiplaneGrass
@@ -226,6 +258,7 @@
- type: cp14DemiplaneModifier
id: LumiShroom
name: cp14-modifier-lumisroom
reward: 0.2
requiredTags:
- CP14DemiplaneUnderground
@@ -243,6 +276,7 @@
- type: cp14DemiplaneModifier
id: Explosive
name: cp14-modifier-explosive
difficulty: 0.4
generationWeight: 0.25
layers:
@@ -254,6 +288,7 @@
- type: cp14DemiplaneModifier
id: Ruins
name: cp14-modifier-ruins
reward: 0.35
generationWeight: 2
layers:
@@ -265,6 +300,7 @@
- type: cp14DemiplaneModifier
id: EnemyXeno
name: cp14-modifier-xeno
difficulty: 0.5
requiredTags:
- CP14DemiplaneUnderground
@@ -282,6 +318,7 @@
- type: cp14DemiplaneModifier
id: EnemyZombie
name: cp14-modifier-zombie
difficulty: 0.4
generationWeight: 1.5
layers:
@@ -293,6 +330,7 @@
- type: cp14DemiplaneModifier
id: EnemyDyno
name: cp14-modifier-dyno
difficulty: 0.5
requiredTags:
- CP14DemiplaneOpenSky
@@ -306,6 +344,7 @@
- type: cp14DemiplaneModifier
id: SmallHydra
name: cp14-modifier-dyno
difficulty: 0.5
requiredTags:
- CP14DemiplaneGrass
@@ -318,7 +357,8 @@
- type: cp14DemiplaneModifier
id: EnemyMole
difficulty: 0.5
name: cp14-modifier-mole
difficulty: 0.4
requiredTags:
- CP14DemiplaneUnderground
- CP14DemiplaneCave
@@ -327,23 +367,13 @@
tileMask:
- CP14FloorBase
entity: CP14MobMonsterMole
count: 5
count: 6
minGroupSize: 1
maxGroupSize: 2
- type: cp14DemiplaneModifier
id: EnemyMagmawind
difficulty: 0.3
generationWeight: 0.4
layers:
- !type:OreDunGen
entity: CP14MobWatcherMagmawing
count: 5
minGroupSize: 2
maxGroupSize: 3
maxGroupSize: 1
- type: cp14DemiplaneModifier
id: Rabbits
name: cp14-modifier-rabbits
reward: 0.2
generationWeight: 0.4
requiredTags:
@@ -361,6 +391,7 @@
- type: cp14DemiplaneModifier
id: Boar
name: cp14-modifier-boars
reward: 0.2
difficulty: 0.2
generationWeight: 0.4
@@ -379,6 +410,7 @@
- type: cp14DemiplaneModifier
id: Chasm
name: cp14-modifier-chasm
difficulty: 0.2
generationWeight: 0.6
layers:

View File

@@ -63,10 +63,10 @@
CP14BrassChestFilledFarmSeeds: 1
- type: storePositionBuy
id: Demiplan
id: Demiplane
name: cp14-store-buy-alchemy-demiplan-name
desc: cp14-store-buy-alchemy-demiplan-desc
code: DEMIPLAN
code: DEMIPLANE
icon:
sprite: /Textures/_CP14/Structures/Dungeon/demiplan_rift.rsi
state: pulse
@@ -76,4 +76,4 @@
services:
- !type:CP14BuyItemsService
product:
CP14DemiplanKey: 1
CP14BrassChestFilledDemiplanes: 1