Bloodgrass gatherable entity + gatherable system cleanup + bugfix (#154)

* added 4 basic reagent effects

* entrance bugfixes

* add bloodgrass world sprites

* preuso cherry pick

* add planet bloodgrass and sickle gathering

* +1 gather sound
This commit is contained in:
Ed
2024-05-18 15:16:20 +03:00
committed by GitHub
parent a29034a133
commit 9690077532
26 changed files with 285 additions and 60 deletions

View File

@@ -1,4 +1,6 @@
using Content.Shared.EntityList;
using Content.Shared.Whitelist;
using Robust.Shared.Prototypes;
namespace Content.Server.Gatherable.Components;
@@ -10,7 +12,7 @@ public sealed partial class GatherableComponent : Component
/// Whitelist for specifying the kind of tools can be used on a resource
/// Supports multiple tags.
/// </summary>
[DataField("whitelist", required: true)]
[DataField(required: true)]
public EntityWhitelist? ToolWhitelist;
/// <summary>
@@ -18,14 +20,20 @@ public sealed partial class GatherableComponent : Component
/// (Tag1, Tag2, LootTableID1, LootTableID2 are placeholders for example)
/// --------------------
/// useMappedLoot: true
/// whitelist:
/// toolWhitelist:
/// tags:
/// - Tag1
/// - Tag2
/// mappedLoot:
/// loot:
/// Tag1: LootTableID1
/// Tag2: LootTableID2
/// </summary>
[DataField("loot")]
public Dictionary<string, string>? MappedLoot = new();
[DataField]
public Dictionary<string, ProtoId<EntityLootTablePrototype>>? Loot = new();
/// <summary>
/// Random shift of the appearing entity during gathering
/// </summary>
[DataField]
public float GatherOffset = 0.3f;
}

View File

@@ -1,7 +1,5 @@
using Content.Server.Gatherable.Components;
using Content.Server.Projectiles;
using Content.Shared.Projectiles;
using Content.Shared.Weapons.Ranged.Systems;
using Robust.Shared.Physics.Events;
namespace Content.Server.Gatherable;
@@ -13,20 +11,20 @@ public sealed partial class GatherableSystem
SubscribeLocalEvent<GatheringProjectileComponent, StartCollideEvent>(OnProjectileCollide);
}
private void OnProjectileCollide(EntityUid uid, GatheringProjectileComponent component, ref StartCollideEvent args)
private void OnProjectileCollide(Entity<GatheringProjectileComponent> gathering, ref StartCollideEvent args)
{
if (!args.OtherFixture.Hard ||
args.OurFixtureId != SharedProjectileSystem.ProjectileFixture ||
component.Amount <= 0 ||
gathering.Comp.Amount <= 0 ||
!TryComp<GatherableComponent>(args.OtherEntity, out var gatherable))
{
return;
}
Gather(args.OtherEntity, uid, gatherable);
component.Amount--;
Gather(args.OtherEntity, gathering, gatherable);
gathering.Comp.Amount--;
if (component.Amount <= 0)
QueueDel(uid);
if (gathering.Comp.Amount <= 0)
QueueDel(gathering);
}
}

View File

