Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/sunrise_public/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
VigersRay committed Dec 26, 2024
2 parents 5feedef + cf85950 commit 0fe5013
Show file tree
Hide file tree
Showing 106 changed files with 39,045 additions and 21,464 deletions.
1 change: 1 addition & 0 deletions Content.Client/Options/UI/Tabs/SunriseTab.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<ui:OptionSlider Name="SliderTtsRadio" Title="{Loc 'ui-options-tts-radio-volume'}" />
<ui:OptionSlider Name="SliderTtsAnnounce" Title="{Loc 'ui-options-tts-announce-volume'}" />
<CheckBox Name="TapePlayerClientCheckBox" Text="{Loc 'ui-options-tape-player-enabled'}" />
<CheckBox Name="JumpEnabledSoundCheckBox" Text="{Loc 'ui-options-jump-sound-enabled'}" />

<!-- Graphics -->
<Label Text="{Loc 'ui-options-sunrise-general-graphics'}" StyleClasses="LabelKeyText"/>
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Options/UI/Tabs/SunriseTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public SunriseTab()

Control.AddOptionCheckBox(SunriseCCVars.TTSClientEnabled, TtsClientCheckBox);
Control.AddOptionCheckBox(SunriseCCVars.TapePlayerClientEnabled, TapePlayerClientCheckBox);
Control.AddOptionCheckBox(SunriseCCVars.JumpSoundEnabled, JumpEnabledSoundCheckBox);

_cfg.OnValueChanged(SunriseCCVars.LobbyBackgroundType, OnLobbyBackgroundTypeChanged, true);

Expand Down
14 changes: 3 additions & 11 deletions Content.Client/_Sunrise/Animations/EmoteAnimationSystem.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
using System.Numerics;
using Content.Shared._Sunrise.Animations;
using Content.Shared.Chat;
using Content.Shared.Chat.Prototypes;
using Content.Shared.Input;
using Content.Shared.Standing;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Shared.Animations;
using Robust.Shared.GameStates;
using Robust.Shared.Input.Binding;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;

namespace Content.Client._Sunrise.Animations;

Expand All @@ -28,7 +20,7 @@ public override void Initialize()
{
SubscribeLocalEvent<EmoteAnimationComponent, ComponentHandleState>(OnHandleState);

_emoteList.Add("EmoteFlip", uid =>
_emoteList.Add("Flip", uid =>
{
if (_animationSystem.HasRunningAnimation(uid, AnimationKey))
return;
Expand Down Expand Up @@ -63,7 +55,7 @@ public override void Initialize()
_animationSystem.Play(uid, animation, AnimationKey);
});

_emoteList.Add("EmoteJump", uid =>
_emoteList.Add("Jump", uid =>
{
if (_animationSystem.HasRunningAnimation(uid, AnimationKey))
return;
Expand Down Expand Up @@ -93,7 +85,7 @@ public override void Initialize()
_animationSystem.Play(uid, animation, AnimationKey);
});

_emoteList.Add("EmoteTurn", uid =>
_emoteList.Add("Dance", uid =>
{
if (_animationSystem.HasRunningAnimation(uid, AnimationKeyTurn))
return;
Expand Down
24 changes: 21 additions & 3 deletions Content.Client/_Sunrise/Jump/JumpSystem.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,46 @@
using Content.Shared._Sunrise.Jump;
using Content.Shared._Sunrise.SunriseCCVars;
using Content.Shared.Chat;
using Content.Shared.Chat.Prototypes;
using Content.Shared.Input;
using Robust.Shared.Configuration;
using Robust.Shared.Input.Binding;
using Robust.Shared.Player;
using Robust.Shared.Timing;

namespace Content.Client._Sunrise.Jump;

public sealed class JumpSystem : SharedJumpSystem
public sealed partial class JumpSystem : SharedJumpSystem
{
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;

private TimeSpan _lastJumpTime;
private static readonly TimeSpan JumpCooldown = TimeSpan.FromSeconds(1);
private static readonly TimeSpan JumpCooldown = TimeSpan.FromSeconds(0.600);

[ValidatePrototypeId<EmotePrototype>]
private const string EmoteJumpProto = "EmoteJump";
private const string EmoteJumpProto = "Jump";

public override void Initialize()
{
base.Initialize();

CommandBinds.Builder
.Bind(ContentKeyFunctions.Jump, InputCmdHandler.FromDelegate(Jump, handle: false, outsidePrediction: false))
.Register<JumpSystem>();

_cfg.OnValueChanged(SunriseCCVars.JumpSoundEnabled, OnJumpSoundEnabledOptionChanged, true);
}

public override void Shutdown()
{
base.Shutdown();
_cfg.UnsubValueChanged(SunriseCCVars.JumpSoundEnabled, OnJumpSoundEnabledOptionChanged);
}

private void OnJumpSoundEnabledOptionChanged(bool option)
{
RaiseNetworkEvent(new ClientOptionJumpSoundEvent(option));
}

private void Jump(ICommonSession? session)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public sealed partial class EmotesTabControl : BaseTabControl
[Dependency] private readonly IGameTiming _gameTiming = default!;

private TimeSpan _lastEmoteTime;
private static readonly TimeSpan EmoteCooldown = TimeSpan.FromSeconds(3);
private static readonly TimeSpan EmoteCooldown = TimeSpan.FromSeconds(2f);

public EmotesTabControl()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public sealed partial class VerbsTabControl : BaseTabControl
[Dependency] private readonly IGameTiming _gameTiming = default!;

private TimeSpan _lastVerbTime;
private static readonly TimeSpan VerbCooldown = TimeSpan.FromSeconds(0.5f);
private static readonly TimeSpan VerbCooldown = TimeSpan.FromSeconds(2f);

public VerbsTabControl()
{
Expand Down
27 changes: 27 additions & 0 deletions Content.Server/Bible/BibleSystem.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
using Content.Server.Bible.Components;
using Content.Server.Ghost.Roles.Events;
using Content.Server.Popups;
using Content.Server.Saw;
using Content.Shared._Sunrise.Mood;
using Content.Shared.ActionBlocker;
using Content.Shared.Actions;
using Content.Shared.Bible;
using Content.Shared.Damage;
using Content.Shared.Ghost.Roles.Components;
using Content.Shared.IdentityManagement;
using Content.Shared.IdentityManagement.Components;
using Content.Shared.Interaction;
using Content.Shared.Inventory;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Systems;
using Content.Shared.Popups;
using Content.Shared.Prayer;
using Content.Shared.Stunnable;
using Content.Shared.Timing;
using Content.Shared.Vampire.Components;
Expand All @@ -21,13 +24,16 @@
using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Timing;

namespace Content.Server.Bible
{
public sealed class BibleSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ActionBlockerSystem _blocker = default!;
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
Expand All @@ -39,6 +45,8 @@ public sealed class BibleSystem : EntitySystem
[Dependency] private readonly UseDelaySystem _delay = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly SharedStunSystem _stun = default!;
[Dependency] private readonly EntityLookupSystem _lookUp = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;

public override void Initialize()
{
Expand Down Expand Up @@ -150,6 +158,25 @@ private void OnAfterInteract(EntityUid uid, BibleComponent component, AfterInter
return;
}

//Sunrise-start

if (TryPrototype((EntityUid) args.Target, out var prototype)
&& prototype.ID == "MobPig"
&& !HasComp<SawComponent>(args.Target))
{
if (_lookUp.GetEntitiesInRange<IdentityComponent>(Transform(uid).Coordinates, 5).Count >= 5
&& _lookUp.GetEntitiesInRange<PrayableComponent>(Transform(uid).Coordinates, 5).Count >= 2)
{
_entityManager.AddComponents((EntityUid) args.Target, _prototypeManager.Index("MobSaw").Components, false);
_metaData.SetEntityName((EntityUid)args.Target, "свиноматерь");
_popupSystem.PopupEntity(Loc.GetString("bible-saw-transformation"), (EntityUid) args.Target);
_audio.PlayPvs(component.HealSoundPath, (EntityUid) args.Target);
}
return;
}

//Sunrise-end

// This only has a chance to fail if the target is not wearing anything on their head and is not a familiar..
if (!_invSystem.TryGetSlotEntity(args.Target.Value, "head", out var _) && !HasComp<FamiliarComponent>(args.Target.Value))
{
Expand Down
10 changes: 10 additions & 0 deletions Content.Server/Body/Components/StomachComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ public sealed partial class StomachComponent : Component
[DataField]
public EntityWhitelist? SpecialDigestible = null;

//Sunrise-start

/// <summary>
/// If true, whitelist from the top will only be used as an addition to the already digestible by default food
/// </summary>
[DataField]
public bool IsDigestibleAddition = false;

//Sunrise-end

/// <summary>
/// Used to track how long each reagent has been in the stomach
/// </summary>
Expand Down
12 changes: 12 additions & 0 deletions Content.Server/Chat/Systems/ChatSystem.Emote.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Collections.Frozen;
using Content.Shared.Chat;
using Content.Shared.Chat.Prototypes;
using Content.Shared.Emoting;
using Content.Shared.Speech;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
Expand Down Expand Up @@ -88,6 +90,16 @@ public void TryEmoteWithChat(
if (!forceEmote && !AllowedToUseEmote(source, emote))
return;

// Sunrise-Start
if (emote.Animation)
{
var ev = new AnimationEmoteAttemptEvent(source, emote);
RaiseLocalEvent(source, ev, true);
if (ev.Cancelled)
return;
}
// Sunrise-End

// check if proto has valid message for chat
if (emote.ChatMessages.Count != 0)
{
Expand Down
14 changes: 14 additions & 0 deletions Content.Server/FaceCast/FaceCastComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

using Content.Shared.FixedPoint;

namespace Content.Server.FaceCast;

[RegisterComponent]
public sealed partial class FaceCastComponent : Component
{
public TimeSpan? StartCastingTime = null;

public EntityUid? Equiper = null;

public Double TimeToCast = 5;
}
69 changes: 69 additions & 0 deletions Content.Server/FaceCast/FaceCastSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using Content.Shared.Inventory.Events;
using Robust.Shared.Timing;
using Content.Shared.IdentityManagement.Components;
using Content.Shared.Clothing.Components;
using Content.Shared.Inventory;
using Content.Shared.Nutrition.AnimalHusbandry;

namespace Content.Server.FaceCast;

public sealed class FaceCastSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly InventorySystem _inventory = default!;
public override void Initialize()
{
SubscribeLocalEvent<FaceCastComponent, GotEquippedEvent>(OnEquip);
SubscribeLocalEvent<FaceCastComponent, GotUnequippedEvent>(OnUnequip);
}

private void OnEquip(EntityUid ent, FaceCastComponent faceCast, ref GotEquippedEvent args)
{
if (!HasComp<IdentityComponent>(args.Equipee))
return;
faceCast.Equiper = args.Equipee;
if (HasComp<InfantComponent>(args.Equipee))
return;
faceCast.StartCastingTime = _timing.CurTime;
}

private void OnUnequip(EntityUid ent, FaceCastComponent faceCast, ref GotUnequippedEvent args)
{
faceCast.StartCastingTime = null;
faceCast.Equiper = null;
}

public override void Update(float frameTime)
{
base.Update(frameTime);

var query = EntityQueryEnumerator<FaceCastComponent>();
while (query.MoveNext(out var uid, out var faceCast))
{
if (!TryComp<ClothingComponent>(uid, out var cloth))
continue;

if (faceCast.Equiper == null)
continue;

if (!HasComp<InfantComponent>(faceCast.Equiper) && faceCast.StartCastingTime == null)
{
if (Name(uid) != Loc.GetEntityData("ClothingMaskFaceCast").Name)
_metaData.SetEntityName((EntityUid) faceCast.Equiper, Name(uid));
faceCast.StartCastingTime = _timing.CurTime;
continue;
}

if (faceCast.StartCastingTime == null)
continue;

if ((_timing.CurTime - faceCast.StartCastingTime) >= TimeSpan.FromSeconds(faceCast.TimeToCast))
{
_metaData.SetEntityName(uid, Name((EntityUid)faceCast.Equiper));
faceCast.StartCastingTime = _timing.CurTime;
}

}
}
}
20 changes: 18 additions & 2 deletions Content.Server/Nutrition/EntitySystems/AnimalHusbandrySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ public bool TryReproduceNearby(EntityUid uid, ReproductiveComponent? component =
if (partners.Count >= component.Capacity)
return false;

if (!component.IsPartnerNeed) //Sunrise
return TryReproduce(uid, uid, component); //Sunrise

foreach (var comp in partners)
{
var partner = comp.Owner;
Expand All @@ -98,13 +101,13 @@ public bool TryReproduce(EntityUid uid, EntityUid partner, ReproductiveComponent
if (!Resolve(uid, ref component))
return false;

if (uid == partner)
if (uid == partner && component.IsPartnerNeed) //Sunrise: component.IsPartnerNeed
return false;

if (!CanReproduce(uid, component))
return false;

if (!IsValidPartner(uid, partner, component))
if (!IsValidPartner(uid, partner, component) && component.IsPartnerNeed) //Sunrise: component.IsPartnerNeed
return false;

// if the partner is valid, yet it fails the random check
Expand Down Expand Up @@ -181,6 +184,8 @@ public void Birth(EntityUid uid, ReproductiveComponent? component = null)
if (!Resolve(uid, ref component))
return;

BirthEvent birthEvent = new BirthEvent(); //Sunrise

// this is kinda wack but it's the only sound associated with most animals
if (TryComp<InteractionPopupComponent>(uid, out var interactionPopup))
_audio.PlayPvs(interactionPopup.InteractSuccessSound, uid);
Expand All @@ -190,6 +195,7 @@ public void Birth(EntityUid uid, ReproductiveComponent? component = null)
foreach (var spawn in spawns)
{
var offspring = Spawn(spawn, xform.Coordinates.Offset(_random.NextVector2(0.3f)));
birthEvent.Spawns.Add(offspring); //Sunrise
_transform.AttachToGridOrMap(offspring);
if (component.MakeOffspringInfant)
{
Expand All @@ -205,6 +211,8 @@ public void Birth(EntityUid uid, ReproductiveComponent? component = null)

component.Gestating = false;
component.GestationEndTime = null;

RaiseLocalEvent(uid, birthEvent); //Sunrise
}

public override void Update(float frameTime)
Expand Down Expand Up @@ -249,3 +257,11 @@ public override void Update(float frameTime)
}
}
}

//Sunrise-start

public sealed class BirthEvent : EntityEventArgs
{
public List<EntityUid> Spawns = new List<EntityUid>();
}
//Sunrise-end
Loading

0 comments on commit 0fe5013

Please sign in to comment.