Unstable demiplanes (#858)

* events

* heartbeat ambient

* Update unstable_rift.yml
This commit is contained in:
Ed
2025-02-08 01:09:48 +03:00
committed by GitHub
parent a264f97282
commit 78e690f38a
19 changed files with 421 additions and 113 deletions

View File

@@ -31,7 +31,7 @@ public sealed partial class CP14DemiplaneSystem
private void InitGeneration()
{
SubscribeLocalEvent<CP14DemiplaneGeneratorDataComponent, MapInitEvent>(GeneratorMapInit);
SubscribeLocalEvent<CP14DemiplaneGeneratorDataComponent, UseInHandEvent>(GeneratorUsedInHand);
SubscribeLocalEvent<CP14DemiplaneUsingOpenComponent, UseInHandEvent>(GeneratorUsedInHand);
SubscribeLocalEvent<CP14DemiplaneGeneratorDataComponent, GetVerbsEvent<ExamineVerb>>(OnVerbExamine);
}
@@ -137,18 +137,20 @@ public sealed partial class CP14DemiplaneSystem
_expeditionQueue.EnqueueJob(job);
}
private void GeneratorUsedInHand(Entity<CP14DemiplaneGeneratorDataComponent> generator, ref UseInHandEvent args)
private void UseGenerator(Entity<CP14DemiplaneGeneratorDataComponent> generator, EntityUid? user = null)
{
//block the opening of demiplanes after the end of a round
if (_gameTicker.RunLevel != GameRunLevel.InRound)
{
_popup.PopupEntity(Loc.GetString("cp14-demiplan-cannot-open-end-round"), generator, args.User);
if (user is not null)
_popup.PopupEntity(Loc.GetString("cp14-demiplan-cannot-open-end-round"), generator, user.Value);
return;
}
//We cant open demiplane in another demiplane or if parent is not Map
if (_demiplaneQuery.HasComp(Transform(generator).MapUid) || !HasComp<MapGridComponent>(_transform.GetParentUid(args.User)))
if (_demiplaneQuery.HasComp(Transform(generator).MapUid))
{
_popup.PopupEntity(Loc.GetString("cp14-demiplan-cannot-open", ("name", MetaData(generator).EntityName)), generator, args.User);
if (user is not null)
_popup.PopupEntity(Loc.GetString("cp14-demiplan-cannot-open", ("name", MetaData(generator).EntityName)), generator, user.Value);
return;
}
@@ -177,22 +179,29 @@ public sealed partial class CP14DemiplaneSystem
//Admin log needed
EnsureComp<CP14DemiplaneDestroyWithoutStabilizationComponent>(demiplane.Value);
//Ура, щиткод и магические переменные!
var tempRift = EntityManager.Spawn("CP14DemiplaneTimedRadiusPassway");
var tempRift2 = EntityManager.Spawn("CP14DemiplanRiftCore");
_transform.SetCoordinates(tempRift, Transform(args.User).Coordinates);
_transform.SetCoordinates(tempRift2, Transform(args.User).Coordinates);
var connection = EnsureComp<CP14DemiplaneRiftComponent>(tempRift);
var connection2 = EnsureComp<CP14DemiplaneRiftComponent>(tempRift2);
AddDemiplaneRandomExitPoint(demiplane.Value, (tempRift, connection));
AddDemiplaneRandomExitPoint(demiplane.Value, (tempRift2, connection2));
//Rifts spawning
foreach (var rift in generator.Comp.AutoRifts)
{
var spawnedRift = EntityManager.Spawn(rift);
_transform.SetCoordinates(spawnedRift, Transform(generator).Coordinates);
_transform.AttachToGridOrMap(spawnedRift);
var connection = EnsureComp<CP14DemiplaneRiftComponent>(spawnedRift);
AddDemiplaneRandomExitPoint(demiplane.Value, (spawnedRift, connection));
}
#if !DEBUG
QueueDel(generator); //wtf its crash debug build!
#endif
}
private void GeneratorUsedInHand(Entity<CP14DemiplaneUsingOpenComponent> ent, ref UseInHandEvent args)
{
if (!TryComp<CP14DemiplaneGeneratorDataComponent>(ent, out var generator))
return;
UseGenerator((ent, generator), args.User);
}
private void GeneratorMapInit(Entity<CP14DemiplaneGeneratorDataComponent> generator, ref MapInitEvent args)
{
//Location generation
@@ -358,6 +367,9 @@ public sealed partial class CP14DemiplaneSystem
//Scenario generation
//ETC generation
if (HasComp<CP14DemiplaneAutoOpenComponent>(generator))
UseGenerator(generator);
}