@@ -1,11 +1,9 @@
using Content.Server.Destructible;
using Content.Server.Gatherable.Components;
using Content.Shared.EntityList;
using Content.Shared.Interaction;
using Content.Shared.Tag;
using Content.Shared.Weapons.Melee.Events;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
@@ -14,7 +12,7 @@ namespace Content.Server.Gatherable;
public sealed partial class GatherableSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly DestructibleSystem _destructible = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
@@ -30,20 +28,20 @@ public sealed partial class GatherableSystem : EntitySystem
InitializeProjectile();
}
private void OnAttacked(EntityUid uid, GatherableComponent component, AttackedEvent args)
private void OnAttacked(Entity<GatherableComponent> gatherable, ref AttackedEvent args)
{
if (component.ToolWhitelist?.IsValid(args.Used, EntityManager) != true)
if (gatherable.Comp.ToolWhitelist?.IsValid(args.Used, EntityManager) != true)
return;
Gather(uid, args.User, component);
Gather(gatherable, args.User);
}
private void OnActivate(EntityUid uid, GatherableComponent component, ActivateInWorldEvent args)
private void OnActivate(Entity<GatherableComponent> gatherable, ref ActivateInWorldEvent args)
{
if (component.ToolWhitelist?.IsValid(args.User, EntityManager) != true)
if (gatherable.Comp.ToolWhitelist?.IsValid(args.User, EntityManager) != true)
return;
Gather(uid, args.User, component);
Gather(gatherable, args.User);
}
public void Gather(EntityUid gatheredUid, EntityUid? gatherer = null, GatherableComponent? component = null)
@@ -60,25 +58,22 @@ public sealed partial class GatherableSystem : EntitySystem
_destructible.DestroyEntity(gatheredUid);
// Spawn the loot!
if (component.MappedLoot == null)
if (component.Loot == null)
return;
var pos = _transform.GetMapCoordinates(gatheredUid);
foreach (var (tag, table) in component.MappedLoot)
foreach (var (tag, table) in component.Loot)
{
if (tag != "All")
{
if (gatherer != null && !_tagSystem.HasTag(gatherer.Value, tag))
continue;
}
var getLoot = _prototypeManager.Index<EntityLootTablePrototype>(table);
var getLoot = _proto.Index(table);
var spawnLoot = getLoot.GetSpawns(_random);
var spawnPos = pos.Offset(_random.NextVector2(0.3f));
var spawnPos = pos.Offset(_random.NextVector2(component.GatherOffset));
Spawn(spawnLoot[0], spawnPos);
}
}
}

View File

@@ -21,4 +21,9 @@
- files: ["campfire_whoosh.ogg"]
license: "CC0-1.0"
copyright: 'by GrimGrum of Freesound.org. Cropped and mixed from stereo to mono.'
source: "https://freesound.org/people/GrimGrum/sounds/412558/"
source: "https://freesound.org/people/GrimGrum/sounds/412558/"
- files: ["grass_gather.ogg", "grass_gather2.ogg", "grass_gather3.ogg"]
license: "CC0-1.0"
copyright: 'by hadescolossus of Freesound.org. Cropped and mixed from stereo to mono.'
source: "https://freesound.org/people/hadescolossus/sounds/705228/"

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,14 @@
cp14-reagent-name-basic-heal-blunt = Healing solution for bruises
cp14-reagent-desc-basic-heal-blunt = Effectively treats bones and bruises.
cp14-reagent-name-basic-heal-piercing = Healing solution for puncture wounds
cp14-reagent-desc-basic-heal-piercing = Effectively heals puncture wounds.
cp14-reagent-name-basic-heal-slash = Healing solution for cuts.
cp14-reagent-desc-basic-heal-slash = Effectively heals torn tissue.
cp14-reagent-name-basic-satiate-hunger = Saturating solution
cp14-reagent-desc-basic-satiate-hunger = A mixture that effectively restores hunger.
cp14-reagent-name-basic-satiate-thirst = Life-giving moisture.
cp14-reagent-desc-basic-satiate-thirst = A liquid that tastes very much like water. It tastes strange, but it's a good thirst quencher.

View File

@@ -0,0 +1,14 @@
cp14-reagent-name-basic-heal-blunt = Лечебный раствор от ушибов
cp14-reagent-desc-basic-heal-blunt = Эффективно лечит кости и ушибы.
cp14-reagent-name-basic-heal-piercing = Лечебный раствор от уколов
cp14-reagent-desc-basic-heal-piercing = Эффективно заращивает колотые раны.
cp14-reagent-name-basic-heal-slash = Лечебный раствор от порезов
cp14-reagent-desc-basic-heal-slash = Эффективно залечивает разорванные ткани.
cp14-reagent-name-basic-satiate-hunger = Насыщающий раствор
cp14-reagent-desc-basic-satiate-hunger = Смесь, эффективно восстанавливающая голод.
cp14-reagent-name-basic-satiate-thirst = Живительная влага
cp14-reagent-desc-basic-satiate-thirst = Жилкость, очень похожая на воду. Странная на вкус, но неплохо восполняет жажду.

View File

@@ -19,14 +19,12 @@
!type:PhysShapeCircle
radius: 0.2
- type: InteractionOutline
# TODO: Nuke this shit
- type: OreVein
oreChance: 1.0
currentOre: SpaceShrooms
- type: Gatherable
whitelist:
toolWhitelist:
components:
- Hands
loot:
All: SpaceshroomGather
- type: Damageable
damageContainer: Inorganic
damageModifierSet: Wood
@@ -39,6 +37,13 @@
- !type:DoActsBehavior
acts: [ "Destruction" ]
- type: entityLootTable
id: SpaceshroomGather
entries:
- id: FoodSpaceshroom
amount: 1
maxAmount: 1
- type: entity
name: spaceshroom
parent: FoodProduceBase
@@ -120,4 +125,4 @@
state: spaceshroom_cooked
- type: Produce
- type: StaticPrice
price: 40
price: 40

View File

@@ -374,8 +374,8 @@
- type: Transform
noRot: true
- type: SoundOnGather
- type: Gatherable
whitelist:
- type: Gatherable
toolWhitelist:
tags:
- Pickaxe
- type: Damageable

View File

@@ -35,4 +35,7 @@
Slash: 5
Piercing: 3
soundHit:
collection: MetalThud
collection: MetalThud
- type: Tag
tags:
- CP14HerbalGathering

View File

@@ -0,0 +1,82 @@
- type: entity
id: CP14GatherableHerbalBase
parent: BaseStructure
abstract: true
components:
- type: Transform
anchored: true
- type: Physics
canCollide: false
- type: Gatherable
toolWhitelist:
tags:
- CP14HerbalGathering
- type: Damageable
damageContainer: Inorganic
damageModifierSet: Wood
- type: MeleeSound
soundGroups:
Brute:
collection: CP14GrassGathering
params:
variation: 0.03
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 25
behaviors:
- !type:DoActsBehavior
acts: [ "Destruction" ]
# Bloodgrass
- type: entityLootTable
id: CP14GatherBloodgrass
entries:
- id: CP14BloodGrass
amount: 1
maxAmount: 1
- type: entity
id: CP14GatherableBloodgrass
parent: CP14GatherableHerbalBase
name: bloodgrass
description: The dullest and most common plant to be found in the wild is the dark brown grass.
suffix: Gatherable
components:
- type: Sprite
drawdepth: FloorTiles
sprite: _CP14/Objects/Specific/Alchemy/Herbal/bloodgrass.rsi
state: grass1
- type: Gatherable
loot:
All: CP14GatherBloodgrass
- type: entity
id: CP14GatherableBloodgrass2
parent: CP14GatherableBloodgrass
components:
- type: Sprite
state: grass2
- type: entity
id: CP14GatherableBloodgrass3
parent: CP14GatherableBloodgrass
components:
- type: Sprite
state: grass3
- type: entity
id: CP14GatherableBloodgrass4
parent: CP14GatherableBloodgrass
components:
- type: Sprite
state: grass4
- type: entity
id: CP14GatherableBloodgrass5
parent: CP14GatherableBloodgrass
components:
- type: Sprite
state: grass5

View File

@@ -34,7 +34,7 @@
randomTeleport: false
- type: entity
parent: PortalBlue
parent: CP14DungeonEntrance
id: CP14DungeonEntranceAutolink
suffix: Autolink Dungeon
components:
@@ -49,6 +49,7 @@
description: A way out of the dark underworld into the overworld.
components:
- type: Sprite
noRot: true
sprite: /Textures/_CP14/Structures/Dungeon/holes.rsi
drawdepth: Mobs
layers:

View File

@@ -0,0 +1,73 @@
- type: reagent
id: CP14BasicEffectHealBlunt
name: cp14-reagent-name-basic-heal-blunt
desc: cp14-reagent-desc-basic-heal-blunt
group: CP14BasicEffect
flavor: medicine
color: "#c71aaa"
physicalDesc: cp14-reagent-physical-desc-scarlet
metabolisms:
Medicine:
effects:
- !type:HealthChange
damage:
types:
Blunt: -1
- type: reagent
id: CP14BasicEffectHealPiercing
name: cp14-reagent-name-basic-heal-piercing
desc: cp14-reagent-desc-basic-heal-piercing
group: CP14BasicEffect
flavor: medicine
color: "#e03895"
physicalDesc: cp14-reagent-physical-desc-scarlet
metabolisms:
Medicine:
effects:
- !type:HealthChange
damage:
types:
Piercing: -1
- type: reagent
id: CP14BasicEffectHealSlash
name: cp14-reagent-name-basic-heal-slash
desc: cp14-reagent-desc-basic-heal-slash
group: CP14BasicEffect
flavor: medicine
color: "#cf153a"
physicalDesc: cp14-reagent-physical-desc-scarlet
metabolisms:
Medicine:
effects:
- !type:HealthChange
damage:
types:
Slash: -1
- type: reagent
id: CP14BasicEffectSatiateHunger
name: cp14-reagent-name-basic-satiate-hunger
desc: cp14-reagent-desc-basic-satiate-hunger
group: CP14BasicEffect
flavor: nutriment
color: "#a35629"
physicalDesc: cp14-reagent-physical-desc-scarlet #TODO
metabolisms:
Food:
effects:
- !type:SatiateHunger
- type: reagent
id: CP14BasicEffectSatiateThirst
name: cp14-reagent-name-basic-satiate-thirst
desc: cp14-reagent-desc-basic-satiate-thirst
group: CP14BasicEffect
flavor: nutriment
color: "#2b7fed"
physicalDesc: cp14-reagent-physical-desc-scarlet #TODO
metabolisms:
Drink:
effects:
- !type:SatiateThirst

