Blood moon part 2 (#1272)

* som tweaks

* fixing all

* bloodlust spell

* atatat
This commit is contained in:
Ed
2025-05-17 14:12:49 +03:00
committed by GitHub
parent 74707a98c3
commit 23c9e11019
24 changed files with 174 additions and 74 deletions

View File

@@ -27,5 +27,5 @@ public sealed partial class CP14LocalizationVisualsComponent : Component
///
/// </summary>
[DataField]
public Dictionary<string, Dictionary<string, string>> MapStates;
public Dictionary<string, Dictionary<string, string>> MapStates = new();
}

View File

@@ -64,7 +64,7 @@ public sealed partial class ChatSystem : SharedChatSystem
public const int VoiceRange = 10; // how far voice goes in world units
public const int WhisperClearRange = 2; // how far whisper goes while still being understandable, in world units
public const int WhisperMuffledRange = 5; // how far whisper goes at all, in world units
public const string DefaultAnnouncementSound = "/Audio/_CP14/Ambience/event_boom.ogg"; //CP14 replaced default sound
public const string DefaultAnnouncementSound = "/Audio/_CP14/Announce/event_boom.ogg"; //CP14 replaced default sound
private bool _loocEnabled = true;
private bool _deadLoocEnabled;

View File

@@ -1,3 +1,4 @@
using System.Linq;
using Content.Server._CP14.GameTicking.Rules.Components;
using Content.Server.Antag;
using Content.Server.Chat.Systems;
@@ -7,11 +8,13 @@ using Content.Server.Station.Components;
using Content.Server.Stunnable;
using Content.Shared._CP14.BloodMoon;
using Content.Shared._CP14.DayCycle;
using Content.Shared.Actions;
using Content.Shared.Examine;
using Content.Shared.GameTicking.Components;
using Content.Shared.Mobs;
using Content.Shared.Popups;
using Content.Shared.Station.Components;
using Robust.Server.GameObjects;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Player;
namespace Content.Server._CP14.GameTicking.Rules;
@@ -23,6 +26,8 @@ public sealed class CP14BloodMoonCurseRule : GameRuleSystem<CP14BloodMoonCurseRu
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly ChatSystem _chatSystem = default!;
[Dependency] private readonly TransformSystem _transform = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedActionsSystem _action = default!;
public override void Initialize()
{
@@ -31,6 +36,12 @@ public sealed class CP14BloodMoonCurseRule : GameRuleSystem<CP14BloodMoonCurseRu
SubscribeLocalEvent<CP14StartDayEvent>(OnStartDay);
SubscribeLocalEvent<CP14BloodMoonCurseRuleComponent, AfterAntagEntitySelectedEvent>(AfterAntagEntitySelected);
SubscribeLocalEvent<CP14BloodMoonCurseComponent, ExaminedEvent>(CurseExamined);
SubscribeLocalEvent<CP14BloodMoonCurseComponent, MobStateChangedEvent>(OnDead);
}
private void OnDead(Entity<CP14BloodMoonCurseComponent> ent, ref MobStateChangedEvent args)
{
ClearCurse((ent.Owner, ent.Comp));
}
private void CurseExamined(Entity<CP14BloodMoonCurseComponent> ent, ref ExaminedEvent args)
@@ -44,7 +55,9 @@ public sealed class CP14BloodMoonCurseRule : GameRuleSystem<CP14BloodMoonCurseRu
var curseComp = EnsureComp<CP14BloodMoonCurseComponent>(args.EntityUid);
var effect = SpawnAttachedTo(curseComp.CurseEffect, Transform(args.EntityUid).Coordinates);
curseComp.SpawnedEffect = effect;
curseComp.CurseRule = ent;
_transform.SetParent(effect, args.EntityUid);
_action.AddAction(args.EntityUid, ref curseComp.ActionEntity, curseComp.Action);
}
protected override void Started(EntityUid uid,
@@ -54,6 +67,8 @@ public sealed class CP14BloodMoonCurseRule : GameRuleSystem<CP14BloodMoonCurseRu
{
Filter allPlayersInGame = Filter.Empty().AddWhere(GameTicker.UserHasJoinedGame);
_chatSystem.DispatchFilteredAnnouncement(allPlayersInGame, Loc.GetString(component.StartAnnouncement), colorOverride: component.AnnouncementColor);
_audio.PlayGlobal(component.GlobalSound, allPlayersInGame, true);
}
protected override void Ended(EntityUid uid,
@@ -68,25 +83,38 @@ public sealed class CP14BloodMoonCurseRule : GameRuleSystem<CP14BloodMoonCurseRu
foreach (var antag in aliveAntags)
{
_stun.TryParalyze(antag, component.EndStunDuration, true);
_popup.PopupEntity(Loc.GetString("cp14-bloodmoon-curse-removed"), antag, PopupType.SmallCaution);
SpawnAttachedTo(component.CurseEffect, Transform(antag).Coordinates);
if (TryComp<CP14BloodMoonCurseComponent>(antag, out var curseComp))
{
QueueDel(curseComp.SpawnedEffect);
RemCompDeferred<CP14BloodMoonCurseComponent>(antag);
}
ClearCurse(antag);
}
GameTicker.EndRound();
}
private void OnStartDay(CP14StartDayEvent ev)
{
if (!HasComp<BecomesStationComponent>(ev.Map))
return;
var query = QueryActiveRules();
while (query.MoveNext(out var uid, out _, out var comp, out _))
{
if (HasComp<BecomesStationComponent>(ev.Map) || HasComp<StationMemberComponent>(ev.Map))
ForceEndSelf(uid);
ForceEndSelf(uid);
}
}
private void ClearCurse(Entity<CP14BloodMoonCurseComponent?> ent)
{
if (!Resolve(ent.Owner, ref ent.Comp, false))
return;
_stun.TryParalyze(ent, ent.Comp.EndStunDuration, true);
_popup.PopupEntity(Loc.GetString("cp14-bloodmoon-curse-removed"), ent, PopupType.SmallCaution);
if (TryComp<CP14BloodMoonCurseComponent>(ent, out var curseComp))
{
QueueDel(curseComp.SpawnedEffect);
RemCompDeferred<CP14BloodMoonCurseComponent>(ent);
}
_action.RemoveAction(ent.Comp.ActionEntity);
}
}