View File

@@ -0,0 +1,9 @@
namespace Content.Server._CP14.Demiplane.Components;
/// <summary>
/// Open demiplane automatically on MapInit
/// </summary>
[RegisterComponent, Access(typeof(CP14DemiplaneSystem))]
public sealed partial class CP14DemiplaneAutoOpenComponent : Component
{
}

View File

@@ -27,4 +27,7 @@ public sealed partial class CP14DemiplaneGeneratorDataComponent : Component
[DataField]
public ProtoId<CP14RoundStatTrackerPrototype> Statistic = "DemiplaneOpen";
[DataField]
public List<EntProtoId> AutoRifts = new() { "CP14DemiplaneTimedRadiusPassway", "CP14DemiplanRiftCore" };
}

View File

@@ -0,0 +1,9 @@
namespace Content.Server._CP14.Demiplane.Components;
/// <summary>
/// Open demiplane from using in hand
/// </summary>
[RegisterComponent, Access(typeof(CP14DemiplaneSystem))]
public sealed partial class CP14DemiplaneUsingOpenComponent : Component
{
}

View File

@@ -57,3 +57,8 @@
license: "CC-BY-4.0"
copyright: 'Created by MIXnikita'
source: "https://github.com/crystallpunk-14/crystall-punk-14"
- files: ["demiplane_heartbeat.ogg"]
license: "CC-BY-4.0"
copyright: 'by SpaceLife on Freesound.org'
source: "https://freesound.org/people/SpaceLife/sounds/545938/"

Binary file not shown.

View File

@@ -17,4 +17,5 @@ cp14-modifier-mole = predatory moles
cp14-modifier-rabbits = rabbits
cp14-modifier-boars = wild boars
cp14-modifier-chasm = bottomless chasms
cp14-modifier-air-lily = air lilies
cp14-modifier-air-lily = air lilies
cp14-modifier-unstable-demiplane-crystal = unstable demiplane crystal

View File

@@ -1 +1,2 @@
cp14-event-announcement-demiplane-outbreak = A sense of danger pierces the air... Something from other worlds is invading your town.
cp14-event-announcement-demiplane-outbreak = A sense of danger pierces the air... Something from other worlds is invading your town.
cp14-event-announcement-unstable-demiplane = Tension is building... an unstable demiplane has opened somewhere in the settlement. Close it down before the monsters come out.

View File

@@ -18,3 +18,4 @@ cp14-modifier-rabbits = кроликов
cp14-modifier-boars = диких кабанов
cp14-modifier-chasm = бездонных пропастей
cp14-modifier-air-lily = воздушных лилий
cp14-modifier-unstable-demiplane-crystal = нестабильного кристалла демипланов

View File

@@ -1 +1,2 @@
cp14-event-announcement-demiplane-outbreak = Воздух пронзает чувство опасности... Что-то из других миров вторгается в ваш городок.
cp14-event-announcement-demiplane-outbreak = Воздух пронзает чувство опасности... Что-то из других миров вторгается в ваш городок.
cp14-event-announcement-unstable-demiplane = Нарастает напряжение... где-то в городе открылся нестабильный демиплан. Закройте его, до того как из него вырвутся толпы монстров.

View File

@@ -37,6 +37,7 @@
- type: entity
id: CP14GuildmaterTimedTeleport
categories: [ ForkFiltered ]
suffix: Teleport to demiplane crystal
name: pulsating demiplane rift
description: This rift is gaining strength, and will trap all nearby creatures in a demiplane in a second!
components:

View File

@@ -112,3 +112,31 @@
range: 2, 3
children:
- id: CP14MobRabbit
- type: entity
parent: CP14BaseMobGroupSpawner
id: CP14MobGroupSpawnerFrogs
suffix: 2-3 Frogs
components:
- type: EntityTableSpawner
deleteSpawnerAfterSpawn: false
offset: 1
table: !type:GroupSelector
rolls: !type:RangeNumberSelector
range: 2, 3
children:
- id: CP14MobFrog
- type: entity
parent: CP14BaseMobGroupSpawner
id: CP14MobGroupSpawnerIceSpectres
suffix: 1-2 Ice spectres
components:
- type: EntityTableSpawner
deleteSpawnerAfterSpawn: false
offset: 1
table: !type:GroupSelector
rolls: !type:RangeNumberSelector
range: 1, 2
children:
- id: CP14MobIceSpectre

