-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve the behavior of death planes (#257)
* Add ObjectScript for death planes * Fix size of death barrier objects * Switch death plane to use SmashAsync * Add initial water death plane script * Switch smasher for death planes to death plane * Remove comment in DeathPlane * Merge and improve object script loading for LuaScriptComponent and custom scripts. * Add player fall death script. * Move death plane scripts. * Add death (teleport) plane for properties. * Correct player sphere physics to be at center instead of bottom. (Fix Portabello waters being too high) * Disable check for hasCustomClientScript * Disable fallback, replace FV death plane objectscript with nativescript * Reformatting * Add CapsuleBody (for cylinders) Fixes NT big assembly teleporters * Capsule-sphere collision test * Clean up some code * Replace client script names with server ones * Run native DeathPlane script in multiple worlds * Move PrimitiveModel cube origins from center to bottom * Fix scripts linked to client script names * Correctly split PATH env variable on *nix systems * Apply binoculars script to all binoculars * Always give all rewards for achievements * Fix for ghost players after dying to death plane * Fix Instantiate when item is not in Objects table * Fix not dying after falling near Tortoise Terrace * Add LOT-specific scripts. Co-authored-by: TheNexusAvenger <[email protected]> Co-authored-by: enteryournamehere <[email protected]>
- Loading branch information
1 parent
c700cbc
commit b5f877a
Showing
25 changed files
with
493 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System.Numerics; | ||
|
||
namespace Uchu.Physics | ||
{ | ||
public class CapsuleBody : PhysicsObject | ||
{ | ||
/// <summary> | ||
/// Value used to determine the order in which objects are passed to the collision detection functions. | ||
/// </summary> | ||
public override int CollisionPrecedence { get; } = 2; | ||
|
||
/// <summary> | ||
/// Creates a capsule body. | ||
/// </summary> | ||
/// <param name="simulation">The simulation to use.</param> | ||
public CapsuleBody(PhysicsSimulation simulation) : base(simulation) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Creates a capsule body. | ||
/// </summary> | ||
/// <param name="simulation">The simulation to use.</param> | ||
/// <param name="position">The position of the body.</param> | ||
/// <param name="rotation">The rotation of the body.</param> | ||
/// <param name="radius">The radius of the capsule.</param> | ||
/// <param name="height">The height of the cylinder part of the capsule.</param> | ||
/// <returns>The capsule body that was created.</returns> | ||
public static CapsuleBody Create(PhysicsSimulation simulation, Vector3 position, Quaternion rotation, | ||
float radius, float height) | ||
{ | ||
var obj = new CapsuleBody(simulation); | ||
obj.Position = position; | ||
obj.Rotation = rotation; | ||
obj.Radius = radius; | ||
obj.Height = height; | ||
simulation.Register(obj); | ||
return obj; | ||
} | ||
|
||
/// <summary> | ||
/// Radius of the capsule. | ||
/// </summary> | ||
public float Radius; | ||
|
||
/// <summary> | ||
/// Height of the cylinder part of the capsule. | ||
/// </summary> | ||
public float Height; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System.Threading.Tasks; | ||
using Uchu.World; | ||
using Uchu.World.Scripting.Native; | ||
|
||
namespace Uchu.StandardScripts.General.DeathPlane | ||
{ | ||
/// <summary> | ||
/// Native implementation of scripts/ai/act/l_act_player_death_trigger.lua | ||
/// </summary> | ||
[ScriptName("l_act_player_death_trigger.lua")] | ||
public class DeathPlane : ObjectScript | ||
{ | ||
/// <summary> | ||
/// Creates the object script. | ||
/// </summary> | ||
/// <param name="gameObject">Game object to control with the script.</param> | ||
public DeathPlane(GameObject gameObject) : base(gameObject) | ||
{ | ||
var physics = gameObject.GetComponent<PhysicsComponent>(); | ||
if (physics == default) return; | ||
Listen(physics.OnEnter, other => | ||
{ | ||
if (!(other.GameObject is Player player)) return; | ||
Task.Run(async () => | ||
{ | ||
await player.GetComponent<DestructibleComponent>().SmashAsync(gameObject); | ||
}); | ||
}); | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
Uchu.StandardScripts/General/DeathPlane/PlayerFallDeath.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System.Threading.Tasks; | ||
using Uchu.World; | ||
using Uchu.World.Scripting.Native; | ||
|
||
namespace Uchu.StandardScripts.General.DeathPlane | ||
{ | ||
/// <summary> | ||
/// Native implementation of scripts/ai/gf/l_player_fall_death.lua | ||
/// </summary> | ||
[ScriptName("l_player_fall_death.lua")] | ||
public class PlayerFallDeath : ObjectScript | ||
{ | ||
/// <summary> | ||
/// Creates the object script. | ||
/// </summary> | ||
/// <param name="gameObject">Game object to control with the script.</param> | ||
public PlayerFallDeath(GameObject gameObject) : base(gameObject) | ||
{ | ||
var physics = gameObject.GetComponent<PhysicsComponent>(); | ||
if (physics == default) return; | ||
Listen(physics.OnEnter, other => | ||
{ | ||
if (!(other.GameObject is Player player)) return; | ||
Task.Run(async () => | ||
{ | ||
await Task.Delay(2000); | ||
await player.GetComponent<DestructibleComponent>().SmashAsync(gameObject); | ||
}); | ||
}); | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
Uchu.StandardScripts/General/DeathPlane/PropertyDeathPlane.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Uchu.World; | ||
using Uchu.World.Scripting.Native; | ||
|
||
namespace Uchu.StandardScripts.General.DeathPlane | ||
{ | ||
/// <summary> | ||
/// Native implementation of scripts/ai/ns/ns_pp_01/l_ns_pp_01_teleport.lua | ||
/// </summary> | ||
[ScriptName("l_ns_pp_01_teleport.lua")] | ||
public class PropertyDeathPlane : ObjectScript | ||
{ | ||
/// <summary> | ||
/// Creates the object script. | ||
/// </summary> | ||
/// <param name="gameObject">Game object to control with the script.</param> | ||
public PropertyDeathPlane(GameObject gameObject) : base(gameObject) | ||
{ | ||
var physics = gameObject.GetComponent<PhysicsComponent>(); | ||
if (physics == default) return; | ||
Listen(physics.OnEnter, other => | ||
{ | ||
if (!(other.GameObject is Player player)) return; | ||
var teleportObject = this.GetGroup("Teleport")[0]; | ||
player.Teleport(teleportObject.Transform.Position, ignore: false); | ||
}); | ||
} | ||
} | ||
} |
Oops, something went wrong.