View File

@@ -1,7 +1,11 @@
using Content.Server._CP14.GameTicking.Rules.Components;
using Content.Server.Chat.Systems;
using Content.Server.GameTicking.Rules;
using Content.Server.Station.Components;
using Content.Server.StationEvents.Events;
using Content.Shared._CP14.DayCycle;
using Content.Shared.GameTicking.Components;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Player;
namespace Content.Server._CP14.GameTicking.Rules;
@@ -9,39 +13,41 @@ namespace Content.Server._CP14.GameTicking.Rules;
public sealed class CP14BloodMoonRule : GameRuleSystem<CP14BloodMoonRuleComponent>
{
[Dependency] private readonly ChatSystem _chatSystem = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<CP14StartDayEvent>(OnStartDay);
SubscribeLocalEvent<CP14StartNightEvent>(OnStartNight);
}
private void OnStartDay(CP14StartDayEvent ev)
protected override void Started(EntityUid uid,
CP14BloodMoonRuleComponent component,
GameRuleComponent gameRule,
GameRuleStartedEvent args)
{
var query = QueryActiveRules();
while (query.MoveNext(out var uid, out _, out var comp, out _))
{
if (!comp.Announced)
{
comp.Announced = true;
base.Started(uid, component, gameRule, args);
Filter allPlayersInGame = Filter.Empty().AddWhere(GameTicker.UserHasJoinedGame);
_chatSystem.DispatchFilteredAnnouncement(allPlayersInGame, Loc.GetString(comp.StartAnnouncement), playSound: false, sender: Loc.GetString("cp14-announcement-gamemaster"), colorOverride: comp.AnnouncementColor);
}
}
Filter allPlayersInGame = Filter.Empty().AddWhere(GameTicker.UserHasJoinedGame);
_chatSystem.DispatchFilteredAnnouncement(
allPlayersInGame,
message: Loc.GetString(component.StartAnnouncement),
colorOverride: component.AnnouncementColor);
_audio.PlayGlobal(component.AnnounceSound, allPlayersInGame, true);
}
private void OnStartNight(CP14StartNightEvent ev)
{
if (!HasComp<BecomesStationComponent>(ev.Map))
return;
var query = QueryActiveRules();
while (query.MoveNext(out var uid, out _, out var comp, out _))
{
if (!comp.Announced)
continue;
GameTicker.AddGameRule(comp.CurseRule);
var ruleEnt = GameTicker.AddGameRule(comp.CurseRule);
GameTicker.StartGameRule(ruleEnt);
ForceEndSelf(uid);
}
}

