Skip to content

Commit

Permalink
Merge pull request #11 from FunTust/Cult!Cult!Cult!
Browse files Browse the repository at this point in the history
Cult range weapon
  • Loading branch information
SkaldetSkaeg authored Aug 10, 2024
2 parents 3bca2fc + 018e72f commit 730f38f
Show file tree
Hide file tree
Showing 31 changed files with 477 additions and 3 deletions.
69 changes: 69 additions & 0 deletions Content.Client/SS220/CultYogg/GunByHasAmmoVisualizerSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using System.Linq;
using Content.Client.Atmos.Components;
using Content.Client.Clothing;
using Content.Client.Items.Systems;
using Content.Shared.Atmos;
using Content.Shared.Clothing;
using Content.Shared.Hands;
using Content.Shared.Item;
using Content.Shared.Weapons.Ranged.Systems;
using Robust.Client.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Utility;

namespace Content.Client.SS220.CultYogg;

/// <summary>
/// This handles the display of fire effects on flammable entities.
/// </summary>
public sealed class GunByHasAmmoVisualizerSystem : VisualizerSystem<GunByHasAmmoVisualsComponent>
{
[Dependency] private readonly SharedItemSystem _itemSys = default!;
public override void Initialize()
{
base.Initialize();


SubscribeLocalEvent<GunByHasAmmoVisualsComponent, GetInhandVisualsEvent>(OnGetHeldVisuals, after: new[] { typeof(ItemSystem) });
}

protected override void OnAppearanceChange(EntityUid uid, GunByHasAmmoVisualsComponent component, ref AppearanceChangeEvent args)
{
if (!AppearanceSystem.TryGetData<bool>(uid, AmmoVisuals.HasAmmo, out var enabled, args.Component))
return;

// Update the item's sprite
if (args.Sprite != null && component.SpriteLayer != null && args.Sprite.LayerMapTryGet(component.SpriteLayer, out var layer))
{
args.Sprite.LayerSetVisible(layer, enabled);
}

// update clothing & in-hand visuals.
_itemSys.VisualsChanged(uid);
}

private void OnGetHeldVisuals(EntityUid uid, GunByHasAmmoVisualsComponent component, GetInhandVisualsEvent args)
{
if (!TryComp(uid, out AppearanceComponent? appearance)
|| !AppearanceSystem.TryGetData<bool>(uid, AmmoVisuals.HasAmmo, out var enabled, appearance)
|| !enabled)
return;

if (!component.InhandVisuals.TryGetValue(args.Location, out var layers))
return;

var i = 0;
var defaultKey = $"inhand-{args.Location.ToString().ToLowerInvariant()}-toggle";
foreach (var layer in layers)
{
var key = layer.MapKeys?.FirstOrDefault();
if (key == null)
{
key = i == 0 ? defaultKey : $"{defaultKey}-{i}";
i++;
}

args.Layers.Add((key, layer));
}
}
}
24 changes: 24 additions & 0 deletions Content.Client/SS220/CultYogg/GunByHasAmmoVisualsComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Content.Shared.Hands.Components;

namespace Content.Client.SS220.CultYogg;

/// <summary>
/// Sets which sprite RSI is used for displaying the fire visuals and what state to use based on the fire stacks
/// accumulated.
/// </summary>
[RegisterComponent]
public sealed partial class GunByHasAmmoVisualsComponent : Component
{
/// <summary>
/// Sprite layer that will have its visibility toggled when this item is toggled.
/// </summary>
[DataField("spriteLayer")]
public string? SpriteLayer = "light";

/// <summary>
/// Layers to add to the sprite of the player that is holding this entity (while the component is toggled on).
/// </summary>
[DataField("inhandVisuals")]
public Dictionary<HandLocation, List<PrototypeLayerData>> InhandVisuals = new();

}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public sealed partial class CultYoggRuleComponent : Component
[DataField]
public int amountOfSacrifices = 0;

