Thank you for your interest in contributing to Nitrox Unlocked! This guide will help you get started with development, understand our standards, and submit your contributions.
// ✅ Good: Clear, concise, follows conventionspublic class PlayerMovementHandler{ private readonly IPacketSender packetSender; public PlayerMovementHandler(IPacketSender packetSender) { this.packetSender = packetSender; } public void SendMovementUpdate(Vector3 position, Quaternion rotation) { packetSender.Send(new PlayerMovement(position, rotation)); }}// ❌ Bad: Over-commented, verbosepublic class PlayerMovementHandler{ // This is the packet sender that we use to send packets private readonly IPacketSender packetSender; /// <summary> /// Constructor that initializes the packet sender /// </summary> /// <param name="packetSender">The packet sender to use</param> public PlayerMovementHandler(IPacketSender packetSender) { // Set the packet sender field to the provided value this.packetSender = packetSender; } // This method sends a movement update to the server public void SendMovementUpdate(Vector3 position, Quaternion rotation) { // Create a new player movement packet PlayerMovement packet = new PlayerMovement(position, rotation); // Send the packet using the packet sender packetSender.Send(packet); }}
/// <summary>/// Prevents the Aurora explosion from triggering when a player is in creative mode,/// as it would desync the timeline for other players still in survival mode./// </summary>public static bool Prefix(AuroraExplosion __instance){ return !localPlayer.IsCreativeMode;}
/// <summary>/// This method is a prefix patch for the AuroraExplosion class./// It checks if the local player is in creative mode./// If they are, it returns false to skip the original method./// </summary>public static bool Prefix(AuroraExplosion __instance){ // Check if player is in creative mode bool isCreative = localPlayer.IsCreativeMode; // Return the opposite return !isCreative;}
Key principle: Explain WHY, not WHAT. The code itself shows what it does.
Harmony patches should have comments explaining the purpose:
namespace NitroxPatcher.Patches.Dynamic;/// <summary>/// Synchronizes base piece deconstruction across all players./// Uses transpiler to inject packet sending at precise points in the deconstruction flow./// </summary>public sealed partial class BaseDeconstructable_Deconstruct_Patch : NitroxPatch, IDynamicPatch{ // Implementation...}
Keep PR descriptions concise. We don’t have resources to read 50 paragraphs explaining why you changed 5 lines of code. Only elaborate if the purpose isn’t obvious.
Good PR description:
## SummaryAdds synchronization for storage container contents when items are added/removed.Fixes #123## Changes- Added StorageContainerSync packet- Patched ItemsContainer.AddItem and RemoveItem- Server broadcasts changes to other players## TestingTested with multiple players adding/removing items from lockers simultaneously.
Bad PR description (too verbose):
## IntroductionI noticed that when I was playing with my friend, the storage containers...[47 more paragraphs explaining the entire history of the bug and your thought process]
// ❌ AI-generated code with excessive comments and unnecessary complexity/// <summary>/// This interface represents a factory that creates instances of player objects/// in the multiplayer environment. It provides a abstraction layer for player/// creation that allows for dependency injection and testability./// </summary>public interface IPlayerFactory{ /// <summary> /// Creates a new player instance with the specified parameters. /// </summary> /// <param name="id">The unique identifier for the player</param> /// <param name="name">The display name of the player</param> /// <returns>A new instance of the Player class</returns> Player CreatePlayer(ushort id, string name);}// Just do this instead:public interface IPlayerFactory{ Player CreatePlayer(ushort id, string name);}
This project is a modified version of the original Nitrox mod. It is not affiliated with or supported by the official Nitrox team. Use at your own risk.
Official Nitrox support is not responsible for helping with this version. All support should be directed to this project’s community channels.
Your contributions help make Nitrox Unlocked better for everyone. Whether it’s code, documentation, bug reports, or community support, every contribution matters.If you found this project helpful, please give it a star on GitHub! ⭐