View File

@@ -17,6 +17,7 @@
guides:
- CP14_RU_Demiplanes
- CP14_EN_Demiplanes
- type: CP14DemiplaneUsingOpen
- type: entity
id: CP14DemiplaneKeyT1

View File

@@ -0,0 +1,104 @@
- type: entity
id: CP14DemiplaneTimedRadiusPassway
parent: CP14DemiplanRiftCore
name: pulsating demiplane rift
description: This rift is gaining strength, and will trap all nearby creatures in a demiplane in a second!
components:
- type: CP14DemiplaneRift
activeTeleport: false
- type: CP14DemiplaneRadiusTimedPassway
maxEntities: 4
delay: 4
- type: Sprite
drawdepth: Effects
sprite: /Textures/_CP14/Structures/Dungeon/demiplan_rift.rsi
layers:
- state: pulse
shader: unshaded
- type: PointLight
radius: 8
- type: SingularityDistortion
falloffPower: 1.5
intensity: 50
- type: AmbientSound
volume: -3
range: 7
sound:
path: /Audio/Ambience/Objects/gravity_gen_hum.ogg
- type: GuideHelp
guides:
- CP14_RU_Demiplanes
- CP14_EN_Demiplanes
- type: entity
id: CP14DemiplanePassway
parent: CP14DemiplanRiftCore
name: demiplane rift
description: A gap in space that allows you to travel between world and demiplanes.
components:
- type: CP14DemiplaneRiftOpened
- type: CP14DemiplaneRift
activeTeleport: false
- type: Sprite
drawdepth: Effects
sprite: /Textures/_CP14/Structures/Dungeon/demiplan_rift.rsi
layers:
- state: anom
shader: unshaded
- type: SingularityDistortion
falloffPower: 1.5
intensity: 50
- type: AmbientSound
volume: -3
range: 7
sound:
path: /Audio/Ambience/Objects/gravity_gen_hum.ogg
- type: GuideHelp
guides:
- CP14_RU_Demiplanes
- CP14_EN_Demiplanes
- type: entity
id: CP14DemiplanePasswayRed
parent: CP14DemiplanePassway
components:
- type: Sprite
drawdepth: Effects
sprite: /Textures/_CP14/Structures/Dungeon/demiplan_rift.rsi
layers:
- state: anom
shader: unshaded
color: red
- type: PointLight
color: red
- type: entity
id: CP14DemiplanRiftCore
categories: [ ForkFiltered ]
name: demiplan rift core
description: A subtle connection between the real world and the demiplane where the adventurers went. Sooner or later they will return from there.
components:
- type: CP14DemiplaneRift
- type: Transform
anchored: True
- type: Clickable
- type: Physics
canCollide: false
bodyType: Static
- type: Sprite
drawdepth: Effects
sprite: /Textures/_CP14/Structures/Dungeon/demiplan_rift_core.rsi
layers:
- state: connective
shader: unshaded
- type: PointLight
radius: 2
energy: 2
color: "#371c5c"
netsync: false
- type: GuideHelp
guides:
- CP14_RU_Demiplanes
- CP14_EN_Demiplanes
- type: Speech
speechVerb: Ghost

View File

