Spiders Buff and critters change (#13377)
This commit is contained in:
77
Content.Server/Spider/SpiderSystem.cs
Normal file
77
Content.Server/Spider/SpiderSystem.cs
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using Content.Server.Popups;
|
||||||
|
using Content.Shared.Spider;
|
||||||
|
using Content.Shared.Maps;
|
||||||
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
|
namespace Content.Server.Spider;
|
||||||
|
|
||||||
|
public sealed class SpiderSystem : SharedSpiderSystem
|
||||||
|
{
|
||||||
|
[Dependency] private readonly PopupSystem _popup = default!;
|
||||||
|
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
SubscribeLocalEvent<SpiderComponent, SpiderWebActionEvent>(OnSpawnNet);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnSpawnNet(EntityUid uid, SpiderComponent component, SpiderWebActionEvent args)
|
||||||
|
{
|
||||||
|
if (args.Handled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var transform = Transform(uid);
|
||||||
|
|
||||||
|
if (transform.GridUid == null)
|
||||||
|
{
|
||||||
|
_popup.PopupEntity(Loc.GetString("spider-web-action-nogrid"), args.Performer, args.Performer);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var coords = transform.Coordinates;
|
||||||
|
|
||||||
|
// TODO generic way to get certain coordinates
|
||||||
|
|
||||||
|
var result = false;
|
||||||
|
// Spawn web in center
|
||||||
|
if (!IsTileBlockedByWeb(coords))
|
||||||
|
{
|
||||||
|
Spawn(component.WebPrototype, coords);
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Spawn web in other directions
|
||||||
|
for (var i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
var direction = (DirectionFlag) (1 << i);
|
||||||
|
coords = transform.Coordinates.Offset(direction.AsDir().ToVec());
|
||||||
|
|
||||||
|
if (!IsTileBlockedByWeb(coords))
|
||||||
|
{
|
||||||
|
Spawn(component.WebPrototype, coords);
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
_popup.PopupEntity(Loc.GetString("spider-web-action-success"), args.Performer, args.Performer);
|
||||||
|
args.Handled = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_popup.PopupEntity(Loc.GetString("spider-web-action-fail"), args.Performer, args.Performer);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsTileBlockedByWeb(EntityCoordinates coords)
|
||||||
|
{
|
||||||
|
foreach (var entity in coords.GetEntitiesInTile())
|
||||||
|
{
|
||||||
|
if (HasComp<SpiderWebObjectComponent>(entity))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
32
Content.Server/StationEvents/Events/SpiderSpawn.cs
Normal file
32
Content.Server/StationEvents/Events/SpiderSpawn.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using Content.Server.StationEvents.Components;
|
||||||
|
using Content.Shared.Actions;
|
||||||
|
using Robust.Shared.Random;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Content.Server.StationEvents.Events;
|
||||||
|
|
||||||
|
public sealed class SpiderSpawn : StationEventSystem
|
||||||
|
{
|
||||||
|
public override string Prototype => "SpiderSpawn";
|
||||||
|
|
||||||
|
public override void Started()
|
||||||
|
{
|
||||||
|
base.Started();
|
||||||
|
var spawnLocations = EntityManager.EntityQuery<VentCritterSpawnLocationComponent>().ToList();
|
||||||
|
RobustRandom.Shuffle(spawnLocations);
|
||||||
|
|
||||||
|
var mod = Math.Sqrt(GetSeverityModifier());
|
||||||
|
|
||||||
|
var spawnAmount = (int) (RobustRandom.Next(4, 8) * mod);
|
||||||
|
Sawmill.Info($"Spawning {spawnAmount} of spiders");
|
||||||
|
foreach (var location in spawnLocations)
|
||||||
|
{
|
||||||
|
if (spawnAmount-- == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
var coords = EntityManager.GetComponent<TransformComponent>(location.Owner);
|
||||||
|
|
||||||
|
EntityManager.SpawnEntity("MobGiantSpiderAngry", coords.Coordinates);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Content.Server.StationEvents.Components;
|
using Content.Server.StationEvents.Components;
|
||||||
|
using Content.Shared.Actions;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@@ -7,7 +8,7 @@ namespace Content.Server.StationEvents.Events;
|
|||||||
public sealed class VentCritters : StationEventSystem
|
public sealed class VentCritters : StationEventSystem
|
||||||
{
|
{
|
||||||
public static List<string> SpawnedPrototypeChoices = new List<string>()
|
public static List<string> SpawnedPrototypeChoices = new List<string>()
|
||||||
{"MobGiantSpiderAngry", "MobMouse", "MobMouse1", "MobMouse2"};
|
{"MobMouse", "MobMouse1", "MobMouse2"};
|
||||||
|
|
||||||
public override string Prototype => "VentCritters";
|
public override string Prototype => "VentCritters";
|
||||||
|
|
||||||
@@ -18,9 +19,7 @@ public sealed class VentCritters : StationEventSystem
|
|||||||
var spawnLocations = EntityManager.EntityQuery<VentCritterSpawnLocationComponent>().ToList();
|
var spawnLocations = EntityManager.EntityQuery<VentCritterSpawnLocationComponent>().ToList();
|
||||||
RobustRandom.Shuffle(spawnLocations);
|
RobustRandom.Shuffle(spawnLocations);
|
||||||
|
|
||||||
var mod = Math.Sqrt(GetSeverityModifier());
|
var spawnAmount = (int) (RobustRandom.Next(4, 12)); // A small colony of critters.
|
||||||
|
|
||||||
var spawnAmount = (int) (RobustRandom.Next(4, 12) * mod); // A small colony of critters.
|
|
||||||
Sawmill.Info($"Spawning {spawnAmount} of {spawnChoice}");
|
Sawmill.Info($"Spawning {spawnAmount} of {spawnChoice}");
|
||||||
foreach (var location in spawnLocations)
|
foreach (var location in spawnLocations)
|
||||||
{
|
{
|
||||||
|
|||||||
7
Content.Shared/Spider/IgnoreSpiderWebComponent.cs
Normal file
7
Content.Shared/Spider/IgnoreSpiderWebComponent.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Content.Shared.Spider;
|
||||||
|
|
||||||
|
[RegisterComponent]
|
||||||
|
public sealed class IgnoreSpiderWebComponent : Component
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
35
Content.Shared/Spider/SharedSpiderSystem.cs
Normal file
35
Content.Shared/Spider/SharedSpiderSystem.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using Content.Shared.Spider;
|
||||||
|
using Content.Shared.Actions;
|
||||||
|
using Content.Shared.Actions.ActionTypes;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
|
namespace Content.Shared.Spider;
|
||||||
|
|
||||||
|
public abstract class SharedSpiderSystem : EntitySystem
|
||||||
|
{
|
||||||
|
[Dependency] private readonly SharedActionsSystem _action = default!;
|
||||||
|
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||||
|
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||||
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||||
|
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
|
||||||
|
SubscribeLocalEvent<SpiderWebObjectComponent, ComponentStartup>(OnWebStartup);
|
||||||
|
SubscribeLocalEvent<SpiderComponent, ComponentStartup>(OnSpiderStartup);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnSpiderStartup(EntityUid uid, SpiderComponent component, ComponentStartup args)
|
||||||
|
{
|
||||||
|
var netAction = new InstantAction(_proto.Index<InstantActionPrototype>(component.WebActionName));
|
||||||
|
_action.AddAction(uid, netAction, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnWebStartup(EntityUid uid, SpiderWebObjectComponent component, ComponentStartup args)
|
||||||
|
{
|
||||||
|
_appearance.SetData(uid, SpiderWebVisuals.Variant, _robustRandom.Next(1, 3));
|
||||||
|
}
|
||||||
|
}
|
||||||
22
Content.Shared/Spider/SpiderComponent.cs
Normal file
22
Content.Shared/Spider/SpiderComponent.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using Content.Shared.Actions;
|
||||||
|
using Robust.Shared.GameStates;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
||||||
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
|
|
||||||
|
namespace Content.Shared.Spider;
|
||||||
|
|
||||||
|
[RegisterComponent, NetworkedComponent]
|
||||||
|
[Access(typeof(SharedSpiderSystem))]
|
||||||
|
public sealed class SpiderComponent : Component
|
||||||
|
{
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
[DataField("webPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||||
|
public string WebPrototype = "SpiderWeb";
|
||||||
|
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
[DataField("webActionName")]
|
||||||
|
public string WebActionName = "SpiderWebAction";
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class SpiderWebActionEvent : InstantActionEvent { }
|
||||||
9
Content.Shared/Spider/SpiderWebObjectComponent.cs
Normal file
9
Content.Shared/Spider/SpiderWebObjectComponent.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using Robust.Shared.GameStates;
|
||||||
|
|
||||||
|
namespace Content.Shared.Spider;
|
||||||
|
|
||||||
|
[RegisterComponent, NetworkedComponent]
|
||||||
|
[Access(typeof(SharedSpiderSystem))]
|
||||||
|
public sealed class SpiderWebObjectComponent : Component
|
||||||
|
{
|
||||||
|
}
|
||||||
9
Content.Shared/Spider/SpiderWebVisualsComponent.cs
Normal file
9
Content.Shared/Spider/SpiderWebVisualsComponent.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
|
namespace Content.Shared.Spider;
|
||||||
|
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
public enum SpiderWebVisuals
|
||||||
|
{
|
||||||
|
Variant
|
||||||
|
}
|
||||||
5
Resources/Locale/en-US/actions/actions/spider.ftl
Normal file
5
Resources/Locale/en-US/actions/actions/spider.ftl
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
spider-web-action-name = Spider Web
|
||||||
|
spider-web-action-description = Spawns a web that slows your prey down.
|
||||||
|
spider-web-action-nogrid = There is no floor under you!
|
||||||
|
spider-web-action-success = You place webs around you.
|
||||||
|
spider-web-action-fail = You can't place webs here! All cardinal directions already have webs!
|
||||||
7
Resources/Prototypes/Actions/spider.yml
Normal file
7
Resources/Prototypes/Actions/spider.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
- type: instantAction
|
||||||
|
id: SpiderWebAction
|
||||||
|
icon: Interface/Actions/web.png
|
||||||
|
name: spider-web-action-name
|
||||||
|
description: spider-web-action-description
|
||||||
|
serverEvent: !type:SpiderWebActionEvent
|
||||||
|
useDelay: 25
|
||||||
@@ -1316,6 +1316,21 @@
|
|||||||
enabled: false
|
enabled: false
|
||||||
autoPopulate: false
|
autoPopulate: false
|
||||||
name: action-name-disarm
|
name: action-name-disarm
|
||||||
|
- type: MobThresholds
|
||||||
|
thresholds:
|
||||||
|
0: Alive
|
||||||
|
90: Critical
|
||||||
|
150: Dead
|
||||||
|
- type: MeleeWeapon
|
||||||
|
hidden: true
|
||||||
|
angle: 0
|
||||||
|
animation: WeaponArcBite
|
||||||
|
soundHit:
|
||||||
|
path: /Audio/Effects/bite.ogg
|
||||||
|
damage:
|
||||||
|
types:
|
||||||
|
Piercing: 12
|
||||||
|
Poison: 4
|
||||||
- type: ReplacementAccent
|
- type: ReplacementAccent
|
||||||
accent: xeno
|
accent: xeno
|
||||||
- type: InteractionPopup
|
- type: InteractionPopup
|
||||||
@@ -1323,6 +1338,10 @@
|
|||||||
interactSuccessString: petting-success-tarantula
|
interactSuccessString: petting-success-tarantula
|
||||||
interactFailureString: petting-failure-generic
|
interactFailureString: petting-failure-generic
|
||||||
- type: Puller
|
- type: Puller
|
||||||
|
needsHands: false
|
||||||
|
- type: NoSlip
|
||||||
|
- type: Spider
|
||||||
|
- type: IgnoreSpiderWeb
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: tarantula
|
name: tarantula
|
||||||
|
|||||||
75
Resources/Prototypes/Entities/Objects/Misc/spider_web.yml
Normal file
75
Resources/Prototypes/Entities/Objects/Misc/spider_web.yml
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
- type: entity
|
||||||
|
id: SpiderWeb
|
||||||
|
name: spider web
|
||||||
|
description: It's stringy and sticky.
|
||||||
|
placement:
|
||||||
|
mode: SnapgridCenter
|
||||||
|
snap:
|
||||||
|
- Wall
|
||||||
|
components:
|
||||||
|
- type: MeleeSound
|
||||||
|
soundGroups:
|
||||||
|
Brute:
|
||||||
|
path:
|
||||||
|
"/Audio/Weapons/slash.ogg"
|
||||||
|
- type: Sprite
|
||||||
|
sprite: Objects/Misc/spiderweb.rsi
|
||||||
|
layers:
|
||||||
|
- state: spider_web_1
|
||||||
|
map: ["spiderWebLayer"]
|
||||||
|
drawdepth: WallMountedItems
|
||||||
|
netsync: false
|
||||||
|
- type: Appearance
|
||||||
|
- type: GenericVisualizer
|
||||||
|
visuals:
|
||||||
|
enum.SpiderWebVisuals.Variant:
|
||||||
|
spiderWebLayer:
|
||||||
|
1: {state: spider_web_1}
|
||||||
|
2: {state: spider_web_2}
|
||||||
|
- type: Clickable
|
||||||
|
- type: Transform
|
||||||
|
anchored: true
|
||||||
|
- type: Physics
|
||||||
|
- type: Fixtures
|
||||||
|
fixtures:
|
||||||
|
- hard: false
|
||||||
|
density: 7
|
||||||
|
shape:
|
||||||
|
!type:PhysShapeAabb
|
||||||
|
bounds: "-0.5,-0.5,0.5,0.5"
|
||||||
|
layer:
|
||||||
|
- MidImpassable
|
||||||
|
- type: Damageable
|
||||||
|
damageModifierSet: Wood
|
||||||
|
- type: Destructible
|
||||||
|
thresholds:
|
||||||
|
- trigger:
|
||||||
|
!type:DamageTrigger
|
||||||
|
damage: 10
|
||||||
|
behaviors:
|
||||||
|
- !type:DoActsBehavior
|
||||||
|
acts: [ "Destruction" ]
|
||||||
|
- type: Temperature
|
||||||
|
heatDamage:
|
||||||
|
types:
|
||||||
|
Heat: 5
|
||||||
|
coldDamage: {}
|
||||||
|
ColdDamageThreshold: 0
|
||||||
|
- type: Flammable
|
||||||
|
fireSpread: true
|
||||||
|
cold:
|
||||||
|
types: {}
|
||||||
|
damage:
|
||||||
|
types:
|
||||||
|
Heat: 1
|
||||||
|
- type: Reactive
|
||||||
|
groups:
|
||||||
|
Flammable: [Touch]
|
||||||
|
Extinguish: [Touch]
|
||||||
|
- type: SpiderWebObject
|
||||||
|
- type: SlowContacts
|
||||||
|
walkSpeedModifier: 0.5
|
||||||
|
sprintSpeedModifier: 0.5
|
||||||
|
ignoreWhitelist:
|
||||||
|
components:
|
||||||
|
- IgnoreSpiderWeb
|
||||||
@@ -186,6 +186,16 @@
|
|||||||
weight: 5
|
weight: 5
|
||||||
endAfter: 60
|
endAfter: 60
|
||||||
|
|
||||||
|
- type: gameRule
|
||||||
|
id: SpiderSpawn
|
||||||
|
config:
|
||||||
|
!type:StationEventRuleConfiguration
|
||||||
|
id: SpiderSpawn
|
||||||
|
earliestStart: 20
|
||||||
|
minimumPlayers: 15
|
||||||
|
weight: 5
|
||||||
|
endAfter: 60
|
||||||
|
|
||||||
- type: gameRule
|
- type: gameRule
|
||||||
id: ZombieOutbreak
|
id: ZombieOutbreak
|
||||||
config:
|
config:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"y": 32
|
"y": 32
|
||||||
},
|
},
|
||||||
"license": "CC-BY-SA-3.0",
|
"license": "CC-BY-SA-3.0",
|
||||||
"copyright": "Taken from https://github.com/tgstation/tgstation/commit/3d049e69fe71a0be2133005e65ea469135d648c8. Harm and disarm heavily modified.",
|
"copyright": "Taken from https://github.com/tgstation/tgstation/commit/3d049e69fe71a0be2133005e65ea469135d648c8. Harm and disarm heavily modified. Web made by jackfrost (github) for SS14",
|
||||||
"states": [
|
"states": [
|
||||||
{
|
{
|
||||||
"name": "internal0"
|
"name": "internal0"
|
||||||
@@ -54,6 +54,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "malfunction"
|
"name": "malfunction"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "web"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
Resources/Textures/Interface/Actions/web.png
Normal file
BIN
Resources/Textures/Interface/Actions/web.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 719 B |
17
Resources/Textures/Objects/Misc/spiderweb.rsi/meta.json
Normal file
17
Resources/Textures/Objects/Misc/spiderweb.rsi/meta.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"license": "CC-BY-SA-3.0",
|
||||||
|
"copyright": "Taken from https://github.com/tgstation/tgstation/commit/788b2576cd9511ced86e74222b6395fd3ef9affe",
|
||||||
|
"size": {
|
||||||
|
"x": 32,
|
||||||
|
"y": 32
|
||||||
|
},
|
||||||
|
"states": [
|
||||||
|
{
|
||||||
|
"name": "spider_web_1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "spider_web_2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
BIN
Resources/Textures/Objects/Misc/spiderweb.rsi/spider_web_1.png
Normal file
BIN
Resources/Textures/Objects/Misc/spiderweb.rsi/spider_web_1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
BIN
Resources/Textures/Objects/Misc/spiderweb.rsi/spider_web_2.png
Normal file
BIN
Resources/Textures/Objects/Misc/spiderweb.rsi/spider_web_2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
Reference in New Issue
Block a user