Chem Cartridge Spawning Search (#12092)

This commit is contained in:
Doxxmedearly
2021-06-26 16:13:59 -03:00
committed by GitHub
parent 5f2df1d722
commit 2ce46d3b8d
2 changed files with 28 additions and 2 deletions
@@ -1,7 +1,27 @@
/client/proc/spawn_chemdisp_cartridge(size in list("small", "medium", "large"), reagent in decls_repository.get_decls_of_subtype(/decl/reagent/))
/client/proc/spawn_chemdisp_cartridge(size in list("small", "medium", "large"))
set name = "Spawn Chemical Dispenser Cartridge"
set category = "Admin"
var/rtype = input("Enter full or partial reagent path.", "Reagent Search") as text
if(!rtype)
return
var/list/matches
for(var/path in decls_repository.get_decls_of_subtype(/decl/reagent/))
if(findtext("[path]", rtype))
LAZYADD(matches, path)
var/reagent
if(!LAZYLEN(matches))
return
if(LAZYLEN(matches) == 1)
reagent = matches[1]
else
reagent = input("Select a reagent type", "Pick reagent", matches[1]) as null|anything in matches
if(!reagent)
return
var/obj/item/reagent_containers/chem_disp_cartridge/C
switch(size)
if("small") C = new /obj/item/reagent_containers/chem_disp_cartridge/small(usr.loc)
@@ -10,4 +30,4 @@
C.reagents.add_reagent(reagent, C.volume)
var/decl/reagent/R = decls_repository.get_decl(reagent)
C.setLabel(R.name)
log_admin("[key_name(usr)] spawned a [size] reagent container containing [reagent] at ([usr.x],[usr.y],[usr.z])",admin_key=key_name(usr))
log_admin("[key_name(usr)] spawned a [size] reagent container containing [reagent] at ([usr.x],[usr.y],[usr.z])",admin_key=key_name(usr))
@@ -0,0 +1,6 @@
author: Doxxmedearly
delete-after: True
changes:
- tweak: "Spawning a chemical dispenser cartridge as an admin now uses a search function similar to how the spawn verb works."