search of life spell (#1273)

This commit is contained in:
Ed
2025-05-16 00:58:48 +03:00
committed by GitHub
parent e0a4f5592f
commit 132d1db37b
9 changed files with 211 additions and 35 deletions

View File

@@ -0,0 +1,52 @@
using Content.Shared.Whitelist;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
namespace Content.Shared._CP14.MagicSpell.Spells;
public sealed partial class CP14SpellPointer : CP14SpellEffect
{
[DataField(required: true)]
public EntProtoId PointerEntity;
[DataField(required: true)]
public EntityWhitelist? Whitelist;
[DataField]
public EntityWhitelist? Blacklist = null;
[DataField(required: true)]
public float SearchRange = 30f;
public override void Effect(EntityManager entManager, CP14SpellEffectBaseArgs args)
{
if (args.User is null)
return;
var lookup = entManager.System<EntityLookupSystem>();
var whitelistSys = entManager.System<EntityWhitelistSystem>();
var transform = entManager.System<SharedTransformSystem>();
var originPosition = transform.GetWorldPosition(args.User.Value);
var originEntPosition = transform.GetMoverCoordinates(args.User.Value);
var entitiesInRange = lookup.GetEntitiesInRange<TransformComponent>(originEntPosition, SearchRange);
foreach (var ent in entitiesInRange)
{
if (ent.Owner == args.User.Value)
continue;
if (!whitelistSys.CheckBoth(ent, Blacklist, Whitelist))
continue;
var targetPosition = transform.GetWorldPosition(ent.Comp);
//Calculate the rotation
Angle angle = new(targetPosition - originPosition);
var pointer = entManager.Spawn(PointerEntity, new MapCoordinates(originPosition, transform.GetMapId(originEntPosition)));
transform.SetWorldRotation(pointer, angle + Angle.FromDegrees(90));
}
}
}

View File

@@ -0,0 +1,47 @@
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
namespace Content.Shared._CP14.MagicSpell.Spells;
public sealed partial class CP14SpellPointerToAlive : CP14SpellEffect
{
[DataField(required: true)]
public EntProtoId PointerEntity;
[DataField(required: true)]
public float SearchRange = 30f;
public override void Effect(EntityManager entManager, CP14SpellEffectBaseArgs args)
{
if (args.User is null)
return;
var lookup = entManager.System<EntityLookupSystem>();
var mobStateSys = entManager.System<MobStateSystem>();
var transform = entManager.System<SharedTransformSystem>();
var originPosition = transform.GetWorldPosition(args.User.Value);
var originEntPosition = transform.GetMoverCoordinates(args.User.Value);
var entitiesInRange = lookup.GetEntitiesInRange<MobStateComponent>(originEntPosition, SearchRange);
foreach (var ent in entitiesInRange)
{
if (ent.Owner == args.User.Value)
continue;
if (mobStateSys.IsDead(ent))
continue;
var targetPosition = transform.GetWorldPosition(ent);
//Calculate the rotation
Angle angle = new(targetPosition - originPosition);
var pointer = entManager.Spawn(PointerEntity, new MapCoordinates(originPosition, transform.GetMapId(originEntPosition)));
transform.SetWorldRotation(pointer, angle + Angle.FromDegrees(90));
}
}
}

View File

@@ -3,4 +3,4 @@ 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.
cp14-bloodmoon-curse-removed = The curse of the blood moon is dispelled.
cp14-bloodmoon-curse-examined = The aura of the blood moon hovers around this creature. Be careful, for his mind is unstable.
cp14-bloodmoon-curse-examined = [color=red]The aura of the blood moon hovers around this creature. Be careful, for his mind is unstable.[/color]

View File

@@ -0,0 +1,90 @@
- type: entity
id: CP14ActionSpellSearchOfLife
name: Search of life
description: Detects all living things in a large radius around you.
components:
- type: Sprite
sprite: _CP14/Actions/Spells/light.rsi
state: search_of_life
- type: CP14MagicEffectManaCost
manaCost: 30
- type: CP14MagicEffect
magicType: Light
effects:
- !type:CP14SpellSpawnEntityOnTarget
spawns:
- CP14ImpactEffectSearchOfLife
- !type:CP14SpellPointerToAlive
pointerEntity: CP14SearchOfLifePointer
searchRange: 30
- type: CP14MagicEffectVerbalAspect
startSpeech: "Ego vultus..."
endSpeech: "parumper vita"
- type: CP14MagicEffectSomaticAspect
- type: CP14MagicEffectCastingVisual
proto: CP14RuneSearchOfLife
- type: InstantAction
itemIconStyle: BigAction
sound: !type:SoundPathSpecifier
path: /Audio/Magic/rumble.ogg
icon:
sprite: _CP14/Actions/Spells/light.rsi
state: search_of_life
event: !type:CP14DelayedInstantActionEvent
cooldown: 30
castDelay: 1.5
- type: entity
id: CP14ImpactEffectSearchOfLife
parent: CP14BaseMagicImpact
categories: [ HideSpawnMenu ]
save: false
components:
- type: Sprite
layers:
- state: particles_up
color: "#efedff"
shader: unshaded
- state: circle_increase
color: "#79b330"
shader: unshaded
- type: entity
id: CP14RuneSearchOfLife
parent: CP14BaseMagicRune
categories: [ HideSpawnMenu ]
save: false
components:
- type: PointLight
color: "#328643"
- type: Sprite
layers:
- state: sun
color: "#efedff"
shader: unshaded
- state: double_outer
color: "#79b330"
shader: unshaded
- type: entity
id: CP14SearchOfLifePointer
name: pointer
categories: [ HideSpawnMenu ]
components:
- type: Sprite
sprite: /Textures/_CP14/Effects/Magic/pointer.rsi
offset: 0, -1
layers:
- state: pointer
shader: unshaded
drawdepth: LowFloors
- type: PointLight
netSync: false
radius: 3
color: "#ffffff"
energy: 0.2
- type: TimedDespawn
lifetime: 8
- type: Tag
tags:
- HideContextMenu

View File

@@ -25,46 +25,16 @@
prerequisite: IllusionT1
- type: cp14Skill
id: CP14ActionSpellSignalLightRed
skillUiPosition: 2, 6
learnCost: 0.5
tree: Illusion
icon:
sprite: _CP14/Actions/Spells/light.rsi
state: signal_light_red
effects:
- !type:AddAction
action: CP14ActionSpellSignalLightRed
restrictions:
- !type:NeedPrerequisite
prerequisite: IllusionT1
- type: cp14Skill
id: CP14ActionSpellSignalLightYellow
skillUiPosition: 0, 6
learnCost: 0.5
tree: Illusion
icon:
sprite: _CP14/Actions/Spells/light.rsi
state: signal_light_yellow
effects:
- !type:AddAction
action: CP14ActionSpellSignalLightYellow
restrictions:
- !type:NeedPrerequisite
prerequisite: IllusionT1
- type: cp14Skill
id: CP14ActionSpellSignalLightBlue
id: CP14ActionSpellSearchOfLife
skillUiPosition: 2, 4
learnCost: 0.5
learnCost: 1
tree: Illusion
icon:
sprite: _CP14/Actions/Spells/light.rsi
state: signal_light_blue
state: search_of_life
effects:
- !type:AddAction
action: CP14ActionSpellSignalLightBlue
action: CP14ActionSpellSearchOfLife
restrictions:
- !type:NeedPrerequisite
prerequisite: IllusionT1

View File

@@ -13,6 +13,9 @@
{
"name": "signal_light_blue"
},
{
"name": "search_of_life"
},
{
"name": "signal_light_red"
},

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

View File

@@ -0,0 +1,14 @@
{
"version": 1,
"size": {
"x": 19,
"y": 48
},
"license": "CC-BY-SA-4.0",
"copyright": "Created by TheShuEd",
"states": [
{
"name": "pointer"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B