Skip to content

Commit

Permalink
Spooders
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxxoTrystan committed Jul 3, 2024
1 parent 69f10b5 commit e8eb173
Show file tree
Hide file tree
Showing 16 changed files with 169 additions and 17 deletions.
12 changes: 12 additions & 0 deletions Content.Server/Atmos/Rotting/RottingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ public bool IsRotProgressing(EntityUid uid, PerishableComponent? perishable)
return false;
}

if (TryComp<CuffableComponent>(uid, out var cuffed) && cuffed.CuffedHandCount > 0)
{
if (TryComp<HandcuffComponent>(cuffed.LastAddedCuffs, out var cuffcomp))
{
if (cuffcomp.NoRot)
{
return false;
}
}
}


var ev = new IsRottingEvent();
RaiseLocalEvent(uid, ref ev);

Expand Down
25 changes: 11 additions & 14 deletions Content.Server/Spider/SpiderSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
using Content.Shared.Maps;
using Robust.Server.GameObjects;
using Robust.Shared.Map;
using Content.Shared.Nutrition.EntitySystems;
using Content.Shared.Nutrition.Components;

namespace Content.Server.Spider;

public sealed class SpiderSystem : SharedSpiderSystem
{
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly HungerSystem _hungerSystem = default!;

public override void Initialize()
{
Expand All @@ -22,6 +25,13 @@ private void OnSpawnNet(EntityUid uid, SpiderComponent component, SpiderWebActio
if (args.Handled)
return;

if (TryComp<HungerComponent>(uid, out var hungerComp)
&& _hungerSystem.IsHungerBelowState(uid, HungerThreshold.Okay, hungerComp.CurrentHunger - 5, hungerComp))
{
_popup.PopupEntity(Loc.GetString("sericulture-failure-hunger"), args.Performer, args.Performer);
return;
}

var transform = Transform(uid);

if (transform.GridUid == null)
Expand All @@ -42,22 +52,10 @@ private void OnSpawnNet(EntityUid uid, SpiderComponent component, SpiderWebActio
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);
_hungerSystem.ModifyHunger(uid, -5);
args.Handled = true;
}
else
Expand All @@ -74,4 +72,3 @@ private bool IsTileBlockedByWeb(EntityCoordinates coords)
return false;
}
}