View File

@@ -1,3 +1,4 @@
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
namespace Content.Server._CP14.GameTicking.Rules.Components;
@@ -15,8 +16,11 @@ public sealed partial class CP14BloodMoonCurseRuleComponent : Component
public Color? AnnouncementColor;
[DataField]
public TimeSpan EndStunDuration = TimeSpan.FromSeconds(60f);
public EntProtoId CurseEffect = "CP14ImpactEffectMagicSplitting";
[DataField]
public EntProtoId CurseEffect = "CP14ImpactEffectMagicSplitting";
public SoundSpecifier GlobalSound = new SoundPathSpecifier("/Audio/_CP14/Ambience/blood_moon_raise.ogg")
{
Params = AudioParams.Default.WithVolume(-2f)
};
}

View File

@@ -1,3 +1,4 @@
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
namespace Content.Server._CP14.GameTicking.Rules.Components;
@@ -8,12 +9,12 @@ public sealed partial class CP14BloodMoonRuleComponent : Component
[DataField]
public EntProtoId CurseRule = "CP14BloodMoonCurseRule";
[DataField]
public bool Announced = false;
[DataField]
public LocId StartAnnouncement = "cp14-bloodmoon-raising";
[DataField]
public Color? AnnouncementColor = Color.FromHex("#e32759");
[DataField]
public SoundSpecifier? AnnounceSound;
}

View File

@@ -51,7 +51,7 @@ public sealed partial class CP14RoundEndSystem : EntitySystem
_demiplane.DeleteAllDemiplanes(safe: false);
_chatSystem.DispatchGlobalAnnouncement(Loc.GetString("cp14-round-end"),
announcementSound: new SoundPathSpecifier("/Audio/_CP14/Ambience/event_boom.ogg"));
announcementSound: new SoundPathSpecifier("/Audio/_CP14/Announce/event_boom.ogg"));
_roundEnd.EndRound();
}
@@ -63,7 +63,7 @@ public sealed partial class CP14RoundEndSystem : EntitySystem
{
_chatSystem.DispatchGlobalAnnouncement(
Loc.GetString("cp14-round-end-monolith-50"),
announcementSound: new SoundPathSpecifier("/Audio/_CP14/Ambience/event_boom.ogg"));
announcementSound: new SoundPathSpecifier("/Audio/_CP14/Announce/event_boom.ogg"));
}
//We initiate round end timer
@@ -99,7 +99,7 @@ public sealed partial class CP14RoundEndSystem : EntitySystem
"cp14-round-end-monolith-discharged",
("time", time),
("units", Loc.GetString(unitsLocString))),
announcementSound: new SoundPathSpecifier("/Audio/_CP14/Ambience/event_boom.ogg"));
announcementSound: new SoundPathSpecifier("/Audio/_CP14/Announce/event_boom.ogg"));
}
private void CancelRoundEndTimer()
@@ -107,6 +107,6 @@ public sealed partial class CP14RoundEndSystem : EntitySystem
_roundEndMoment = TimeSpan.Zero;
_chatSystem.DispatchGlobalAnnouncement(Loc.GetString("cp14-round-end-monolith-recharged"),
announcementSound: new SoundPathSpecifier("/Audio/_CP14/Ambience/event_boom.ogg"));
announcementSound: new SoundPathSpecifier("/Audio/_CP14/Announce/event_boom.ogg"));
}
}

View File

@@ -7,9 +7,21 @@ namespace Content.Shared._CP14.BloodMoon;
[RegisterComponent, NetworkedComponent]
public sealed partial class CP14BloodMoonCurseComponent : Component
{
[DataField]
public EntityUid? CurseRule;
[DataField]
public EntProtoId CurseEffect = "CP14BloodMoonCurseEffect";
[DataField]
public EntityUid? SpawnedEffect;
[DataField]
public TimeSpan EndStunDuration = TimeSpan.FromSeconds(60f);
[DataField]
public EntProtoId Action = "CP14ActionSpellBloodlust";
[DataField]
public EntityUid? ActionEntity;
}

