Files
Bubberstation/code/__DEFINES/client.dm
san7890 8b827f32c9 Clients can't OOC until they have fully gone through New() (#74493)
People are able to send OOC messages before `client/New()` is able to
fully set itself up. Let's guard against this by re-using the variable
we set at the end of New() and blocking any usage of the OOC verb if
they aren't set up. I made it a define so we can use it in other spots
as well if the occasion should call for it.

Define included in this PR can be (and probably should be when someone
has time) replicated in other spots where we need it.
2023-04-05 11:23:15 +12:00

12 lines
704 B
Plaintext

/// Checks if the given target is either a client or a mock client
#define IS_CLIENT_OR_MOCK(target) (istype(target, /client) || istype(target, /datum/client_interface))
/// Ensures that the client has been fully initialized via New(), and can't somehow execute actions before that. Security measure.
/// WILL RETURN OUT OF THE ENTIRE PROC COMPLETELY IF THE CLIENT IS NOT FULLY INITIALIZED. BE WARNED IF YOU WANT RETURN VALUES.
#define VALIDATE_CLIENT(target)\
if (!target.fully_created) {\
to_chat(target, span_warning("You are not fully initialized yet! Please wait a moment."));\
log_access("Client [key_name(target)] attempted to execute a verb before being fully initialized.");\
return\
}