View File

@@ -1,5 +1,5 @@
- type: reaction
id: CP14VitalExtract
id: CP14BloodGrassProcessing1
minTemp: 350
reactants:
CP14Blood:
@@ -7,17 +7,19 @@
CP14BloodGrassSap:
amount: 2
products:
CP14VitalExtract: 3
CP14BasicEffectSatiateHunger: 2
CP14BasicEffectHealSlash: 0.5
CP14BasicEffectHealPiercing: 0.5
- type: reaction
id: CP14VitalExtractOverheating
minTemp: 450
reactants:
CP14VitalExtract:
amount: 1
effects:
- !type:AreaReactionEffect
duration: 20
prototypeId: CP14MistVitalExtract
sound:
path: /Audio/Effects/smoke.ogg
#- type: reaction
# id: CP14BloodGrassProcessingFail1
# minTemp: 450
# reactants:
# CP14VitalExtract:
# amount: 1
# effects:
# - !type:AreaReactionEffect
# duration: 20
# prototypeId: CP14MistVitalExtract
# sound:
# path: /Audio/Effects/smoke.ogg

View File

@@ -11,4 +11,11 @@
id: CP14Bubbles
files:
- /Audio/Effects/Chemistry/bubbles.ogg
- /Audio/_CP14/Effects/bubbles.ogg
- /Audio/_CP14/Effects/bubbles.ogg
- type: soundCollection
id: CP14GrassGathering
files:
- /Audio/_CP14/Items/grass_gather.ogg
- /Audio/_CP14/Items/grass_gather2.ogg
- /Audio/_CP14/Items/grass_gather3.ogg

View File

@@ -12,3 +12,6 @@
- type: Tag
id: CP14FireplaceFuel
- type: Tag
id: CP14HerbalGathering

View File

@@ -2,8 +2,8 @@
# Basic alchemical reagents
In the world of Eberron, there are 12 basic alchemical reagents called Extracts. They can be obtained in a variety of ways, and act as starting points for more complex alchemical recipes.
Many potions consist of the individual basic reagent effects described below:
<GuideReagentGroupEmbed Group="CP14BasicAlchemy"/>
<GuideReagentGroupEmbed Group="CP14BasicEffect"/>
</Document>

View File

@@ -2,8 +2,8 @@
# Основные алхимические реагенты
В мире Эберрона существует 12 базовых алхимических реагентов, называемых экстрактами. Они могут быть получены различными способами и служат отправной точкой для более сложных алхимических рецептов.
Многие зелья состоят из отдельных основных реагентных эффектов, описанных ниже:
<GuideReagentGroupEmbed Group="CP14BasicAlchemy"/>
<GuideReagentGroupEmbed Group="CP14BasicEffect"/>
</Document>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 705 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 710 B

View File

@@ -5,7 +5,7 @@
"y": 32
},
"license": "CC-BY-SA-3.0",
"copyright": "Created by TheShuEd (Github) for CrystallPunk14",
"copyright": "Base Created by TheShuEd (Github) for CrystallPunk14, Grass taken from tgstation at commits https://github.com/tgstation/tgstation/commit/729d858807905263adab8b5a331c1d8a04982dd3, and recolored",
"states": [
{
"name": "base1"
@@ -21,6 +21,21 @@
},
{
"name": "base5"
},
{
"name": "grass1"
},
{
"name": "grass2"
},
{
"name": "grass3"
},
{
"name": "grass4"
},
{
"name": "grass5"
}
]
}