mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-25 22:12:58 +01:00
Chem Cartridge Spawning Search (#12092)
This commit is contained in:
@@ -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."
|
||||
Reference in New Issue
Block a user