Skip to content

Nexus Tower Scripts #272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 40 commits into from
Aug 16, 2021
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
7e587a4
Fix teleport GM rotation
enteryournamehere Jul 22, 2021
bc22bde
Paradox teleporters
enteryournamehere Jul 22, 2021
11c39f3
Assembly tubes
enteryournamehere Jul 22, 2021
475713f
Sentinel speed pads
enteryournamehere Jul 22, 2021
bdfcd5c
Sentinel area interaction things
enteryournamehere Jul 22, 2021
97e17a8
Venture cannon
enteryournamehere Jul 22, 2021
033cc9b
Venture League speed boost things
enteryournamehere Jul 22, 2021
3d0287f
Merge branch 'dev' of github.com:UchuServer/Uchu into enhancement/nex…
enteryournamehere Jul 23, 2021
4d6e746
Merge with dev (struct packets)
enteryournamehere Jul 25, 2021
b0381cd
Resolve conflicts
enteryournamehere Jul 25, 2021
2c3e5ed
Improve teleporters
enteryournamehere Jul 25, 2021
eb60349
Terminate interactions
enteryournamehere Jul 25, 2021
3caf92c
Darkitect cinematic script
enteryournamehere Jul 25, 2021
c2cc170
Paradox power panels
enteryournamehere Jul 25, 2021
d319460
Sentinel X-ray script (only does glowing effect)
enteryournamehere Jul 26, 2021
6db265e
Add some comments
enteryournamehere Jul 26, 2021
291acbf
Fix formatting
enteryournamehere Jul 28, 2021
d67c0ec
Merge branch 'dev' of github.com:UchuServer/Uchu into enhancement/nex…
enteryournamehere Jul 29, 2021
6347ed7
Combat Challenge
enteryournamehere Jul 30, 2021
c401cf0
NT world teleporters
enteryournamehere Jul 30, 2021
10ce166
Wishing Well + multiple ScriptName attributes
enteryournamehere Jul 30, 2021
dde053c
Ensure player has enough maelstrom infected bricks
enteryournamehere Jul 30, 2021
a3322a0
Replace insane code, support nested dictionaries.
enteryournamehere Jul 31, 2021
6af0f37
More world teleporters
enteryournamehere Jul 31, 2021
a8bd8b0
l_wild_ambients and l_wild_ambient_crab scripts
enteryournamehere Jul 31, 2021
14a9778
Fix NT portal to LEGO® Club world
enteryournamehere Jul 31, 2021
d08033a
Move OnMessageBoxRespond to associated GameObject
enteryournamehere Jul 31, 2021
2b1f580
Combat challenge: progress mission 1010
enteryournamehere Jul 31, 2021
50c556a
Spawn targets in the correct orientation
enteryournamehere Jul 31, 2021
eded330
Make scripts progress misison 1047
enteryournamehere Jul 31, 2021
cc03f37
Improve fountain drops
enteryournamehere Jul 31, 2021
45b1cbf
Merge branch 'dev' of github.com:UchuServer/Uchu into enhancement/nex…
enteryournamehere Jul 31, 2021
4138791
Maelstrom orb: set flag 1911
enteryournamehere Jul 31, 2021
2357f39
Speedy Traveler achievement
enteryournamehere Aug 1, 2021
2c2469d
Fix combat challenge targets not being destroyed
enteryournamehere Aug 1, 2021
f7a063d
possibly/hopefully fix combat challenge issues
enteryournamehere Aug 8, 2021
155b172
Handle some possible errors
enteryournamehere Aug 11, 2021
91deca4
Use GetGroup method
enteryournamehere Aug 16, 2021
f2ea0a9
Formatting
enteryournamehere Aug 16, 2021
aef2e96
Avoid possible null reference exception
enteryournamehere Aug 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions Uchu.StandardScripts/NexusTower/ArmorSpawner.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System.Numerics;
using Uchu.World;
using Uchu.World.Scripting.Native;

