Some buildmode additions, fixes (#52249)

* Adds outfit buildmode mode

* Adds a delete mode, makes copy compatible with humans

* comment fix

* AIstatus

* Tick the files, dummy

* none of that

* Some more copy restrictions

* Apply suggestions from code review

Co-authored-by: Rohesie <rohesie@gmail.com>

* Apply suggestions from code review

Co-authored-by: Rohesie <rohesie@gmail.com>

Co-authored-by: Rohesie <rohesie@gmail.com>
This commit is contained in:
skoglol
2020-07-20 18:16:37 -03:00
committed by GitHub
co-authored by Rohesie
parent 948e2cc7b8
commit d0df1a875c
6 changed files with 122 additions and 6 deletions
+62
View File
@@ -0,0 +1,62 @@
/datum/buildmode_mode/delete
key = "delete"
/datum/buildmode_mode/delete/show_help(client/c)
to_chat(c, "<span class='notice'>***********************************************************\n\
Left Mouse Button on anything to delete it. If you break it, you buy it.\n\
Right Mouse Button on anything to delete everything of the type. Probably don\'t do this unless you know what you are doing.\n\
***********************************************************</span>")
/datum/buildmode_mode/delete/handle_click(client/c, params, object)
var/list/pa = params2list(params)
var/left_click = pa.Find("left")
var/right_click = pa.Find("right")
if(left_click)
if(isturf(object))
var/turf/T = object
T.ScrapeAway(flags = CHANGETURF_INHERIT_AIR)
else if(isatom(object))
qdel(object)
if(right_click)
if(check_rights(R_DEBUG|R_SERVER)) //Prevents buildmoded non-admins from breaking everything.
if(isturf(object))
return
var/atom/deleting = object
var/action_type = alert("Strict type ([deleting.type]) or type and all subtypes?",,"Strict type","Type and subtypes","Cancel")
if(action_type == "Cancel" || !action_type)
return
if(alert("Are you really sure you want to delete all instances of type [deleting.type]?",,"Yes","No") != "Yes")
return
if(alert("Second confirmation required. Delete?",,"Yes","No") != "Yes")
return
var/O_type = deleting.type
switch(action_type)
if("Strict type")
var/i = 0
for(var/atom/Obj in world)
if(Obj.type == O_type)
i++
qdel(Obj)
CHECK_TICK
if(!i)
to_chat(usr, "No instances of this type exist")
return
log_admin("[key_name(usr)] deleted all instances of type [O_type] ([i] instances deleted) ")
message_admins("<span class='notice'>[key_name(usr)] deleted all instances of type [O_type] ([i] instances deleted) </span>")
if("Type and subtypes")
var/i = 0
for(var/Obj in world)
if(istype(Obj,O_type))
i++
qdel(Obj)
CHECK_TICK
if(!i)
to_chat(usr, "No instances of this type exist")
return
log_admin("[key_name(usr)] deleted all instances of type or subtype of [O_type] ([i] instances deleted) ")
message_admins("<span class='notice'>[key_name(usr)] deleted all instances of type or subtype of [O_type] ([i] instances deleted) </span>")
+44
View File
@@ -0,0 +1,44 @@
/datum/buildmode_mode/outfit
key = "outfit"
var/datum/outfit/dressuptime
/datum/buildmode_mode/outfit/Destroy()
dressuptime = null
return ..()
/datum/buildmode_mode/outfit/show_help(client/c)
to_chat(c, "<span class='notice'>***********************************************************\n\
Right Mouse Button on buildmode button = Select outfit to equip.\n\
Left Mouse Button on mob/living/carbon/human = Equip the selected outfit.\n\
Right Mouse Button on mob/living/carbon/human = Strip and delete current outfit.\n\
***********************************************************</span>")
/datum/buildmode_mode/outfit/Reset()
. = ..()
dressuptime = null
/datum/buildmode_mode/outfit/change_settings(client/c)
dressuptime = c.robust_dress_shop()
/datum/buildmode_mode/outfit/handle_click(client/c, params, object)
var/list/pa = params2list(params)
var/left_click = pa.Find("left")
var/right_click = pa.Find("right")
if(!ishuman(object))
return
var/mob/living/carbon/human/dollie = object
if(left_click)
if(isnull(dressuptime))
to_chat(c, "<span class='warning'>Pick an outfit first.</span>")
return
for (var/item in dollie.get_equipped_items(TRUE))
qdel(item)
if(dressuptime != "Naked")
dollie.equipOutfit(dressuptime)
if(right_click)
for (var/item in dollie.get_equipped_items(TRUE))
qdel(item)