public int TotalTraitors => CultistMinds.Count;
public int TotalTraitors => InitialCultistMinds.Count;
public enum SelectionState
{
WaitingForSpawn = 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public bool MakeCultist(EntityUid uid, CultYoggRuleComponent component, bool ini
_antagSelection.SendBriefing(uid, Loc.GetString("cult-yogg-role-greeting"), null, component.GreetSoundNotification);

if (initial)
component.CultistMinds.Add(mindId);
component.InitialCultistMinds.Add(mindId);

// Change the faction
_npcFaction.RemoveFaction(uid, component.NanoTrasenFaction, false);
Expand Down
115 changes: 115 additions & 0 deletions Resources/Prototypes/SS220/CultYogg/horn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
- type: entity
name: horn cult yogg
parent: BaseItem
id: HornCultYogg
components:
- type: Irremovable
inHandItem: true
- type: Gun
soundGunshot: /Audio/Weapons/Guns/Gunshots/harpoon.ogg
soundEmpty: null
fireRate: 20
projectileSpeed: 5
- type: BasicEntityAmmoProvider
proto: HornGunBullet
capacity: 1
- type: Sprite
sprite: SS220/Objects/Weapons/Guns/cult_yogg_horn.rsi
layers:
- state: icon
- type: Appearance
- type: RechargeBasicEntityAmmo
rechargeCooldown: 10
- type: Wieldable
- type: IncreaseDamageOnWield
damage:
types:
Brute: 30
Stamina: 80
- type: GenericVisualizer
visuals:
enum.AmmoVisuals.HasAmmo:
sprite:
False: {state: "icon-empty"}
True: {state: "icon"}
- type: GunByHasAmmoVisuals
spriteLayer: null
inhandVisuals:
left:
- state: fullammo-inhand-left
shader: unshaded
right:
- state: fullammo-inhand-right
shader: unshaded

- type: entity
name: tesla gun lightning
id: HornGunBullet
parent: BaseBullet
noSpawn: true
components:
- type: TimedDespawn
lifetime: 2
- type: Sprite
sprite: Structures/Power/Generation/Tesla/energy_miniball.rsi
layers:
- state: tesla_projectile
shader: unshaded
- type: EmbeddableProjectile
- type: Projectile
deleteOnCollide: false
soundHit:
path: /Audio/Weapons/Guns/Hits/bullet_hit.ogg
- type: SpawnOnDespawn
prototype: HornExplotionPart

- type: entity
parent: CollideRune
id: HornExplotionPart
name: HornExplotionPart
noSpawn: true
components:
- type: Explosive
explosionType: Default
maxIntensity: 3.4
intensitySlope: 3
totalIntensity: 20
canCreateVacuum: false
- type: TriggerOnSpawn
- type: FlashOnTrigger
range: 7
- type: Sprite
sprite: Structures/Magic/Cult/trap.rsi
layers:
- state: trap
color: '#FF770055'
- type: TwoStageTrigger
triggerDelay: 0.5
components:
- type: AmbientSound
enabled: true
volume: -5
range: 14
sound:
path: /Audio/Effects/Grenades/Supermatter/whitehole_loop.ogg
- type: GravityWell
maxRange: 7
baseRadialAcceleration: -10
baseTangentialAcceleration: -5
gravPulsePeriod: 0.1
- type: SingularityDistortion
intensity: -10
falloffPower: 1.5
- type: PointLight
enabled: true
color: "#ffffff"
energy: 8
radius: 6
softness: 1
offset: "0, 0"
- type: ExplodeOnTrigger
- type: SoundOnTrigger
sound:
path: /Audio/Effects/Grenades/Supermatter/supermatter_end.ogg
params:
volume: 15
105 changes: 105 additions & 0 deletions Resources/Prototypes/SS220/CultYogg/spikegun.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
- type: entity
name: spikegun cult yogg
parent: BaseItem
id: SpikegunCultYogg
components:
- type: AmmoCounter
- type: Gun
soundGunshot: /Audio/Weapons/Guns/Gunshots/harpoon.ogg
soundEmpty: null
fireRate: 20
rojectileSpeed: 0.5
selectedMode: SemiAuto
availableModes:
- SemiAuto
- type: BasicEntityAmmoProvider
proto: Spike
capacity: 15
- type: Sprite
sprite: SS220/Objects/Weapons/Guns/cult_yogg_spikegun.rsi
layers:
- state: icon_noammo
map: ["sprite"]
- type: Item
size: Normal
- type: Appearance
- type: RechargeBasicEntityAmmo
rechargeCooldown: 1.5
- type: GenericVisualizer
visuals:
enum.AmmoVisuals.HasAmmo:
sprite:
False: {state: "icon_noammo"}
True: {state: "icon_fullammo"}
- type: GunByHasAmmoVisuals
spriteLayer: null
inhandVisuals:
left:
- state: fullammo-inhand-left
shader: unshaded
right:
- state: fullammo-inhand-right
shader: unshaded
- type: Irremovable
inHandItem: true

- type: entity
id: BaseSpike
name: base spike
description: description
abstract: true
components:
- type: Reflective
- type: FlyBySound
- type: Clickable
- type: Sprite
noRot: false
sprite: SS220/Objects/Weapons/Guns/cult_yogg_spikegun.rsi
layers:
- state: spike_projectile
shader: unshaded
- type: Physics
bodyType: Dynamic
linearDamping: 0.3
angularDamping: 0
- type: Fixtures
fixtures:
projectile:
shape:
!type:PhysShapeAabb
bounds: "-0.1,-0.1,0.1,0.1"
hard: false
mask:
- Impassable
- BulletImpassable
fly-by: &flybyfixture
shape: !type:PhysShapeCircle
radius: 1.5
layer:
- Impassable
- MidImpassable
- HighImpassable
- LowImpassable
hard: False
- type: Projectile
impactEffect: BulletImpactEffect
damage:
types:
Piercing: 10
soundHit:
path: /Audio/Weapons/Guns/Hits/bullet_hit.ogg

- type: entity
id: Spike
name: spike
parent: BaseSpike
noSpawn: true
description: description
components:
- type: Reflective
reflective:
- NonEnergy
- type: TimedDespawn
lifetime: 0.4
- type: GatheringProjectile

Loading

0 comments on commit 730f38f

Please sign in to comment.