mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-25 15:35:22 +00:00
28 lines
858 B
C#
28 lines
858 B
C#
|
using OWML.Utils;
|
|||
|
using QSB.Utility;
|
|||
|
using QSB.WorldSync;
|
|||
|
|
|||
|
namespace QSB.ShipSync.WorldObjects
|
|||
|
{
|
|||
|
class QSBShipComponent : WorldObject<ShipComponent>
|
|||
|
{
|
|||
|
public override void Init(ShipComponent component, int id)
|
|||
|
{
|
|||
|
ObjectId = id;
|
|||
|
AttachedObject = component;
|
|||
|
}
|
|||
|
|
|||
|
public void SetDamaged()
|
|||
|
{
|
|||
|
DebugLog.DebugWrite($"[S COMPONENT] {AttachedObject} Set damaged.");
|
|||
|
AttachedObject.SetValue("_damaged", true);
|
|||
|
AttachedObject.SetValue("_repairFraction", 0f);
|
|||
|
AttachedObject.GetType().GetAnyMethod("OnComponentDamaged").Invoke(AttachedObject, null);
|
|||
|
QSBWorldSync.RaiseEvent(AttachedObject, "OnDamaged", AttachedObject);
|
|||
|
AttachedObject.GetType().GetAnyMethod("UpdateColliderState").Invoke(AttachedObject, null);
|
|||
|
var damageEffect = AttachedObject.GetValue<DamageEffect>("_damageEffect");
|
|||
|
damageEffect.SetEffectBlend(1f);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|