Skip to content

Commit

Permalink
Various fixes
Browse files Browse the repository at this point in the history
- Fixed *Make it possible to keep copter ears by holding the jump button while in mid-air, like in JJ2+*
- Fixed *Player gets stuck between two horizontal springs* (in *Loose Screws* and probably some other places)
- Fixed *SchwartzenGuard's walking animation plays too fast*
- Fixed *Spamming the weapon change button sometimes gets the current weapon stuck for a few moments*
- Fixed *While flying towards you, the bats don't look at you, making them fly backwards sometimes*
- Fixed *When grabbing the full life restore carrot, Spaz says "Yummy!"*
- Fixed *Player can buttstomp SchwartzenGuard's mace*
- Fixed *Make the number keys able to change to their respective weapon*
  • Loading branch information
deathkiller committed May 20, 2020
1 parent 5174d3b commit 64fcf5b
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Content/Metadata/Boss/TurtleTough.res
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"Walk": {
"Path": "TurtleToughBoss/walk.png",
"States": [ 1 ],
"FrameRate": 8
"FrameRate": 5
},

"AttackStart": {
Expand All @@ -37,7 +37,7 @@
"Mace": {
"Path": "TurtleToughBoss/mace.png",
"States": [ 1073741827 ],
"FrameRate": 15
"FrameRate": 12
}
},

Expand Down
2 changes: 1 addition & 1 deletion Content/Metadata/Interactive/PlayerLori.res
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@
"Paths": [ "Pickup/food_edible_1.wav", "Pickup/food_edible_2.wav", "Pickup/food_edible_3.wav", "Pickup/food_edible_4.wav" ]
},
"PickupMaxCarrot": {

"Paths": [ "Pickup/food_edible_1.wav" ]
},
"WeaponBlaster": {
"__Paths": [ "Weapon/bullet_blaster_jazz_1.wav", "Weapon/bullet_blaster_jazz_2.wav", "Weapon/bullet_blaster_jazz_3.wav", "Weapon/bullet_blaster_jazz_4.wav" ],
Expand Down
2 changes: 1 addition & 1 deletion Content/Metadata/Interactive/PlayerSpaz.res
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@
"Paths": [ "Pickup/food_edible_1.wav", "Pickup/food_edible_2.wav", "Pickup/food_edible_3.wav", "Pickup/food_edible_4.wav" ]
},
"PickupMaxCarrot": {
"Paths": [ "Jazz/carrot.wav" ]
"Paths": [ "Pickup/food_edible_1.wav" ]
},
"WeaponBlaster": {
"__Paths": [ "Weapon/bullet_blaster_spaz_1.wav", "Weapon/bullet_blaster_spaz_2.wav", "Weapon/bullet_blaster_spaz_3.wav" ],
Expand Down
2 changes: 1 addition & 1 deletion Shared/Jazz2.Core.Server/Server/GameServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ private void OnPublishToServerList()
}
}

Thread.Sleep(300000); // 5 minutes
Thread.Sleep(600000); // 10 minutes
}
}

Expand Down
4 changes: 4 additions & 0 deletions Shared/Jazz2.Core/Actors/Enemies/Bat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public override void OnFixedUpdate(float timeMult)
speedX = direction.X * DefaultSpeed;
speedY = direction.Y * DefaultSpeed;

IsFacingLeft = (speedX < 0f);

if (noiseCooldown > 0f) {
noiseCooldown -= timeMult;
} else {
Expand Down Expand Up @@ -86,6 +88,8 @@ public override void OnFixedUpdate(float timeMult)
direction.Normalize();
speedX = direction.X * DefaultSpeed;
speedY = direction.Y * DefaultSpeed;

IsFacingLeft = (speedX < 0f);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions Shared/Jazz2.Core/Actors/Enemies/Bosses/TurtleTough.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ private class Mace : EnemyBase
protected override async Task OnActivatedAsync(ActorActivationDetails details)
{
base.canBeFrozen = false;
base.isInvulnerable = true;
base.canCollideWithAmmo = false;
base.CollisionFlags = CollisionFlags.CollideWithOtherActors;

Expand Down
18 changes: 18 additions & 0 deletions Shared/Jazz2.Core/Actors/Player.Weapons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,24 @@ private void SwitchToNextWeapon()
currentWeapon = (WeaponType)((int)(currentWeapon + 1) % (int)WeaponType.Count);
}

weaponCooldown = 1f;

#if MULTIPLAYER && SERVER
((LevelHandler)levelHandler).OnPlayerRefreshAmmo(this, currentWeapon, weaponAmmo[(int)currentWeapon], true);
#endif

PreloadMetadata("Weapon/" + currentWeapon);
}

