feat(aswid): bat flies on the Skadi's directed flight
The bat flew on vanilla's debug-fly flag: 50 m/s, free, blind to carry weight, and invisible to monsters until six patches lied about the flag. It now flies on m_flying with the drake's controls, moved out of SkadiPatches into a shared DirectedFlight core that both forms feed their own numbers into. Powered flight and the sprint cost stamina; out of stamina the bat glides. Encumbered flight costs 15% more, or is blocked with 'While Encumbered'. Optional duration and cooldown, off by default. The aggro/damage patches, the debug-fly speed patch and their three settings are removed; the drake's behaviour is unchanged.
This commit is contained in:
parent
824ddd8956
commit
77cdc67e97
19 changed files with 534 additions and 516 deletions
|
|
@ -4,10 +4,10 @@ using Jotunn.Managers;
|
|||
|
||||
namespace RacesOfValheim
|
||||
{
|
||||
public class DrakeFormBehavior : MonoBehaviour
|
||||
public class DrakeFormBehavior : MonoBehaviour, IDirectedFlyer
|
||||
{
|
||||
// Single active instance, read by SkadiDirectedFlightPatch to feed a
|
||||
// look-direction-based m_moveDir into Character.UpdateFlying every frame.
|
||||
// Single active instance, read by the Skadi patches that care about the drake itself
|
||||
// (breath facing, attacks). Flight reads it through DirectedFlight.Active instead.
|
||||
public static DrakeFormBehavior Active { get; private set; }
|
||||
|
||||
private Animator anim;
|
||||
|
|
@ -41,9 +41,25 @@ namespace RacesOfValheim
|
|||
if (nview != null && nview.IsValid()) nview.GetZDO().Set(FlyingKey, value);
|
||||
}
|
||||
|
||||
// Time.time of the last powered/grounded moment. SkadiDirectedFlightPatch holds the form
|
||||
// Time.time of the last powered/grounded moment. DirectedFlightPatch holds the form
|
||||
// level for a short window past this before letting it start sinking.
|
||||
public float LastPoweredTime;
|
||||
public float LastPoweredTime { get; set; }
|
||||
|
||||
// The drake's numbers for DirectedFlightPatch. Base flight stays free on purpose - the
|
||||
// drake arrives at the Elder, long before the player has the stamina pool to pay for
|
||||
// simply staying airborne - so only the sprint costs anything.
|
||||
public float TurnSpeed => SkadiConfig.FlightTurnSpeed.Value;
|
||||
public float GlideSpeed => SkadiConfig.FlightGlideSpeed.Value;
|
||||
public float BoostSpeed => SkadiConfig.FlightBoostSpeed.Value;
|
||||
public float SprintSpeed => SkadiConfig.FlightSprintSpeed.Value;
|
||||
public float ReverseSpeed => SkadiConfig.FlightReverseSpeed.Value;
|
||||
// Climbing out of water is deliberately slower than a powered climb in open air - the
|
||||
// wings are dragging themselves free, not racing.
|
||||
public float LiftoffSpeed => SkadiConfig.FlightLiftoffSpeed.Value;
|
||||
public float HoverSeconds => SkadiConfig.FlightHoverSeconds.Value;
|
||||
public float PoweredStaminaPerSecond => 0f;
|
||||
public float SprintStaminaPerSecond => SkadiConfig.FlightSprintStaminaPerSecond.Value;
|
||||
public bool CanPower => true;
|
||||
|
||||
private SkadiProgression.FormRules formRules;
|
||||
|
||||
|
|
@ -97,6 +113,7 @@ namespace RacesOfValheim
|
|||
private void Start()
|
||||
{
|
||||
Active = this;
|
||||
DirectedFlight.Register(this);
|
||||
anim = GetComponentInChildren<Animator>();
|
||||
|
||||
if (Player.m_localPlayer != null)
|
||||
|
|
@ -609,6 +626,7 @@ namespace RacesOfValheim
|
|||
private void OnDestroy()
|
||||
{
|
||||
if (Active == this) Active = null;
|
||||
DirectedFlight.Unregister(this);
|
||||
if (Player.m_localPlayer != null)
|
||||
{
|
||||
SetFlying(false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue