КОСТЁР (#22)

* респрайт костра, новый костёр

* fix itemheating

* этот костер потребовал слишком много работы

* перекрас травы
This commit is contained in:
Ed
2024-04-03 00:48:08 +03:00
committed by GitHub
parent ca4172c987
commit 0bc1c31193
19 changed files with 196 additions and 0 deletions

View File

@@ -61,5 +61,18 @@ namespace Content.Server.Atmos.Components
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float FirestackFade = -0.1f;
/// <summary>
/// Set FirestackFade on Ingite to this value
/// </summary>
[DataField]
public float? FirestackFadeOnIgnite = null;
/// <summary>
/// CrystallPunk moment
/// determines how extinction "FirestackFade" will fade out. it can be used to make "parabolas" of object ignition and decay.
/// </summary>
[DataField]
public float FirestackFadeFade = 0;
}
}

View File

@@ -27,6 +27,7 @@ using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Events;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Random;
using Content.Server.CrystallPunk.Temperature;
namespace Content.Server.Atmos.EntitySystems
{
@@ -296,6 +297,12 @@ namespace Content.Server.Atmos.EntitySystems
_ignitionSourceSystem.SetIgnited(uid, false);
//CrystallPunk bonfire moment
var ev = new OnFireChangedEvent(flammable.OnFire);
RaiseLocalEvent(uid, ref ev);
//CrystallPunk bonfire moment end
UpdateAppearance(uid, flammable);
}
@@ -317,9 +324,19 @@ namespace Content.Server.Atmos.EntitySystems
else
_adminLogger.Add(LogType.Flammable, $"{ToPrettyString(uid):target} set on fire by {ToPrettyString(ignitionSource):actor}");
flammable.OnFire = true;
//CrystallPunk bonfire moment
var ev = new OnFireChangedEvent(flammable.OnFire);
RaiseLocalEvent(uid, ref ev);
//CrystallPunk bonfire moment end
}
UpdateAppearance(uid, flammable);
//CrystallPunk bonfire moment
if (flammable.FirestackFadeOnIgnite != null)
flammable.FirestackFade = flammable.FirestackFadeOnIgnite.Value;
//CrystallPunk bonfire moment end
}
private void OnDamageChanged(EntityUid uid, IgniteOnHeatDamageComponent component, DamageChangedEvent args)
@@ -434,6 +451,11 @@ namespace Content.Server.Atmos.EntitySystems
_damageableSystem.TryChangeDamage(uid, flammable.Damage * damageScale, interruptsDoAfters: false);
AdjustFireStacks(uid, flammable.FirestackFade * (flammable.Resisting ? 10f : 1f), flammable);
//CrystallPunk bonfire moment
if (flammable.FirestackFadeFade != 0)
flammable.FirestackFade += flammable.FirestackFadeFade * frameTime;
//CrystallPunk bonfire moment end
}
else
{

View File

@@ -1,3 +1,4 @@
using Content.Server.CrystallPunk.Temperature;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Shared.Audio;
@@ -11,6 +12,7 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
base.Initialize();
SubscribeLocalEvent<AmbientOnPoweredComponent, PowerChangedEvent>(HandlePowerChange);
SubscribeLocalEvent<AmbientOnPoweredComponent, PowerNetBatterySupplyEvent>(HandlePowerSupply);
SubscribeLocalEvent<CPFlammableAmbientSoundComponent, OnFireChangedEvent>(OnFireChanged); //CrystallPunk bonfire moment
}
private void HandlePowerSupply(EntityUid uid, AmbientOnPoweredComponent component, ref PowerNetBatterySupplyEvent args)
@@ -22,4 +24,11 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
{
SetAmbience(uid, args.Powered);
}
//CrystallPunk bonfire moment
private void OnFireChanged(Entity<CPFlammableAmbientSoundComponent> ent, ref OnFireChangedEvent args)
{
SetAmbience(ent, args.OnFire);
}
//CrystallPunk bonfire moment end
}

View File

@@ -1,3 +1,5 @@
using Content.Server.Atmos.Components;
using Content.Server.CrystallPunk.Temperature;
using Content.Server.Power.Components;
using Content.Server.Temperature.Components;
using Content.Shared.Examine;
@@ -45,6 +47,21 @@ public sealed class EntityHeaterSystem : EntitySystem
_temperature.ChangeHeat(ent, energy);
}
}
//CrystallPunk bonfire
var flammbaleQuery = EntityQueryEnumerator<CPFlammableEntityHeaterComponent, ItemPlacerComponent, FlammableComponent>();
while (flammbaleQuery.MoveNext(out var uid, out _, out var placer, out var flammable))
{
if (!flammable.OnFire)
return;
var energy = flammable.FireStacks * deltaTime * 300;
foreach (var ent in placer.PlacedEntities)
{
_temperature.ChangeHeat(ent, energy);
}
}
//CrystallPunk bonfire end
}
private void OnExamined(EntityUid uid, EntityHeaterComponent comp, ExaminedEvent args)

View File

@@ -0,0 +1,20 @@
using Content.Server.Temperature.Systems;
namespace Content.Server.CrystallPunk.Temperature;
/// <summary>
/// CTurn on and turn off AmbientSound when Flammable OnFire os changed
/// </summary>
[RegisterComponent, Access(typeof(EntityHeaterSystem))]
public sealed partial class CPFlammableAmbientSoundComponent : Component
{
}
/// <summary>
/// Raised whenever an FlammableComponen OnFire is Changed
/// </summary>
[ByRefEvent]
public readonly record struct OnFireChangedEvent(bool OnFire)
{
public readonly bool OnFire = OnFire;
}

View File

@@ -0,0 +1,11 @@
using Content.Server.Temperature.Systems;
namespace Content.Server.CrystallPunk.Temperature;
/// <summary>
/// Adds thermal energy from FlammableComponent to entities with <see cref="TemperatureComponent"/> placed on it.
/// </summary>
[RegisterComponent, Access(typeof(EntityHeaterSystem))]
public sealed partial class CPFlammableEntityHeaterComponent : Component
{
}

View File

@@ -1,5 +1,6 @@
- type: entity
id: Bonfire
noSpawn: true
parent: BaseStructure
name: bonfire
description: What can be better then late evening under the sky with guitar and friends.
@@ -37,6 +38,7 @@
- type: entity
id: LegionnaireBonfire
noSpawn: true
parent: Bonfire
name: legionnaire bonfire
description: There, in the land of lava and ash, place to to cook marshmallow and potato.

View File

@@ -0,0 +1,75 @@
- type: entity
id: CPBonfire
parent: BaseStructure
name: костёр
description: Груда бревен, сложенных вместе, и готовых вспыхнуть от малейшей искры.
components:
- type: Sprite
noRot: true
sprite: CrystallPunk/Structures/Decoration/bonfire.rsi
layers:
- state: bonfire
- type: Fixtures
fixtures:
fix1:
shape:
!type:PhysShapeAabb
bounds: "-0.08,-0.35,0.15,0.25"
mask:
- TabletopMachineMask
layer:
- Impassable
- MidImpassable
- LowImpassable
hard: true
- type: Damageable
damageContainer: Inorganic
damageModifierSet: Wood
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 80
behaviors:
- !type:DoActsBehavior
acts: [ "Destruction" ]
- trigger:
!type:DamageTypeTrigger
damageType: Heat
damage: 50
behaviors:
- !type:DoActsBehavior
acts: [ "Destruction" ]
- type: CPFlammableAmbientSound
- type: AmbientSound
enabled: false
volume: -5
range: 5
sound:
path: /Audio/Ambience/Objects/fireplace.ogg
- type: Appearance
- type: Reactive
groups:
Flammable: [ Touch ]
Extinguish: [ Touch ]
- type: Flammable
fireSpread: false
canResistFire: false
alwaysCombustible: true
canExtinguish: true
firestacksOnIgnite: 0.5
firestackFade: 0.3
firestackFadeOnIgnite: 0.3
firestackFadeFade: -0.2
damage:
types:
Heat: 0.01
- type: FireVisuals
sprite: CrystallPunk/Structures/Decoration/bonfire.rsi
normalState: burning
- type: ItemPlacer
maxEntities: 4
whitelist:
components:
- Temperature
- type: CPFlammableEntityHeater

Binary file not shown.

After

Width:  |  Height:  |  Size: 936 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@@ -0,0 +1,27 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Taken from /tg/station at commit 28b476ab6d17014e6f9e18a748d7c96be28de9a1, recolor and edited by TheShuEd for CrystallPunk14",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "bonfire"
},
{
"name": "bonfire_extinguished"
},
{
"name": "burning",
"delays": [
[
0.3,
0.3,
0.3
]
]
}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 745 B

After

Width:  |  Height:  |  Size: 740 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 590 B

After

Width:  |  Height:  |  Size: 588 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB