feat(equipment): persist mech loadouts and recover ejection safe case loot
This commit is contained in:
@@ -92,12 +92,12 @@ namespace Ironspore
|
||||
pitch = Mathf.Clamp(pitch - look.y * .105f, -72, 75);
|
||||
if (game.Action("View").WasPressedThisFrame())
|
||||
FirstPerson = !FirstPerson;
|
||||
if (game.Action("Guard").WasPressedThisFrame() && Energy >= 20)
|
||||
if (game.Action("Guard").WasPressedThisFrame() && game.Run.equipment[3] >= 0 && Energy >= 20)
|
||||
{
|
||||
Energy -= 20;
|
||||
Guard = 2.5f;
|
||||
}
|
||||
if (game.Action("Boost").WasPressedThisFrame() && boostCooldown <= 0 && Energy >= 18)
|
||||
if (game.Action("Boost").WasPressedThisFrame() && game.Run.equipment[2] >= 0 && boostCooldown <= 0 && Energy >= 18)
|
||||
{
|
||||
boostDirection = Quaternion.Euler(0, yaw, 0) * new Vector3(movement.x, 0, movement.y == 0 && movement.x == 0 ? 1 : movement.y);
|
||||
boostDirection.Normalize();
|
||||
@@ -116,7 +116,7 @@ namespace Ironspore
|
||||
}
|
||||
}
|
||||
Vector3 velocity = Quaternion.Euler(0, yaw, 0) * new Vector3(movement.x, 0, movement.y);
|
||||
float speed = frame.speed * game.Part(2, game.Run.equipment[2]).speedFactor;
|
||||
float speed = frame.speed * (game.Part(2, game.Run.equipment[2])?.speedFactor ?? 1f);
|
||||
velocity = Vector3.ClampMagnitude(velocity, 1) * speed;
|
||||
if (boostRemaining > 0)
|
||||
{
|
||||
@@ -141,7 +141,7 @@ namespace Ironspore
|
||||
freshTrigger = false;
|
||||
if (!freshTrigger && game.Action("Fire").IsPressed() && shotCooldown <= 0)
|
||||
Shoot(false);
|
||||
if (game.Action("Secondary").WasPressedThisFrame() && sideCooldown <= 0 && Energy >= 15)
|
||||
if (game.Action("Secondary").WasPressedThisFrame() && game.Run.equipment[1] >= 0 && sideCooldown <= 0 && Energy >= 15)
|
||||
{
|
||||
Energy -= 15;
|
||||
Shoot(true);
|
||||
@@ -171,6 +171,7 @@ namespace Ironspore
|
||||
void Shoot(bool secondary)
|
||||
{
|
||||
var part = game.Part(secondary ? 1 : 0, game.Run.equipment[secondary ? 1 : 0]);
|
||||
if (!part) return;
|
||||
shotCooldown = secondary ? shotCooldown : 1 / part.fireRate;
|
||||
Ray ray = view.ViewportPointToRay(new Vector3(.5f, .5f));
|
||||
Vector3 target = ray.GetPoint(180);
|
||||
@@ -211,7 +212,7 @@ namespace Ironspore
|
||||
if (!game.InField || Health <= 0)
|
||||
return;
|
||||
LastDamageFrame = Time.frameCount;
|
||||
float armorFactor = game.Part(3, game.Run.equipment[3]).id == "reactive_guard" ? .72f : 1;
|
||||
float armorFactor = game.Part(3, game.Run.equipment[3])?.id == "reactive_guard" ? .72f : 1;
|
||||
Health = Mathf.Max(0, Health - amount * armorFactor * (Guard > 0 ? .2f : 1));
|
||||
game.Run.armor = Health;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user