View File

@@ -121,10 +121,10 @@ public sealed class CP14DayCycleSystem : EntitySystem
public sealed class CP14StartNightEvent(EntityUid map) : EntityEventArgs
{
public EntityUid? Map = map;
public EntityUid Map = map;
}
public sealed class CP14StartDayEvent(EntityUid map) : EntityEventArgs
{
public EntityUid? Map = map;
public EntityUid Map = map;
}

View File

@@ -23,6 +23,11 @@
copyright: 'by be-steele of Freesound.org.'
source: "https://freesound.org/people/be-steele/sounds/130753/"
- files: ["blood_moon_raise.ogg"]
license: "CC-BY-4.0"
copyright: 'by xkeril of Freesound.org.'
source: "https://freesound.org/people/xkeril/sounds/639585/"
- files: ["ambimagic1.ogg", "ambimagic2.ogg", "ambimagic3.ogg", "ambimagic4.ogg"]
license: "CC-BY-4.0"
copyright: 'by EminYILDIRIM of Freesound.org.'
@@ -31,9 +36,4 @@
- files: ["ambimagic5.ogg", "ambimagic6.ogg"]
license: "CC0-1.0"
copyright: 'by xkeril of Freesound.org.'
source: "https://freesound.org/people/xkeril/sounds/706092/"
- files: ["event_boom.ogg"]
license: "CC-BY-4.0"
copyright: 'by juskiddink of Freesound.org.'
source: "https://freesound.org/people/juskiddink/sounds/130890/"
source: "https://freesound.org/people/xkeril/sounds/706092/"

Binary file not shown.

View File

@@ -0,0 +1,9 @@
- files: ["event_boom.ogg"]
license: "CC-BY-4.0"
copyright: 'by juskiddink of Freesound.org.'
source: "https://freesound.org/people/juskiddink/sounds/130890/"
- files: ["darkness_boom.ogg", "darkness_boom_2.ogg"]
license: "CC-BY-4.0"
copyright: 'by Uzbazur of Freesound.org.'
source: "https://freesound.org/people/Uzbazur/sounds/442241/"

Binary file not shown.

Binary file not shown.

View File

@@ -1,4 +1,4 @@
cp14-bloodmoon-raising = A blood moon rises on the horizon. The next night will be terrible.
cp14-bloodmoon-raising = The moon in the sky is stained with blood. The next night will be terrible.
cp14-bloodmoon-start = The blood moon shines in full force, enslaving minds.
cp14-bloodmoon-end = The blood moon sets over the horizon, losing its power.

View File

@@ -1,4 +1,4 @@
cp14-bloodmoon-raising = На горизонте поднимается кровавая луна. Следующая ночь будет ужасной.
cp14-bloodmoon-raising = Луна на небосводе обагривается кровью. Следующая ночь будет ужасной.
cp14-bloodmoon-start = Кровавая луна сияет в полную силу, порабощая разумы.
cp14-bloodmoon-end = Кровавая луна заходит за горизонт, теряя свою силу.

View File

@@ -0,0 +1,56 @@
- type: entity
id: CP14ActionSpellBloodlust
name: Bloodlust
description: you sense all living things in a large radius around you that you want to KILL.
components:
- type: Sprite
sprite: _CP14/Actions/Spells/vampire.rsi
state: blood_moon
- type: CP14MagicEffect
effects:
- !type:CP14SpellSpawnEntityOnTarget
spawns:
- CP14ImpactEffectVampireHypnosis
- !type:CP14SpellPointerToAlive
pointerEntity: CP14BloodlustPointer
searchRange: 60
- type: CP14MagicEffectVerbalAspect
startSpeech: "Ego vultus..."
endSpeech: "parumper vita"
- type: CP14MagicEffectSomaticAspect
- type: CP14MagicEffectCastingVisual
proto: CP14RuneVampireHypnosis
- type: InstantAction
itemIconStyle: BigAction
sound: !type:SoundPathSpecifier
path: /Audio/Magic/rumble.ogg
icon:
sprite: _CP14/Actions/Spells/vampire.rsi
state: blood_moon
event: !type:CP14DelayedInstantActionEvent
cooldown: 30
castDelay: 1.5
- type: entity
id: CP14BloodlustPointer
name: pointer
categories: [ HideSpawnMenu ]
components:
- type: Sprite
color: red
sprite: /Textures/_CP14/Effects/Magic/pointer.rsi
offset: 0, -1
layers:
- state: pointer
shader: unshaded
drawdepth: LowFloors
- type: PointLight
netSync: false
radius: 3
color: red
energy: 0.2
- type: TimedDespawn
lifetime: 8
- type: Tag
tags:
- HideContextMenu

View File

@@ -27,7 +27,6 @@
- type: TimedDespawn
lifetime: 1.6
- type: AnimationPlayer
- type: EffectVisuals
- type: Tag
tags:
- HideContextMenu

View File

@@ -14,7 +14,6 @@
shader: unshaded
- type: TimedDespawn
lifetime: 2
- type: EffectVisuals
- type: Tag
tags:
- HideContextMenu

View File

@@ -17,7 +17,6 @@
dirt2: ""
- type: TimedDespawn
lifetime: 2
- type: EffectVisuals
- type: Tag
tags:
- HideContextMenu
@@ -53,7 +52,6 @@
drawdepth: Items
sprite: _CP14/Effects/dust.rsi
state: dust
- type: EffectVisuals
- type: Tag
tags:
- HideContextMenu
@@ -104,19 +102,13 @@
components:
- type: Sprite
noRot: true
color: "#FFFFFF33"
sprite: /Textures/_CP14/Effects/Magic/blood_moon_curse.rsi
drawdepth: Effects
layers:
- state: icon
shader: unshaded
- type: Physics
canCollide: false
- type: Tag
tags:
- HideContextMenu
- type: PointLight
color: "#a83256"
enabled: true
radius: 2
energy: 2
netsync: false
- HideContextMenu

View File

@@ -32,7 +32,7 @@
# - type: StationEvent
# startAnnouncement: cp14-event-announcement-demiplane-outbreak
# startAudio:
# path: /Audio/_CP14/Ambience/event_boom.ogg
# path: /Audio/_CP14/Announce/event_boom.ogg
# earliestStart: 20
# minimumPlayers: 15
# weight: 5
@@ -49,7 +49,7 @@
- type: StationEvent
startAnnouncement: cp14-event-announcement-demiplane-outbreak
startAudio:
path: /Audio/_CP14/Ambience/event_boom.ogg
path: /Audio/_CP14/Announce/event_boom.ogg
earliestStart: 20
minimumPlayers: 15
weight: 1

View File

@@ -4,8 +4,12 @@
components:
- type: CP14BloodMoonRule
curseRule: CP14BloodMoonCurseRule
announceSound:
path: /Audio/_CP14/Announce/darkness_boom.ogg
- type: GameRule
minPlayers: 0
delay:
min: 30
max: 60
- type: entity
id: CP14BloodMoonCurseRule
@@ -13,16 +17,6 @@
components:
- type: CP14BloodMoonCurseRule
announcementColor: "#e32759"
- type: StationEvent
maxOccurrences: 0 #We dont wanna random start it
startAnnouncement: cp14-bloodmoon-start
startAudio:
path: /Audio/_CP14/Ambience/event_boom.ogg
startAnnouncementColor: "#e32759"
endAnnouncement: cp14-bloodmoon-end
endAudio:
path: /Audio/_CP14/Ambience/event_boom.ogg
endAnnouncementColor: "#e32759"
- type: AntagSelection
definitions:
- prefRoles: [ CP14BloodMoonCursed ]
@@ -36,4 +30,4 @@
briefing:
text: cp14-roles-antag-blood-moon-cursed-briefing
color: "#630f24"
sound: "/Audio/_CP14/Ambience/Antag/bandit_start.ogg"
sound: "/Audio/_CP14/Announce/darkness_boom_2.ogg"

View File

@@ -42,4 +42,4 @@
rules:
- CP14RoundObjectivesRule
- CP14BasicStationEventScheduler
- CP14BloodMoonRule
- CP14BloodMoonRule