@@ -0,0 +1,138 @@
- type: entity
id: CP14DangerousMobSpawnCrystal
name: unstable demiplane link crystal
description: Capable of opening many portals summoning creepy creatures if not destroyed in time! Hurry up! When it runs out of mana, it will start to collapse!
parent: BaseStructure
categories: [ ForkFiltered ]
components:
- type: SpriteFade
- type: Fixtures
fixtures:
fix1:
shape:
!type:PhysShapeAabb
bounds: "-0.15,-0.2,0.15,0.2"
density: 1000
layer:
- WallLayer
- type: Sprite
noRot: true
sprite: _CP14/Structures/Specific/Thaumaturgy/demiplane_link_crystal.rsi
layers:
- state: warning
color: red
drawdepth: Mobs
offset: 0,0.9
- type: PointLight
enabled: true
color: red
energy: 3
radius: 10
- type: LightBehaviour
behaviours:
- !type:PulseBehaviour
interpolate: Cubic
maxDuration: 1
minValue: 1.0
maxValue: 40.0
property: Energy
isLooped: true
enabled: true
- type: MeleeSound
soundGroups:
Brute:
collection: GlassSmash
- type: Damageable
- type: Destructible
thresholds:
- trigger:
!type:DamageTypeTrigger
damageType: Heat
damage: 2
behaviors:
- !type:TriggerBehavior
- !type:DoActsBehavior
acts: [ "Destruction" ]
- trigger:
!type:DamageTrigger
damage: 50
behaviors:
- !type:DoActsBehavior
acts: [ "Destruction" ]
- !type:SpawnEntitiesBehavior
spawn:
CP14DemiplaneKeyT1:
min: 0
max: 2
- !type:SpawnEntitiesBehavior
spawn:
CP14DemiplaneKeyT2:
min: 1
max: 1
- !type:PlaySoundBehavior
sound:
collection: GlassBreak
- type: CP14MagicEnergyExaminable
- type: CP14MagicEnergyContainer
maxEnergy: 500
energy: 500
- type: CP14MagicEnergyDraw
energy: -5
delay: 6 # 10m to discharge
safe: false
- type: CP14MagicUnsafeDamage
damagePerEnergy:
types:
Heat: 0.1
- type: DeleteOnTrigger
- type: SpawnOnTrigger
proto: CP14MobGroupSpawnerRandom
- type: CP14DemiplaneStabilizer
- type: AmbientSound
volume: 10
range: 15
sound:
path: /Audio/_CP14/Effects/demiplane_heartbeat.ogg
- type: entity
parent: MarkerBase
name: mob group random spawner
id: CP14MobGroupSpawnerRandom
categories: [ ForkFiltered ]
components:
- type: CP14SpawnOutOfDemiplane
- type: EntityTableSpawner
offset: 3
table: !type:GroupSelector
rolls: !type:RangeNumberSelector
range: 1, 2
children:
- id: CP14MobGroupSpawnerHydras
- id: CP14MobGroupSpawnerMosquito
- id: CP14MobGroupSpawnerZombie
- type: entity
id: CP14AutoDemiplaneKeyT1
parent: CP14DemiplaneKeyT1
suffix: T1, Auto Open
components:
- type: CP14DemiplaneAutoOpen
- type: CP14DemiplaneGeneratorData
autoRifts:
- CP14DemiplanRiftCore
- CP14DemiplanePasswayRed
selectedModifiers:
- UnstableDemiplaneCrystal
- type: entity
id: CP14AutoDemiplaneKeyT2
parent: CP14DemiplaneKeyT2
suffix: T2, Auto Open
components:
- type: CP14DemiplaneAutoOpen
- type: CP14DemiplaneGeneratorData
autoRifts:
- CP14DemiplanRiftCore
- CP14DemiplanePasswayRed
selectedModifiers:
- UnstableDemiplaneCrystal

View File

@@ -55,4 +55,9 @@
energy: 1000
- type: CP14MagicEnergyDraw
energy: -10
delay: 60 # 1h 30 minutes to full discharge
delay: 60 # 1h 30 minutes to full discharge
- type: AmbientSound
volume: 5
range: 10
sound:
path: /Audio/_CP14/Effects/demiplane_heartbeat.ogg

View File

@@ -48,95 +48,4 @@
- type: InteractionOutline
- type: Physics
- type: Damageable
- type: CP14DPSMeter
- type: entity
id: CP14DemiplanRiftCore
categories: [ ForkFiltered ]
name: demiplan rift core
description: A subtle connection between the real world and the demiplane where the adventurers went. Sooner or later they will return from there.
components:
- type: CP14DemiplaneRift
- type: Transform
anchored: True
- type: Clickable
- type: Physics
canCollide: false
bodyType: Static
- type: Sprite
drawdepth: Effects
sprite: /Textures/_CP14/Structures/Dungeon/demiplan_rift_core.rsi
layers:
- state: connective
shader: unshaded
- type: PointLight
radius: 2
energy: 2
color: "#371c5c"
netsync: false
- type: GuideHelp
guides:
- CP14_RU_Demiplanes
- CP14_EN_Demiplanes
- type: Speech
speechVerb: Ghost
- type: entity
id: CP14DemiplaneTimedRadiusPassway
parent: CP14DemiplanRiftCore
name: pulsating demiplane rift
description: This rift is gaining strength, and will trap all nearby creatures in a demiplane in a second!
components:
- type: CP14DemiplaneRift
activeTeleport: false
- type: CP14DemiplaneRadiusTimedPassway
maxEntities: 4
delay: 4
- type: Sprite
drawdepth: Effects
sprite: /Textures/_CP14/Structures/Dungeon/demiplan_rift.rsi
layers:
- state: pulse
shader: unshaded
- type: PointLight
radius: 8
- type: SingularityDistortion
falloffPower: 1.5
intensity: 50
- type: AmbientSound
volume: -3
range: 7
sound:
path: /Audio/Ambience/Objects/gravity_gen_hum.ogg
- type: GuideHelp
guides:
- CP14_RU_Demiplanes
- CP14_EN_Demiplanes
- type: entity
id: CP14DemiplanePassway
parent: CP14DemiplanRiftCore
name: demiplane rift
description: A gap in space that allows you to travel between world and demiplanes.
components:
- type: CP14DemiplaneRiftOpened
- type: CP14DemiplaneRift
activeTeleport: false
- type: Sprite
drawdepth: Effects
sprite: /Textures/_CP14/Structures/Dungeon/demiplan_rift.rsi
layers:
- state: anom
shader: unshaded
- type: SingularityDistortion
falloffPower: 1.5
intensity: 50
- type: AmbientSound
volume: -3
range: 7
sound:
path: /Audio/Ambience/Objects/gravity_gen_hum.ogg
- type: GuideHelp
guides:
- CP14_RU_Demiplanes
- CP14_EN_Demiplanes
- type: CP14DPSMeter

View File

@@ -8,6 +8,16 @@
min: 10
max: 20
- type: entity
parent: CP14BaseGameRule
id: CP14BaseStationEventLongDelay
abstract: true
components:
- type: GameRule
delay:
min: 40
max: 60
- type: entityTable
id: CP14BasicCalmEventsTable
table: !type:AllSelector
@@ -16,6 +26,9 @@
- id: CP14HydrasSpawn
- id: CP14MosquitoSpawn
- id: CP14RabbitsSpawn
- id: CP14FrogsSpawn
- id: CP14UnstableDemiplaneT1
- id: CP14UnstableDemiplaneT2
- type: entity
parent: CP14BaseStationEventShortDelay
@@ -69,7 +82,7 @@
prob: 0.08
- type: entity
parent: CP14BaseStationEventShortDelay
parent: CP14BaseStationEventLongDelay
id: CP14RabbitsSpawn
components:
- type: StationEvent
@@ -84,3 +97,54 @@
entries:
- id: CP14MobGroupSpawnerRabbits
prob: 0.08
- type: entity
parent: CP14BaseStationEventLongDelay
id: CP14FrogsSpawn
components:
- type: StationEvent
startAnnouncement: cp14-event-announcement-demiplane-outbreak
startAudio:
path: /Audio/_CP14/Ambience/event_boom.ogg
earliestStart: 20
minimumPlayers: 10
weight: 5
duration: 60
- type: VentCrittersRule
entries:
- id: CP14MobGroupSpawnerFrogs
prob: 0.08
- type: entity
parent: CP14BaseStationEventShortDelay
id: CP14UnstableDemiplaneT1
components:
- type: StationEvent
startAnnouncement: cp14-event-announcement-unstable-demiplane
startAudio:
path: /Audio/_CP14/Ambience/event_boom.ogg
earliestStart: 20
minimumPlayers: 15
weight: 5
duration: 60
- type: VentCrittersRule
specialEntries:
- id: CP14AutoDemiplaneKeyT1
prob: 0.001
- type: entity
parent: CP14BaseStationEventShortDelay
id: CP14UnstableDemiplaneT2
components:
- type: StationEvent
startAnnouncement: cp14-event-announcement-unstable-demiplane
startAudio:
path: /Audio/_CP14/Ambience/event_boom.ogg
earliestStart: 20
minimumPlayers: 30
weight: 5
duration: 60
- type: VentCrittersRule
specialEntries:
- id: CP14AutoDemiplaneKeyT2
prob: 0.001

View File

@@ -52,4 +52,20 @@
entity: CP14AstralHaze
count: 10
minGroupSize: 1
maxGroupSize: 1
maxGroupSize: 1
- type: cp14DemiplaneModifier
id: UnstableDemiplaneCrystal
generationWeight: 0.05 # Very rare
tiers:
- 2
- 3
name: cp14-modifier-unstable-demiplane-crystal
categories:
Danger: 0.3
layers:
- !type:OreDunGen
entity: CP14DangerousMobSpawnCrystal
count: 1
minGroupSize: 1
maxGroupSize: 1