Skip to content

Commit

Permalink
Add Pious trait, blessing water/blood requires faith (#1486)
Browse files Browse the repository at this point in the history
* faith injector, holywater reaction needs BibleUser

* Curly brace on newline, not same line

* Remove suffix from faith implanter

* BibleUserImplantComponent: newline at EOF, comment

* Add Pious trait, remove vendor/loadout faith impl.

* Cleanup, remove PacifiedUser variable

* Add bible to Contractor tools

* tools.yml: fix faith implanter location

* Bible: T2 contractor gear

* tools.yml: add name, description, bible preview

* Bible: name, description, preview, 5k spesos
  • Loading branch information
whatston3 authored Jun 13, 2024
1 parent 2ddc85d commit 3901104
Show file tree
Hide file tree
Showing 12 changed files with 155 additions and 6 deletions.
38 changes: 35 additions & 3 deletions Content.Server/Bible/BibleSystem.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
using Content.Server.Bible.Components;
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Ghost.Roles.Components;
using Content.Server.Ghost.Roles.Events;
using Content.Server.Popups;
using Content.Shared.ActionBlocker;
using Content.Shared.Actions;
using Content.Shared.Bible;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reaction;
using Content.Shared.Damage;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
Expand Down Expand Up @@ -38,7 +41,8 @@ public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<BibleComponent, AfterInteractEvent>(OnAfterInteract);
SubscribeLocalEvent<BibleComponent, MixingAttemptEvent>(OnMixingAttempt); // Frontier: restrict solution blessing to bible users
SubscribeLocalEvent<BibleComponent, AfterInteractEvent>(OnAfterInteract, before: [typeof(ReactionMixerSystem)]); // Frontier: add before parameter
SubscribeLocalEvent<SummonableComponent, GetVerbsEvent<AlternativeVerb>>(AddSummonVerb);
SubscribeLocalEvent<SummonableComponent, GetItemActionsEvent>(GetSummonAction);
SubscribeLocalEvent<SummonableComponent, SummonActionEvent>(OnSummon);
Expand Down Expand Up @@ -91,6 +95,19 @@ public override void Update(float frameTime)
}
}

// Frontier: only bible users can bless water/blood
private void OnMixingAttempt(EntityUid uid, BibleComponent component, ref MixingAttemptEvent args)
{
// Block water/blood blessing attempts by non-bible users
if (component.BlockMix)
{
_popupSystem.PopupEntity(Loc.GetString("bible-bless-solution-failed"), component.LastInteractingUser, component.LastInteractingUser, PopupType.Small);
args.Cancelled = true;
return;
}
}
// End Frontier

private void OnAfterInteract(EntityUid uid, BibleComponent component, AfterInteractEvent args)
{
if (!args.CanReach)
Expand All @@ -99,12 +116,24 @@ private void OnAfterInteract(EntityUid uid, BibleComponent component, AfterInter
if (!TryComp(uid, out UseDelayComponent? useDelay) || _delay.IsDelayed((uid, useDelay)))
return;

if (args.Target == null || args.Target == args.User || !_mobStateSystem.IsAlive(args.Target.Value))
// Frontier: only bible users can bless water/blood
if (args.Target == null)
{
return;
}

if (!HasComp<BibleUserComponent>(args.User))
// In case the user is trying to mix something, store who's using it and whether or not they're a bible user.
component.LastInteractingUser = args.User;
var hasBibleUserComponent = HasComp<BibleUserComponent>(args.User);
component.BlockMix = !hasBibleUserComponent;

if (args.Target == args.User || !_mobStateSystem.IsAlive(args.Target.Value))
{
return;
}
// End Frontier

if (!hasBibleUserComponent) // Frontier: cache bible component lookup
{
_popupSystem.PopupEntity(Loc.GetString("bible-sizzle"), args.User, args.User);

Expand Down Expand Up @@ -226,7 +255,10 @@ private void AttemptSummon(Entity<SummonableComponent> ent, EntityUid user, Tran
if (component.AlreadySummoned || component.SpecialItemPrototype == null)
return;
if (component.RequiresBibleUser && !HasComp<BibleUserComponent>(user))
{
_popupSystem.PopupEntity(Loc.GetString("bible-summon-request-failed"), user, user, PopupType.Small); // Frontier: better summon feedback
return;
}
if (!Resolve(user, ref position))
return;
if (component.Deleted || Deleted(uid))
Expand Down
15 changes: 15 additions & 0 deletions Content.Server/Bible/Components/BibleComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,20 @@ public sealed partial class BibleComponent : Component

[DataField("locPrefix")]
public string LocPrefix = "bible";

// Frontier: prevent non-bible users from blessing water/blood.

/// <summary>
/// Whether or not a mixing attempt from this bible should be blocked.
/// </summary>
[ViewVariables]
public bool BlockMix = false;

/// <summary>
/// The last user that interacted using the bible.
/// </summary>
[ViewVariables]
public EntityUid LastInteractingUser;
//End Frontier
}
}
38 changes: 38 additions & 0 deletions Content.Server/_NF/Implants/BibleUserImplantSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Content.Shared.Implants;
using Content.Shared.Implants.Components;
using Content.Server.Bible.Components;
using Robust.Shared.Containers;

namespace Content.Server.Implants;

public sealed class BibleUserImplantSystem : EntitySystem
{

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

SubscribeLocalEvent<BibleUserImplantComponent, ImplantImplantedEvent>(OnInsert);
// We need to remove the BibleUserComponent from the owner before the implant
// is removed, so we need to execute before the SubdermalImplantSystem.
SubscribeLocalEvent<BibleUserImplantComponent, EntGotRemovedFromContainerMessage>(OnRemove, before: new[] { typeof(SubdermalImplantSystem) });
}

private void OnInsert(EntityUid uid, BibleUserImplantComponent component, ImplantImplantedEvent args)
{
if (!args.Implanted.HasValue)
return;

var bibleUserComp = EnsureComp<BibleUserComponent>(args.Implanted.Value);
Dirty(args.Implanted.Value, bibleUserComp);
}

// Currently permanent, but should support removal if/when a viable solution is found.
private void OnRemove(EntityUid uid, BibleUserImplantComponent component, EntGotRemovedFromContainerMessage args)
{
if (!TryComp<SubdermalImplantComponent>(uid, out var implanted) || implanted.ImplantedEntity == null)
return;

RemComp<BibleUserComponent>(implanted.ImplantedEntity.Value);
}
}
11 changes: 11 additions & 0 deletions Content.Shared/_NF/Implants/BibleUserImplantComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Robust.Shared.GameStates;

namespace Content.Shared.Implants.Components;

/// <summary>
/// Implant to get BibleUser status (to pray, summon familiars, bless with bibles)
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed partial class BibleUserImplantComponent : Component
{
}
3 changes: 3 additions & 0 deletions Resources/Locale/en-US/_NF/chapel/bible.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bible-summon-request-failed = You don't feel worthy enough...
bible-bless-solution-failed = You don't feel worthy enough...
5 changes: 4 additions & 1 deletion Resources/Locale/en-US/_NF/traits/traits.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ trait-stinky-in-range-others = {$target} smells foul!
trait-stinky-in-range-self = Something smells foul!
trait-goblin-accent-name = Goblin Cant
trait-goblin-accent-desc = You speak in secret language many find annoying and not that secretive.
trait-goblin-accent-desc = You speak in secret language many find annoying and not that secretive.
trait-pious-name = Pious
trait-pious-desc = You are in touch with the gods, but your vows keep you from striking in anger.
2 changes: 1 addition & 1 deletion Resources/Prototypes/Recipes/Reactions/single_reagent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
products:
Syrup: 0.1 #12:1 sap to syruop

# Holy - TODO: make it so only the chaplain can use the bible to start these reactions, not anyone with a bible
# Holy

- type: reaction
id: BloodToWine
Expand Down
8 changes: 8 additions & 0 deletions Resources/Prototypes/_NF/Entities/Objects/Misc/implanters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,11 @@
components:
- type: Implanter
implant: DeathAcidifierImplantNF

- type: entity
id: BibleUserImplanter
name: faith implanter
parent: BaseImplantOnlyImplanter
components:
- type: Implanter
implant: BibleUserImplant
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,14 @@
- SubdermalImplant
- HideContextMenu
- DeathAcidifier

- type: entity
parent: BaseSubdermalImplant
id: BibleUserImplant
name: faith implant
description: This implant binds the user to the gods.
noSpawn: true
components:
- type: SubdermalImplant
permanent: true
- type: BibleUserImplant
21 changes: 20 additions & 1 deletion Resources/Prototypes/_NF/Loadouts/Jobs/Contractor/tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,23 @@
- type: startingGear
id: ContractorHypoMini
inhand:
- HypoMini
- HypoMini

- type: loadout
id: ContractorBible
equipment: ContractorBible
name: bible and faith implanter
description: For the budding Chaplain. Perform miracles, proselytize, and grow your flock.
previewEntity: Bible
effects:
- !type:GroupLoadoutEffect
proto: ContractorT2
price: 5000

- type: startingGear
id: ContractorBible
inhand:
- Bible
storage:
back:
- BibleUserImplanter
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@
- ContractorShipyardRCD
- ContractorHandheldCrewMonitor
- ContractorHypoMini
- ContractorBible

- type: loadoutGroup
id: ContractorFun # Left Hand - 1 only
Expand Down
8 changes: 8 additions & 0 deletions Resources/Prototypes/_NF/Traits/disabilities.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- type: trait
id: Pious
name: trait-pious-name
description: trait-pious-desc
traitGear: Bible
components:
- type: BibleUser
- type: Pacified # if this wasn't so debilitating, this trait would be elsewhere

0 comments on commit 3901104

Please sign in to comment.