2021-06-20 08:48:37 +00:00
|
|
|
|
using OWML.Utils;
|
|
|
|
|
using QSB.Utility;
|
|
|
|
|
using QSB.WorldSync;
|
|
|
|
|
|
|
|
|
|
namespace QSB.ShipSync.WorldObjects
|
|
|
|
|
{
|
2021-07-12 21:02:50 +00:00
|
|
|
|
internal class QSBShipHull : WorldObject<ShipHull>
|
2021-06-20 08:48:37 +00:00
|
|
|
|
{
|
|
|
|
|
public void SetDamaged()
|
|
|
|
|
{
|
|
|
|
|
DebugLog.DebugWrite($"[HULL] {AttachedObject} Set damaged.");
|
|
|
|
|
AttachedObject.SetValue("_damaged", true);
|
2021-07-07 08:00:54 +00:00
|
|
|
|
AttachedObject.RaiseEvent("OnDamaged", AttachedObject);
|
2021-06-20 08:48:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-20 09:06:29 +00:00
|
|
|
|
public void SetRepaired()
|
|
|
|
|
{
|
|
|
|
|
DebugLog.DebugWrite($"[HULL] {AttachedObject} Set repaired.");
|
|
|
|
|
AttachedObject.SetValue("_damaged", false);
|
2021-07-07 08:00:54 +00:00
|
|
|
|
AttachedObject.RaiseEvent("OnRepaired", AttachedObject);
|
2021-06-20 09:06:29 +00:00
|
|
|
|
var damageEffect = AttachedObject.GetValue<DamageEffect>("_damageEffect");
|
|
|
|
|
damageEffect.SetEffectBlend(0f);
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-20 08:48:37 +00:00
|
|
|
|
public void ChangeIntegrity(float newIntegrity)
|
|
|
|
|
{
|
|
|
|
|
DebugLog.DebugWrite($"[HULL] {AttachedObject} Change integrity to {newIntegrity}.");
|
|
|
|
|
AttachedObject.SetValue("_integrity", newIntegrity);
|
|
|
|
|
var damageEffect = AttachedObject.GetValue<DamageEffect>("_damageEffect");
|
|
|
|
|
damageEffect.SetEffectBlend(1f - newIntegrity);
|
|
|
|
|
}
|
2021-06-20 11:43:02 +00:00
|
|
|
|
|
|
|
|
|
public void RepairTick(float integrity)
|
|
|
|
|
{
|
|
|
|
|
AttachedObject.SetValue("_integrity", integrity);
|
|
|
|
|
var damageEffect = AttachedObject.GetValue<DamageEffect>("_damageEffect");
|
|
|
|
|
damageEffect.SetEffectBlend(1f - integrity);
|
|
|
|
|
}
|
2021-06-20 08:48:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|