Skip to content

A hardcore server

Rules that make every life count:

Rule Hook
Half the resources from every node, tree and carcass OnGather
No bag on death: the inventory is lost CanDropDeathBag
Players can always hurt each other, even with rl_pvp 0 CanTakeDamage
No crafting of Explosive Charges CanCraft
  1. Return half the amount from OnGather. A hit often gives a single resource, so keep each player’s odd half and give it on their next hit: halving 1 would otherwise give 0 or, rounded up, 1.
  2. Return false from CanDropDeathBag.
  3. In CanTakeDamage, return true when the attacker is a player. Return null otherwise: animals and falls follow the game’s rules.
  4. In CanCraft, refuse the items of a list and tell the player why.
using RustLegacy;
public class Hardcore : RustPlugin
{
public override string Description => "Hardcore: half gathering, inventory lost on death, PvP always on, no explosives crafting.";
/// <summary>Each player's half resource left over, given with their next hit (SteamID → 0 or 1).</summary>
Dictionary<string, int> _carry = new Dictionary<string, int>();
public override int? OnGather( RustPlayer player, ItemDefinition item, int amount )
{
var total = amount + (_carry.ContainsKey( player.SteamId ) ? _carry[player.SteamId] : 0);
_carry[player.SteamId] = total % 2;
return total / 2;
}
public override bool? CanDropDeathBag( RustPlayer player ) => false;
public override bool? CanTakeDamage( RustPlayer victim, RustLegacy.DamageInfo info )
{
var attacker = info.Attacker != null ? info.Attacker.Components.GetInAncestorsOrSelf<RustPlayer>() : null;
return attacker != null && attacker != victim ? true : null;
}
public override bool? CanCraft( RustPlayer player, ItemDefinition item, int amount )
{
if ( item.Title != "Explosive Charge" ) return null;
player.Notify( "No explosives crafting on this server." );
return false;
}
}

Write the rules where players see them before they join: in the server’s name or description, and in a welcome window (ServerInfo.cs).