namespace Uchu.StandardScripts.NexusTower
{
[ScriptName("ScriptComponent_1535_script_name__removed")]
public class ArmorSpawner : ObjectScript
{
private const int ArmorCount = 3;

/// <summary>
/// Creates the object script.
/// </summary>
/// <param name="gameObject">Game object to control with the script.</param>
public ArmorSpawner(GameObject gameObject) : base(gameObject)
{
Listen(gameObject.OnInteract, player => {
// Drop armor
for (var i = 0; i < ArmorCount; i++)
{
var loot = InstancingUtilities.InstantiateLoot(Lot.ThreeArmor,
player, gameObject, gameObject.Transform.Position + Vector3.UnitY * 3);
Start(loot);
}

// Terminate interaction so the player can interact again.
player.Message(new TerminateInteractionMessage
{
Associate = player,
Terminator = gameObject,
Type = TerminateType.FromInteraction,
});
});
}
}
}
71 changes: 71 additions & 0 deletions Uchu.StandardScripts/NexusTower/AssemblyTube.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
using System.Linq;
using System.Threading.Tasks;
using InfectedRose.Luz;
using Uchu.World;
using Uchu.World.Scripting.Native;

namespace Uchu.StandardScripts.NexusTower
{
[ScriptName("L_NT_ASSEMBLYTUBE_SERVER.lua")]
public class AssemblyTube : ObjectScript
{
/// <summary>
/// Creates the object script.
/// </summary>
/// <param name="gameObject">Game object to control with the script.</param>
public AssemblyTube(GameObject gameObject) : base(gameObject)
{
// Get info from object settings
var group = (string) gameObject.Settings["teleGroup"];
var cinematic = (string) gameObject.Settings["Cinematic"];
var animation = gameObject.Settings.ContainsKey("OverrideAnim")
? (string) gameObject.Settings["OverrideAnim"]
: "tube-sucker";
// nexus-tube-up also exists, don't know where it is used

if (!gameObject.TryGetComponent<PhysicsComponent>(out var phys))
return;

Listen(phys.OnEnter, other =>
{
// Should only teleport players
if (!(other.GameObject is Player player))
return;

// Find teleporter target location
var target = Zone.GameObjects.FirstOrDefault(obj =>
obj.Settings.TryGetValue("groupID", out var group2)
&& ((string) group2).Split(";").Contains(group));

if (target == null)
return;

// Show camera path. Lock player so animation can't be canceled.
player.Message(new PlayCinematicMessage
{
Associate = player,
LockPlayer = true,
PathName = cinematic,
LeadIn = 0.5f,
});

player.Animate(animation);

// Default time in case camera path can't be found in luz file
var time = 5f;
// Find total camera path (cinematic) duration
if (Zone.ZoneInfo.LuzFile.PathData.FirstOrDefault(p =>
p is LuzCameraPath && p.PathName == cinematic) is LuzCameraPath cameraPath)
time = cameraPath.Waypoints.Sum(point => ((LuzCameraWaypoint) point).Time);

// At the end of the cinematic, rebuild the player at the target location
Task.Run(async () =>
{
await Task.Delay((int) (time * 1000) + 0);
player.Teleport(target.Transform.Position);
player.Animate("tube-resurrect");
});
});
}
}
}
37 changes: 37 additions & 0 deletions Uchu.StandardScripts/NexusTower/DarkitectReveal.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Uchu.World;
using Uchu.World.Scripting.Native;

namespace Uchu.StandardScripts.NexusTower
{
[ScriptName("ScriptComponent_1556_script_name__removed")]
public class DarkitectReveal : ObjectScript
{
/// <summary>
/// Creates the object script.
/// </summary>
/// <param name="gameObject">Game object to control with the script.</param>
public DarkitectReveal(GameObject gameObject) : base(gameObject)
{
// Listen for players interacting with this object
Listen(gameObject.OnInteract, player =>
{
// The client script will handle everything after it receives this message.
player.Message(new NotifyClientObjectMessage
{
Name = "reveal",
ParamObj = player,
Associate = gameObject,
});

Zone.Schedule(() =>
{
// Set player's health to 1, as shown in the cinematic.
// Wait 2 seconds before doing this to ensure it won't be visible before the cinematic starts.
var stats = player.GetComponent<DestroyableComponent>();
stats.Health = 1;
stats.Armor = 0;
}, 2000);
});
}
}
}
37 changes: 37 additions & 0 deletions Uchu.StandardScripts/NexusTower/HealthSpawner.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System.Numerics;
using Uchu.World;
using Uchu.World.Scripting.Native;

