CanChangeCode not being called when setting initial code
I am trying to prevent immune players from changing existing codes by returning a non-null value, but it seems there is a bug if we're setting the code for the first time, or am I missing something?

https://streamable.com/pgfpqx

private object CanChangeCode(BasePlayer player, CodeLock codeLock, string newCode)
{
    if (immune.Contains(player))
    {
        player.ChatMessage("<color=red>You cannot change codes while you are immune!</color>");
        player.ChatMessage($"(DEBUG) New code: {newCode}");
        return false;
    }
    return null;
}​
Thisha mentioned this hook wasn't working while they were implementing the minicopter lock plugin so this is probably what they meant. Setting the code the first time is probably not using the same RPC call. I recommend trying the other locking related hooks to see if they are firing. If not, we can look into adding a new one for this.
Since the codelock must be unlocked to be able to change the code this line fixes the problem
codeLock.SetFlag(BaseEntity.Flags.Locked, false);​