[MIRROR] Allows admins to spawn mob-like objects for shenanigans (#5825)
* Allows admins to spawn mob-like objects for shenanigans (#36153) This is basically extracting the functionality of the animation spell into an admin verb. Please excuse the browser.dm code, this is more of a stepping stone towards the more complicated popup needed for custom ERTs. cl Naksu admin: Admins can now easily spawn mobs that look like objects. Googly eyes optional! /cl * Allows admins to spawn mob-like objects for shenanigans
This commit is contained in:
committed by
Poojawa
parent
811b188742
commit
d95be2e261
@@ -305,6 +305,88 @@
|
||||
else
|
||||
return
|
||||
|
||||
/datum/browser/modal/preflikepicker
|
||||
var/settings = list()
|
||||
var/icon/preview_icon = null
|
||||
|
||||
/datum/browser/modal/preflikepicker/New(User,Message,Title,Button1="Ok",Button2,Button3,StealFocus = 1, Timeout = FALSE,list/settings,inputtype="checkbox", width = 400, height, slidecolor)
|
||||
if (!User)
|
||||
return
|
||||
src.settings = settings
|
||||
|
||||
..(User, ckey("[User]-[Message]-[Title]-[world.time]-[rand(1,10000)]"), Title, width, height, src, StealFocus, Timeout)
|
||||
set_content(ShowChoices(User))
|
||||
|
||||
/datum/browser/modal/preflikepicker/proc/ShowChoices(mob/user)
|
||||
var/dat = ""
|
||||
|
||||
for (var/name in settings["mainsettings"])
|
||||
var/setting = settings["mainsettings"][name]
|
||||
if (setting["type"] == "datum")
|
||||
dat += "<b>[setting["desc"]]:</b> <a href='?src=[REF(src)];setting=[name];task=input;type=datum;path=[setting["path"]]'>[setting["value"]]</a><BR>"
|
||||
else
|
||||
dat += "<b>[setting["desc"]]:</b> <a href='?src=[REF(src)];setting=[name];task=input;type=[setting["type"]]'>[setting["value"]]</a><BR>"
|
||||
|
||||
if (preview_icon)
|
||||
dat += "<td valign='center'>"
|
||||
|
||||
dat += "<div class='statusDisplay'><center><img src=previewicon.png width=[preview_icon.Width()] height=[preview_icon.Height()]></center></div>"
|
||||
|
||||
dat += "</td>"
|
||||
|
||||
dat += "</tr></table>"
|
||||
|
||||
dat += "<hr><center><a href='?src=[REF(src)];button=1'>Ok</a> "
|
||||
|
||||
dat += "</center>"
|
||||
|
||||
return dat
|
||||
|
||||
/datum/browser/modal/preflikepicker/Topic(href,href_list)
|
||||
if (href_list["close"] || !user || !user.client)
|
||||
opentime = 0
|
||||
return
|
||||
if (href_list["task"] == "input")
|
||||
var/setting = href_list["setting"]
|
||||
switch (href_list["type"])
|
||||
if ("datum")
|
||||
settings["mainsettings"][setting]["value"] = pick_closest_path(null, make_types_fancy(typesof(text2path(href_list["path"]))))
|
||||
if ("string")
|
||||
settings["mainsettings"][setting]["value"] = stripped_input(user, "Enter new value for [settings["mainsettings"][setting]["desc"]]", "Enter new value for [settings["mainsettings"][setting]["desc"]]")
|
||||
if ("number")
|
||||
settings["mainsettings"][setting]["value"] = input(user, "Enter new value for [settings["mainsettings"][setting]["desc"]]", "Enter new value for [settings["mainsettings"][setting]["desc"]]") as num
|
||||
if ("boolean")
|
||||
settings["mainsettings"][setting]["value"] = input(user, "[settings["mainsettings"][setting]["desc"]]?") in list("Yes","No")
|
||||
if ("ckey")
|
||||
settings["mainsettings"][setting]["value"] = input(user, "[settings["mainsettings"][setting]["desc"]]?") in list("none") + GLOB.directory
|
||||
if (href_list["button"])
|
||||
var/button = text2num(href_list["button"])
|
||||
if (button <= 3 && button >= 1)
|
||||
selectedbutton = button
|
||||
if (selectedbutton != 1)
|
||||
set_content(ShowChoices(user))
|
||||
open()
|
||||
return
|
||||
for (var/item in href_list)
|
||||
switch(item)
|
||||
if ("close", "button", "src")
|
||||
continue
|
||||
opentime = 0
|
||||
close()
|
||||
|
||||
/proc/presentpreflikepicker(var/mob/User,Message, Title, Button1="Ok", Button2, Button3, StealFocus = 1,Timeout = 6000,list/settings, width, height, slidecolor)
|
||||
if (!istype(User))
|
||||
if (istype(User, /client/))
|
||||
var/client/C = User
|
||||
User = C.mob
|
||||
else
|
||||
return
|
||||
var/datum/browser/modal/preflikepicker/A = new(User, Message, Title, Button1, Button2, Button3, StealFocus,Timeout, settings, width, height, slidecolor)
|
||||
A.open()
|
||||
A.wait()
|
||||
if (A.selectedbutton)
|
||||
return list("button" = A.selectedbutton, "settings" = A.settings)
|
||||
|
||||
// This will allow you to show an icon in the browse window
|
||||
// This is added to mob so that it can be used without a reference to the browser object
|
||||
// There is probably a better place for this...
|
||||
|
||||
Reference in New Issue
Block a user