namespace Uchu.StandardScripts.NexusTower
{
[ScriptName("ScriptComponent_1534_script_name__removed")]
public class HealthSpawner : ObjectScript
{
private const int HealthCount = 3;

/// <summary>
/// Creates the object script.
/// </summary>
/// <param name="gameObject">Game object to control with the script.</param>
public HealthSpawner(GameObject gameObject) : base(gameObject)
{
Listen(gameObject.OnInteract, player => {
// Drop health
for (var i = 0; i < HealthCount; i++)
{
var loot = InstancingUtilities.InstantiateLoot(Lot.ThreeHealth,
player, gameObject, gameObject.Transform.Position + Vector3.UnitY * 3);
Start(loot);
}

// Terminate interaction so the player can interact again.
player.Message(new TerminateInteractionMessage
{
Associate = player,
Terminator = gameObject,
Type = TerminateType.FromInteraction,
});
});
}
}
}
32 changes: 32 additions & 0 deletions Uchu.StandardScripts/NexusTower/MaelstromConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Uchu.World;
using Uchu.World.Scripting.Native;

namespace Uchu.StandardScripts.NexusTower
{
[ScriptName("ScriptComponent_1537_script_name__removed")]
public class MaelstromConverter : ObjectScript
{
/// <summary>
/// Creates the object script.
/// </summary>
/// <param name="gameObject">Game object to control with the script.</param>
public MaelstromConverter(GameObject gameObject) : base(gameObject)
{
Listen(gameObject.OnInteract, player =>
{
// Let the player trade 25 Maelstrom Infected Bricks for 5 faction tokens
var inventory = player.GetComponent<InventoryManagerComponent>();
inventory.RemoveLotAsync(Lot.MaelstromInfectedBrick, 25);
inventory.AddLotAsync(Lot.FactionTokenProxy, 5);

// Terminate interaction so the player can interact again.
player.Message(new TerminateInteractionMessage
{
Associate = player,
Terminator = gameObject,
Type = TerminateType.FromInteraction,
});
});
}
}
}
88 changes: 88 additions & 0 deletions Uchu.StandardScripts/NexusTower/ParadoxTeleporter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
using System.Linq;
using System.Threading.Tasks;
using Uchu.World;
using Uchu.World.Scripting.Native;

namespace Uchu.StandardScripts.NexusTower
{
[ScriptName("L_NT_PARADOXTELE_SERVER.lua")]
public class ParadoxTeleporter : ObjectScript
{
/// <summary>
/// Creates the object script.
/// </summary>
/// <param name="gameObject">Game object to control with the script.</param>
public ParadoxTeleporter(GameObject gameObject) : base(gameObject)
{
// Get info from object settings
var group = (string) gameObject.Settings["teleGroup"];
var cinematic = (string) gameObject.Settings["Cinematic"];

// All these must have a physics component to detect the player entering.
if (!gameObject.TryGetComponent<PhysicsComponent>(out var phys))
return;

Listen(phys.OnEnter, other =>
{
// Should only teleport players.
if (!(other.GameObject is Player player))
return;

// Find teleporter target location.
var target = Zone.GameObjects.FirstOrDefault(obj => obj.Settings.TryGetValue("groupID", out var group2)
&& ((string) group2).Split(";").Contains(group));
if (target == null)
return;

// The player shouldn't be able to move during the animation and the teleportation.
player.Message(new SetStunnedMessage
{
Associate = player,
Originator = gameObject,
StateChangeType = StunState.Push,
CantAttack = true,
CantJump = true,
CantMove = true,
CantTurn = true,
});

// Show teleport animation.
player.Animate("paradoxdeath");
// paradox-teleport-in and nexusteleport also exist, don't know if they're used somewhere else.

// At the end of the cinematic, rebuild the player at the target location.
Task.Run(async () =>
{
// Wait for the animation to complete.
await Task.Delay(2000);

// Teleport player to target location.
player.Teleport(target.Transform.Position);

// Show camera path.
player.Message(new PlayCinematicMessage
{
Associate = player,
LockPlayer = true,
PathName = cinematic,
});

// Un-stun player.
player.Message(new SetStunnedMessage
{
Associate = player,
Originator = gameObject,
StateChangeType = StunState.Pop,
CantAttack = true,
CantJump = true,
CantMove = true,
CantTurn = true,
});

// Show rebuilding animation.
player.Animate("paradox-teleport-in");
});
});
}
}
}
Loading