private void SwitchToWeaponByIndex(int weaponIndex)
{
if (weaponIndex >= weaponAmmo.Length || weaponAmmo[weaponIndex] == 0) {
return;
}

currentWeapon = (WeaponType)weaponIndex;
weaponCooldown = 1f;

#if MULTIPLAYER && SERVER
((LevelHandler)levelHandler).OnPlayerRefreshAmmo(this, currentWeapon, weaponAmmo[(int)currentWeapon], true);
#endif
Expand Down
32 changes: 22 additions & 10 deletions Shared/Jazz2.Core/Actors/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,6 @@ public override void OnFixedUpdate(float timeMult)
else
#endif
{

speedX = MathF.Max((MathF.Abs(speedX) - Deceleration * timeMult), 0) * (speedX < 0 ? -1 : 1);
isActivelyPushing = false;

Expand All @@ -670,7 +669,7 @@ public override void OnFixedUpdate(float timeMult)
float absSpeedX = MathF.Abs(speedX);
if (absSpeedX > 1f) {
IsFacingLeft = (speedX < 0f);
} else if (absSpeedX < 0.001f) {
} else if (absSpeedX < 1f) {
keepRunningTime = 0f;
}
}
Expand Down Expand Up @@ -821,7 +820,6 @@ public override void OnFixedUpdate(float timeMult)
CollisionFlags |= CollisionFlags.CollideWithSolidObjects;
});
} else {

switch (playerType) {
case PlayerType.Jazz: {
if ((currentAnimationState & AnimState.Crouch) != 0) {
Expand Down Expand Up @@ -922,7 +920,11 @@ public override void OnFixedUpdate(float timeMult)
}
canJump = true;
}
if (canJump && currentSpecialMove == SpecialMoveType.None && !ControlScheme.PlayerActionPressed(playerIndex, PlayerActions.Down)) {
if (!canJump) {
if (copterFramesLeft > 0f) {
copterFramesLeft = 70f;
}
} else if (currentSpecialMove == SpecialMoveType.None && !ControlScheme.PlayerActionPressed(playerIndex, PlayerActions.Down)) {
canJump = false;
isFreefall = false;
SetAnimation(currentAnimationState & (~AnimState.Lookup & ~AnimState.Crouch));
Expand Down Expand Up @@ -995,8 +997,18 @@ public override void OnFixedUpdate(float timeMult)
}
}

if (playerType != PlayerType.Frog && ControlScheme.PlayerActionHit(playerIndex, PlayerActions.SwitchWeapon)) {
SwitchToNextWeapon();
if (playerType != PlayerType.Frog) {
if (ControlScheme.PlayerActionHit(playerIndex, PlayerActions.SwitchWeapon)) {
SwitchToNextWeapon();
} else if (playerIndex == 0) {
// Use numeric key to switch weapons for the first player
int maxWeaponCount = Math.Min(weaponAmmo.Length, 9);
for (int i = 0; i < maxWeaponCount; i++) {
if (weaponAmmo[i] != 0 && DualityApp.Keyboard.KeyHit(Duality.Input.Key.Number1 + i)) {
SwitchToWeaponByIndex(i);
}
}
}
}
#endif
}
Expand Down Expand Up @@ -1041,6 +1053,7 @@ protected override void OnHitWall()
// Reset speed and show Push animation
speedX = 0f;
pushFramesLeft = 2f;
keepRunningTime = 0f;

Vector3 pos = Transform.Pos;
if (levelHandler.EventMap.IsHurting(pos.X + (speedX > 0f ? 1f : -1f) * 16f, pos.Y)) {
Expand Down Expand Up @@ -1298,7 +1311,7 @@ private void UpdateAnimation(float timeMult)
newState = AnimState.Swing;
} else if (isLifting) {
newState = AnimState.Lift;
} else if (canJump && isActivelyPushing && pushFramesLeft > 0f) {
} else if (canJump && isActivelyPushing && pushFramesLeft > 0f && keepRunningTime <= 0f) {
newState = AnimState.Push;
} else {
// Only certain ones don't need to be preserved from earlier state, others should be set as expected
Expand Down Expand Up @@ -2143,9 +2156,8 @@ public void OnSpringActivated(Vector2 force, bool keepSpeedX, bool keepSpeedY)
externalForceY = 0f;
}

SetPlayerTransition(AnimState.Dash | AnimState.Jump, true, true, SpecialMoveType.None);
// ToDo: ...
controllableTimeout = 20f;
SetPlayerTransition(AnimState.Dash | AnimState.Jump, true, false, SpecialMoveType.None);
controllableTimeout = 2f;
} else if (MathF.Abs(force.Y) > 0f) {
copterFramesLeft = 0f;
speedY = (4 + MathF.Abs(force.Y)) * sign;
Expand Down

0 comments on commit 64fcf5b

Please sign in to comment.