Cult item stuff & robe fix (#35)

* - tweak: New cult item behavior

* - fix: Fix cult robe modifier

* - fix: Fix runic wall cgraph
This commit is contained in:
Aviu00
2024-02-08 18:44:02 +09:00
committed by GitHub
parent 337034d734
commit 74941f06bb
10 changed files with 60 additions and 6 deletions

View File

@@ -3,11 +3,13 @@ using Content.Server.Administration.Logs;
using Content.Server.Construction.Components;
using Content.Server.Temperature.Components;
using Content.Server.Temperature.Systems;
using Content.Shared._White.Cult.Components;
using Content.Shared.Construction;
using Content.Shared.Construction.Components;
using Content.Shared.Construction.EntitySystems;
using Content.Shared.Construction.Steps;
using Content.Shared.DoAfter;
using Content.Shared.Ghost;
using Content.Shared.Interaction;
using Content.Shared.Prying.Systems;
using Content.Shared.Radio.EntitySystems;
@@ -206,6 +208,10 @@ namespace Content.Server.Construction
// Let HandleInteraction actually handle the event for this step.
// We can only perform the rest of our logic if it returns true.
var handle = HandleInteraction(uid, ev, step, validation, out user, construction);
if (step.CultistOnly && !(HasComp<CultistComponent>(user) || HasComp<GhostComponent>(user))) // WD
return HandleResult.False;
if (handle is not HandleResult.True)
return handle;

View File

@@ -10,6 +10,9 @@ namespace Content.Shared.Construction.Steps
[DataField("doAfter")] public float DoAfter { get; private set; }
[DataField]
public bool CultistOnly { get; private set; } // WD
public IReadOnlyList<IGraphAction> Completed => _completed;
public abstract void DoExamine(ExaminedEvent examinedEvent);

View File

@@ -4,4 +4,4 @@ namespace Content.Shared.Weapons.Melee.Events;
/// Raised directed on a weapon when attempt a melee attack.
/// </summary>
[ByRefEvent]
public record struct AttemptMeleeEvent(bool Cancelled, string? Message);
public record struct AttemptMeleeEvent(bool Cancelled, string? Message, EntityUid? User = null); // WD EDIT

View File

@@ -400,7 +400,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
Dirty(weaponUid, weapon);
// Do this AFTER attack so it doesn't spam every tick
var ev = new AttemptMeleeEvent();
var ev = new AttemptMeleeEvent {User = user}; // WD EDIT
RaiseLocalEvent(weaponUid, ref ev);
if (ev.Cancelled)

View File

@@ -3,4 +3,6 @@ namespace Content.Shared._White.Cult.Components;
[RegisterComponent]
public sealed partial class CultItemComponent : Component
{
[DataField]
public bool CanPickUp = true;
}

View File

@@ -2,6 +2,8 @@ using Content.Shared.Ghost;
using Content.Shared.Item;
using Content.Shared.Popups;
using Content.Shared._White.Cult.Components;
using Content.Shared.Inventory.Events;
using Content.Shared.Weapons.Melee.Events;
namespace Content.Shared._White.Cult.Systems;
@@ -15,15 +17,40 @@ public sealed class CultItemSystem : EntitySystem
base.Initialize();
SubscribeLocalEvent<CultItemComponent, GettingPickedUpAttemptEvent>(OnHandPickUp);
SubscribeLocalEvent<CultItemComponent, BeingEquippedAttemptEvent>(OnEquipAttempt);
SubscribeLocalEvent<CultItemComponent, AttemptMeleeEvent>(OnMeleeAttempt);
}
private void OnEquipAttempt(EntityUid uid, CultItemComponent component, BeingEquippedAttemptEvent args)
{
if (CanUse(args.Equipee))
return;
args.Cancel();
_popupSystem.PopupClient(Loc.GetString("cult-item-component-equip-fail"), uid, args.Equipee);
}
private void OnMeleeAttempt(Entity<CultItemComponent> ent, ref AttemptMeleeEvent args)
{
if (CanUse(args.User))
return;
args.Cancelled = true;
args.Message = Loc.GetString("cult-item-component-attack-fail");
}
private void OnHandPickUp(EntityUid uid, CultItemComponent component, GettingPickedUpAttemptEvent args)
{
if (HasComp<Components.CultistComponent>(args.User) || HasComp<GhostComponent>(args.User))
if (component.CanPickUp || CanUse(args.User))
return;
args.Cancel();
_transform.AttachToGridOrMap(uid);
_popupSystem.PopupClient(Loc.GetString("cult-item-component-not-cultist", ("name", Name(uid))), uid, args.User);
_popupSystem.PopupClient(Loc.GetString("cult-item-component-pickup-fail", ("name", Name(uid))), uid, args.User);
}
private bool CanUse(EntityUid? uid)
{
return HasComp<CultistComponent>(uid) || HasComp<GhostComponent>(uid);
}
}

View File

@@ -1 +1,3 @@
cult-item-component-not-cultist = Вы не можете подобрать {$name}
cult-item-component-pickup-fail = Вы не можете подобрать {$name}
cult-item-component-attack-fail = Оружие не позволяет вам атаковать
cult-item-component-equip-fail = Вы не можете это надеть

View File

@@ -66,7 +66,7 @@
Piercing: 0.7
Shock: 2
Heat: 3
# Like metallic, but without flat reduction so it can be damaged with fists.
- type: damageModifierSet
id: FlimsyMetallic
@@ -338,3 +338,14 @@
Blunt: 1.15
Slash: 1.15
Piercing: 1.15
- type: damageModifierSet
id: CultRobe
coefficients:
Blunt: 1.45
Slash: 1.45
Piercing: 1.45
Shock: 1.45
Cold: 1.45
Heat: 1.45
Laser: 1.45

View File

@@ -25,6 +25,7 @@
- !type:EntityAnchored
steps:
- tool: Dagger
cultistOnly: true
- to: wall
completed:
- !type:SnapToGrid
@@ -45,6 +46,7 @@
amount: 1
steps:
- tool: Dagger
cultistOnly: true
- type: constructionGraph
id: AirlockGlassCult

View File

@@ -33,6 +33,7 @@
- Energy
- type: ReturnItemOnThrow
- type: CultItem
canPickUp: false
- type: ChangeThrowForce
throwForce: 6.5