Healing component and Medkit (#143)
Medkit to heal yourself and your buddy known issues: - [ ] it doesn't restore screen effects that happens when health status go into crit and dead
This commit is contained in:
committed by
Pieter-Jan Briers
parent
96868625cb
commit
3b40b4aafa
@@ -141,6 +141,7 @@
|
||||
<Compile Include="GameObjects\Components\Power\PowerDebugTool.cs" />
|
||||
<Compile Include="ServerNotifyManager.cs" />
|
||||
<Compile Include="StatusShell.cs" />
|
||||
<Compile Include="GameObjects\Components\Healing\HealingComponent.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Content.Shared\Content.Shared.csproj">
|
||||
@@ -183,4 +184,7 @@
|
||||
<Compile Include="GameObjects\Components\Construction\ConstructorComponent.cs" />
|
||||
<Compile Include="GameObjects\Components\Construction\ConstructionComponent.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="GameObjects\Components\Healing\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -102,6 +102,8 @@ namespace Content.Server
|
||||
factory.Register<ThrownItemComponent>();
|
||||
factory.Register<MeleeWeaponComponent>();
|
||||
|
||||
factory.Register<HealingComponent>();
|
||||
|
||||
factory.Register<HandheldLightComponent>();
|
||||
|
||||
factory.Register<ServerStorageComponent>();
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using SS14.Shared.GameObjects;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using SS14.Shared.Interfaces.GameObjects;
|
||||
using SS14.Shared.Map;
|
||||
using SS14.Shared.IoC;
|
||||
using SS14.Server.GameObjects;
|
||||
using SS14.Shared.Maths;
|
||||
using SS14.Server.Interfaces.GameObjects;
|
||||
using SS14.Shared.Interfaces.Timing;
|
||||
using SS14.Shared.GameObjects.EntitySystemMessages;
|
||||
using SS14.Shared.Serialization;
|
||||
using SS14.Shared.Interfaces.GameObjects.Components;
|
||||
using Content.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
{
|
||||
public class HealingComponent : Component, IAfterAttack, IUse
|
||||
{
|
||||
public override string Name => "Healing";
|
||||
|
||||
public int Heal = 100;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref Heal, "heal", 100);
|
||||
}
|
||||
|
||||
void IAfterAttack.Afterattack(IEntity user, GridCoordinates clicklocation, IEntity attacked)
|
||||
{
|
||||
if (attacked == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (attacked.TryGetComponent(out DamageableComponent damagecomponent))
|
||||
{
|
||||
damagecomponent.TakeHealing(DamageType.Brute, Heal);
|
||||
DropAndDelete(user);
|
||||
}
|
||||
}
|
||||
|
||||
bool IUse.UseEntity(IEntity user)
|
||||
{
|
||||
if (user.TryGetComponent(out DamageableComponent damagecomponent))
|
||||
{
|
||||
damagecomponent.TakeHealing(DamageType.Brute, Heal);
|
||||
DropAndDelete(user);
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void DropAndDelete(IEntity user)
|
||||
{
|
||||
if(user.TryGetComponent(out HandsComponent handscomponent))
|
||||
{
|
||||
handscomponent.Drop(Owner);
|
||||
Owner.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ namespace Content.Server.GameObjects
|
||||
|
||||
public override List<(DamageType, int, ThresholdType)> AllowedStates => new List<(DamageType, int, ThresholdType)>()
|
||||
{
|
||||
(DamageType.Total, critvalue-1, ThresholdType.None),
|
||||
(DamageType.Total, critvalue, ThresholdType.Critical),
|
||||
(DamageType.Total, 300, ThresholdType.Death),
|
||||
};
|
||||
|
||||
@@ -298,13 +298,13 @@ entities:
|
||||
pos: -1.984375,-4.484375
|
||||
rot: -1.570796 rad
|
||||
type: Transform
|
||||
- type: medkit_r
|
||||
- type: Medkit
|
||||
components:
|
||||
- grid: 0
|
||||
pos: -0.859375,-3.921875
|
||||
rot: -1.570796 rad
|
||||
type: Transform
|
||||
- type: medkit_r
|
||||
- type: Medkit
|
||||
components:
|
||||
- grid: 0
|
||||
pos: -0.921875,-4.640625
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
- type: entity
|
||||
id: medkit_r
|
||||
name: Medkit
|
||||
parent: BaseItem
|
||||
id: Medkit
|
||||
components:
|
||||
- type: Clickable
|
||||
- type: Sprite
|
||||
texture: Objects/medkit_r.png
|
||||
|
||||
- type: Icon
|
||||
texture: Objects/medkit_r.png
|
||||
|
||||
- type: Healing
|
||||
heal: 100
|
||||
- type: Item
|
||||
Size: 24
|
||||
Reference in New Issue
Block a user