// Title: Multi-Key Utility
// Credit to: CaptFalcon33035;
// Crashed (for showing my redundancy in islist()
// Contributed by: CaptFalcon33035

This is just a little utility to prevent multikeying between
users. The host may be excused if excuse_host is set to 1.
I wrote it when Axerob showed me his procedure for preventing
multikeying because it looped through every mob (we all know
fangames have a zillion mobs) and constantly checked all
variables through each increment.

This saves the creation of a client and mob if the user is
multikeying. It does not execute the loop if a number of
conditionals are met:
if there is no address or can_multikey is true
if the person is the host and excuse_host is true

Both variables are toggleable so the value can be changed
on runtime.

#define islist(n) istype(n, /list)

var/can_multikey = 0
var/excuse_host = 1

if(!address || can_multikey) return 0
if(excuse_host && isHost(address)) return 0

for(var/client/C) if(C.address==address) return 1
return 0

if(!address || world.address == address || address == "")
return 1
return 0

world/IsBanned(key, address)
if(!islist(.) && multikey_check(address))
. = list()
.["Login"] = 0
.["desc"] = "You can't log into two keys at once. If you \
wish to join, please log out of your other active key."