mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 05:00:55 +01:00
verb macro system (pr 1/3) (#96720)
## About The Pull Request just macro-izes all the usages of verbs in the codebase as a pre-requisite to my follow up pr that serializes all the verbs arguments so we can tgui-ify the command bar, so we can then put it on the onscreen map. this also basically does the same as #94487 so can easily be integrated into the verb queueing stuff... but does not actually do any verb queueing by itself. basically im just trying to be https://github.com/tgstation/tgstation/labels/Atomic ## Why It's Good For The Game it doesn't really do anything by itself but it does let us do more stuff ## Changelog 🆑 code: the backend to all verbs in the game has been played with, please report any issues to github /🆑 --------- Co-authored-by: harryob <55142896+harryob@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
SUBSYSTEM_DEF(verbs)
|
||||
name = "Verbs"
|
||||
ss_flags = SS_NO_FIRE
|
||||
init_stage = INITSTAGE_EARLY
|
||||
var/list/datum/verb_metadata/verbs_by_type = list()
|
||||
|
||||
/datum/controller/subsystem/verbs/Initialize()
|
||||
for(var/datum/verb_metadata/verb_type as anything in subtypesof(/datum/verb_metadata))
|
||||
verbs_by_type[verb_type] = new verb_type
|
||||
return SS_INIT_SUCCESS
|
||||
|
||||
/datum/controller/subsystem/verbs/proc/invoke(target, datum/verb_metadata/verb_type, ...)
|
||||
var/datum/verb_metadata/meta = verbs_by_type[verb_type]
|
||||
if(isnull(meta))
|
||||
CRASH("Attempted to invoke unknown verb '[verb_type]'.")
|
||||
var/list/invoke_args = args.Copy(3)
|
||||
call(target, meta.body_path)(arglist(invoke_args))
|
||||
|
||||
/datum/controller/subsystem/verbs/proc/assign_verb(target, datum/verb_metadata/verb_type)
|
||||
var/datum/verb_metadata/meta = verbs_by_type[verb_type]
|
||||
if(isnull(meta))
|
||||
CRASH("Attempted to assign unknown verb '[verb_type]'.")
|
||||
meta.assign_to(target)
|
||||
|
||||
/datum/controller/subsystem/verbs/proc/unassign_verb(target, datum/verb_metadata/verb_type)
|
||||
var/datum/verb_metadata/meta = verbs_by_type[verb_type]
|
||||
if(isnull(meta))
|
||||
CRASH("Attempted to unassign unknown verb '[verb_type]'.")
|
||||
meta.unassign_from(target)
|
||||
@@ -441,9 +441,7 @@ SUBSYSTEM_DEF(vote)
|
||||
voting -= user.client?.ckey
|
||||
|
||||
/// Mob level verb that allows players to vote on the current vote.
|
||||
/mob/verb/vote()
|
||||
set category = "OOC"
|
||||
set name = "Vote"
|
||||
GAME_VERB(/mob, vote, "Vote", "OOC")
|
||||
|
||||
if(!SSvote.initialized)
|
||||
to_chat(usr, span_notice("<i>Voting is not set up yet!</i>"))
|
||||
|
||||
Reference in New Issue
Block a user