6 changes: 6 additions & 0 deletions Content.Shared/Cuffs/Components/HandcuffComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ namespace Content.Shared.Cuffs.Components;
[Access(typeof(SharedCuffableSystem))]
public sealed partial class HandcuffComponent : Component
{
/// <summary>
/// Whether or not the entity can rot when cuffed (for spooder cocoon)
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public bool NoRot = false;

/// <summary>
/// The time it takes to cuff an entity.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Actions/spider.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- type: InstantAction
icon: Interface/Actions/web.png
event: !type:SpiderWebActionEvent
useDelay: 25
useDelay: 30

- type: entity
id: ActionSericulture
Expand Down
29 changes: 29 additions & 0 deletions Resources/Prototypes/Entities/Objects/Misc/handcuffs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,32 @@
- type: Sprite
sprite: Clothing/OuterClothing/Misc/straight_jacket.rsi
state: icon

- type: entity
name: web cocoon
description: Strong web cocoon used to restrain criminal or preys, its also prevent rotting.
id: WebCocoon
parent: ClothingOuterStraightjacket
components:
- type: Handcuff
noRot: true
cuffedRSI: Clothing/OuterClothing/Misc/webcocoon.rsi
bodyIconState: body-overlay
breakOnRemove: true
brokenPrototype: MaterialWebSilk1
startCuffSound:
path: /Audio/Items/Handcuffs/rope_start.ogg
endCuffSound:
path: /Audio/Items/Handcuffs/rope_end.ogg
startUncuffSound:
path: /Audio/Items/Handcuffs/rope_start.ogg
endUncuffSound:
path: /Audio/Items/Handcuffs/rope_breakout.ogg
startBreakoutSound:
path: /Audio/Items/Handcuffs/rope_takeoff.ogg
- type: Construction
graph: WebObjects
node: cocoon
- type: Sprite
sprite: Clothing/OuterClothing/Misc/webcocoon.rsi
state: cocoon
3 changes: 3 additions & 0 deletions Resources/Prototypes/Entities/Objects/Misc/spider_web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
snap:
- Wall
components:
- type: Construction
graph: WebStructures
node: spiderweb
- type: MeleeSound
soundGroups:
Brute:
Expand Down
12 changes: 12 additions & 0 deletions Resources/Prototypes/Entities/Structures/Furniture/beds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,15 @@
MaterialWoodPlank:
min: 2
max: 2

- type: entity
parent: WebBed
id: WebNest
name: web nest
components:
- type: Sprite
sprite: Structures/Web/nest.rsi
state: icon
- type: Construction
graph: WebStructures
node: nest
20 changes: 20 additions & 0 deletions Resources/Prototypes/Recipes/Construction/Graphs/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@
amount: 8
doAfter: 6

- to: nest
completed:
- !type:SnapToGrid
southRotation: true
steps:
- material: WebSilk
amount: 6
doAfter: 3

# Deconstruction is down here
- node: wall
Expand Down Expand Up @@ -133,3 +141,15 @@
steps:
- tool: Cutting
doAfter: 3

- node: nest
entity: WebNest
edges:
- to: start
completed:
- !type:SpawnPrototype
prototype: MaterialWebSilk1
amount: 5
steps:
- tool: Cutting
doAfter: 2
18 changes: 18 additions & 0 deletions Resources/Prototypes/Recipes/Construction/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,21 @@
- SpiderCraft
conditions:
- !type:TileNotBlocked

- type: construction
name: web nest
id: WebNest
graph: WebStructures
startNode: start
targetNode: nest
category: construction-category-furniture
description: Fun fact, you eating spiders in your sleep is false.
icon:
sprite: Structures/Web/nest.rsi
state: icon
objectType: Structure
placementMode: SnapgridCenter
canRotate: false
canBuildInImpassable: false
conditions:
- !type:TileNotBlocked
14 changes: 12 additions & 2 deletions Resources/Prototypes/Recipes/Crafting/Graphs/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,20 @@
- material: WebSilk
amount: 12
doAfter: 6

- to: boots
steps:
- material: WebSilk
amount: 2
doAfter: 4


- to: cocoon
steps:
- material: WebSilk
amount: 8
doAfter: 6


# Deconstruction
- node: tile
entity: FloorTileItemWeb
Expand All @@ -69,3 +76,6 @@

- node: boots
entity: ClothingShoesBootsWinterWeb

- node: cocoon
entity: WebCocoon
13 changes: 13 additions & 0 deletions Resources/Prototypes/Recipes/Crafting/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,16 @@
sprite: Clothing/Shoes/Boots/winterbootsweb.rsi
state: icon
objectType: Item

- type: construction
name: web cocoon
id: WebCocoon
graph: WebObjects
startNode: start
targetNode: cocoon
category: construction-category-clothing
description: "Strong web cocoon used to restrain criminal or preys, its also prevent rotting."
icon:
sprite: Clothing/OuterClothing/Misc/webcocoon.rsi
state: cocoon
objectType: Item
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Made by Heroman3003",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "cocoon"
},
{
"name": "body-overlay-2",
"directions": 4
}
]
}
Binary file added Resources/Textures/Structures/Web/nest.rsi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions Resources/Textures/Structures/Web/nest.rsi/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": 1,
"size": {
"x": 32,
"y": 32
},
"license": "CC-BY-SA-3.0",
"copyright": "Made by Heroman3003",
"states": [
{
"name": "icon"
}
]
}

0 comments on commit e8eb173

Please sign in to comment.