Rewrite examine() to pass a list around

This commit is contained in:
Aronai Sieyes
2020-04-29 16:42:16 -04:00
committed by VirgoBot
parent 8c5c0a7cfb
commit 6ebd249748
214 changed files with 2021 additions and 1120 deletions
+5 -5
View File
@@ -14,16 +14,16 @@
. -= "Off"
/obj/structure/sign/double/barsign/examine(mob/user)
..()
. = ..()
switch(icon_state)
if("Off")
to_chat(user, "It appears to be switched off.")
. += "It appears to be switched off."
if("narsiebistro")
to_chat(user, "It shows a picture of a large black and red being. Spooky!")
. += "It shows a picture of a large black and red being. Spooky!"
if("on", "empty")
to_chat(user, "The lights are on, but there's no picture.")
. += "The lights are on, but there's no picture."
else
to_chat(user, "It says '[icon_state]'")
. += "It says '[icon_state]'"
/obj/structure/sign/double/barsign/New()
..()
+6 -8
View File
@@ -170,16 +170,14 @@ LINEN BINS
/obj/structure/bedsheetbin/examine(mob/user)
..(user)
. = ..()
if(amount < 1)
to_chat(user, "There are no bed sheets in the bin.")
return
if(amount == 1)
to_chat(user, "There is one bed sheet in the bin.")
return
to_chat(user, "There are [amount] bed sheets in the bin.")
. += "There are no bed sheets in the bin."
else if(amount == 1)
. += "There is one bed sheet in the bin."
else
. += "There are [amount] bed sheets in the bin."
/obj/structure/bedsheetbin/update_icon()
switch(amount)
@@ -58,24 +58,25 @@
update_icon()
/obj/structure/closet/examine(mob/user)
if(!src.opened && (..(user, 1) || isobserver(user)))
. = ..()
if(Adjacent(user) || isobserver(user))
var/content_size = 0
for(var/obj/item/I in src.contents)
if(!I.anchored)
content_size += CEILING(I.w_class/2, 1)
if(!content_size)
to_chat(user, "It is empty.")
. += "It is empty."
else if(storage_capacity > content_size*4)
to_chat(user, "It is barely filled.")
. += "It is barely filled."
else if(storage_capacity > content_size*2)
to_chat(user, "It is less than half full.")
. += "It is less than half full."
else if(storage_capacity > content_size)
to_chat(user, "There is still some free space.")
. += "There is still some free space."
else
to_chat(user, "It is full.")
. += "It is full."
if(!src.opened && isobserver(user))
to_chat(user, "It contains: [counting_english_list(contents)]")
. += "It contains: [counting_english_list(contents)]"
/obj/structure/closet/CanPass(atom/movable/mover, turf/target)
if(wall_mounted)
@@ -9,9 +9,9 @@
var/paint_color = "#666666"
/obj/structure/vehiclecage/examine(mob/user)
..()
. = ..()
if(my_vehicle)
to_chat(user, "<span class='notice'>It seems to contain \the [my_vehicle].</span>")
. += "<span class='notice'>It seems to contain \the [my_vehicle].</span>"
/obj/structure/vehiclecage/Initialize()
. = ..()
+181
View File
@@ -1,3 +1,4 @@
<<<<<<< HEAD
//Chain link fences
//Sprites ported from /VG/
@@ -176,4 +177,184 @@
#undef NO_HOLE
#undef MEDIUM_HOLE
#undef LARGE_HOLE
=======
//Chain link fences
//Sprites ported from /VG/
#define CUT_TIME 10 SECONDS
#define CLIMB_TIME 5 SECONDS
#define NO_HOLE 0 //section is intact
#define MEDIUM_HOLE 1 //medium hole in the section - can climb through
#define LARGE_HOLE 2 //large hole in the section - can walk through
#define MAX_HOLE_SIZE LARGE_HOLE
/obj/structure/fence
name = "fence"
desc = "A chain link fence. Not as effective as a wall, but generally it keeps people out."
description_info = "Projectiles can freely pass fences."
density = TRUE
anchored = TRUE
icon = 'icons/obj/fence.dmi'
icon_state = "straight"
var/cuttable = TRUE
var/hole_size= NO_HOLE
var/invulnerable = FALSE
/obj/structure/fence/Initialize()
update_cut_status()
return ..()
/obj/structure/fence/examine(mob/user)
. = ..()
switch(hole_size)
if(MEDIUM_HOLE)
. += "There is a large hole in it."
if(LARGE_HOLE)
. += "It has been completely cut through."
/obj/structure/fence/get_description_interaction()
var/list/results = list()
if(cuttable && !invulnerable && hole_size < MAX_HOLE_SIZE)
results += "[desc_panel_image("wirecutters")]to [hole_size > NO_HOLE ? "expand the":"cut a"] hole into the fence, allowing passage."
return results
/obj/structure/fence/end
icon_state = "end"
cuttable = FALSE
/obj/structure/fence/corner
icon_state = "corner"
cuttable = FALSE
/obj/structure/fence/post
icon_state = "post"
cuttable = FALSE
/obj/structure/fence/cut/medium
icon_state = "straight_cut2"
hole_size = MEDIUM_HOLE
/obj/structure/fence/cut/large
icon_state = "straight_cut3"
hole_size = LARGE_HOLE
// Projectiles can pass through fences.
/obj/structure/fence/CanPass(atom/movable/mover, turf/target)
if(istype(mover, /obj/item/projectile))
return TRUE
return ..()
/obj/structure/fence/attackby(obj/item/W, mob/user)
if(W.is_wirecutter())
if(!cuttable)
to_chat(user, span("warning", "This section of the fence can't be cut."))
return
if(invulnerable)
to_chat(user, span("warning", "This fence is too strong to cut through."))
return
var/current_stage = hole_size
if(current_stage >= MAX_HOLE_SIZE)
to_chat(user, span("notice", "This fence has too much cut out of it already."))
return
user.visible_message(span("danger", "\The [user] starts cutting through \the [src] with \the [W]."),\
span("danger", "You start cutting through \the [src] with \the [W]."))
playsound(src, W.usesound, 50, 1)
if(do_after(user, CUT_TIME * W.toolspeed, target = src))
if(current_stage == hole_size)
switch(++hole_size)
if(MEDIUM_HOLE)
visible_message(span("notice", "\The [user] cuts into \the [src] some more."))
to_chat(user, span("notice", "You could probably fit yourself through that hole now. Although climbing through would be much faster if you made it even bigger."))
climbable = TRUE
if(LARGE_HOLE)
visible_message(span("notice", "\The [user] completely cuts through \the [src]."))
to_chat(user, span("notice", "The hole in \the [src] is now big enough to walk through."))
climbable = FALSE
update_cut_status()
return TRUE
/obj/structure/fence/proc/update_cut_status()
if(!cuttable)
return
density = TRUE
switch(hole_size)
if(NO_HOLE)
icon_state = initial(icon_state)
if(MEDIUM_HOLE)
icon_state = "straight_cut2"
if(LARGE_HOLE)
icon_state = "straight_cut3"
density = FALSE
//FENCE DOORS
/obj/structure/fence/door
name = "fence door"
desc = "Not very useful without a real lock."
icon_state = "door_closed"
cuttable = FALSE
var/open = FALSE
var/locked = FALSE
/obj/structure/fence/door/Initialize()
update_door_status()
return ..()
/obj/structure/fence/door/opened
icon_state = "door_opened"
open = TRUE
density = TRUE
/obj/structure/fence/door/locked
desc = "It looks like it has a strong padlock attached."
locked = TRUE
/obj/structure/fence/door/attack_hand(mob/user)
if(can_open(user))
toggle(user)
else
to_chat(user, span("warning", "\The [src] is [!open ? "locked" : "stuck open"]."))
return TRUE
/obj/structure/fence/door/proc/toggle(mob/user)
switch(open)
if(FALSE)
visible_message(span("notice", "\The [user] opens \the [src]."))
open = TRUE
if(TRUE)
visible_message(span("notice", "\The [user] closes \the [src]."))
open = FALSE
update_door_status()
playsound(src, 'sound/machines/click.ogg', 100, 1)
/obj/structure/fence/door/proc/update_door_status()
switch(open)
if(FALSE)
density = TRUE
icon_state = "door_closed"
if(TRUE)
density = FALSE
icon_state = "door_opened"
/obj/structure/fence/door/proc/can_open(mob/user)
if(locked)
return FALSE
return TRUE
#undef CUT_TIME
#undef CLIMB_TIME
#undef NO_HOLE
#undef MEDIUM_HOLE
#undef LARGE_HOLE
>>>>>>> 6c6644f... Rewrite examine() to pass a list around (#7038)
#undef MAX_HOLE_SIZE
+4 -4
View File
@@ -36,9 +36,9 @@
max_harvests = max(0, rand(min_harvests, max_harvests)) // Incase you want to weight it more toward 'not harvestable', set min_harvests to a negative value.
/obj/structure/flora/examine(mob/user)
. = ..(user)
. = ..()
if(harvest_count < max_harvests)
to_chat(user, "<span class='notice'>\The [src] seems to have something hanging from it.</span>")
. += "<span class='notice'>It seems to have something hanging from it.</span>"
/obj/structure/flora/attackby(var/obj/item/weapon/W, var/mob/living/user)
if(can_harvest(W))
@@ -225,9 +225,9 @@
var/obj/item/stored_item
/obj/structure/flora/pottedplant/examine(mob/user)
..()
. = ..()
if(in_range(user, src) && stored_item)
to_chat(user, "<i>You can see something in there...</i>")
. += "<i>You can see something in there...</i>"
/obj/structure/flora/pottedplant/attackby(obj/item/I, mob/user)
if(stored_item)
+5 -7
View File
@@ -30,13 +30,11 @@
color = material.icon_colour
/obj/structure/gravemarker/examine(mob/user)
..()
if(get_dist(src, user) < 4)
if(grave_name)
to_chat(user, "Here Lies [grave_name]")
if(get_dist(src, user) < 2)
if(epitaph)
to_chat(user, epitaph)
. = ..()
if(grave_name && get_dist(src, user) < 4)
. += "Here Lies [grave_name]"
if(epitaph && get_dist(src, user) < 2)
. += epitaph
/obj/structure/gravemarker/CanPass(atom/movable/mover, turf/target)
if(istype(mover) && mover.checkpass(PASSTABLE))
+8 -10
View File
@@ -24,10 +24,9 @@ GLOBAL_LIST_BOILERPLATE(all_janitorial_carts, /obj/structure/janitorialcart)
/obj/structure/janitorialcart/examine(mob/user)
if(..(user, 1))
to_chat(user, "[src] [bicon(src)] contains [reagents.total_volume] unit\s of liquid!")
//everything else is visible, so doesn't need to be mentioned
. = ..()
if(Adjacent(user))
. += "It contains [reagents.total_volume] unit\s of liquid!"
/obj/structure/janitorialcart/attackby(obj/item/I, mob/user)
if(istype(I, /obj/item/weapon/storage/bag/trash) && !mybag)
@@ -186,12 +185,11 @@ GLOBAL_LIST_BOILERPLATE(all_janitorial_carts, /obj/structure/janitorialcart)
/obj/structure/bed/chair/janicart/examine(mob/user)
if(!..(user, 1))
return
to_chat(user, "[bicon(src)] This [callme] contains [reagents.total_volume] unit\s of water!")
if(mybag)
to_chat(user, "\A [mybag] is hanging on the [callme].")
. = ..()
if(Adjacent(user))
. += "This [callme] contains [reagents.total_volume] unit\s of water!"
if(mybag)
. += "\A [mybag] is hanging on the [callme]."
/obj/structure/bed/chair/janicart/attackby(obj/item/I, mob/user)
+3 -2
View File
@@ -17,8 +17,9 @@ GLOBAL_LIST_BOILERPLATE(all_mopbuckets, /obj/structure/mopbucket)
..()
/obj/structure/mopbucket/examine(mob/user)
if(..(user, 1))
to_chat(user, "[src] [bicon(src)] contains [reagents.total_volume] unit\s of water!")
. = ..()
if(Adjacent(user))
. += "It contains [reagents.total_volume] unit\s of water!"
/obj/structure/mopbucket/attackby(obj/item/I, mob/user)
if(istype(I, /obj/item/weapon/mop) || istype(I, /obj/item/weapon/soap) || istype(I, /obj/item/weapon/reagent_containers/glass/rag)) //VOREStation Edit - "Allows soap and rags to be used on mopbuckets"
+3 -6
View File
@@ -51,21 +51,18 @@
return
/obj/structure/noticeboard/attack_hand(var/mob/user)
examine(user)
user.examinate(src)
// Since Topic() never seems to interact with usr on more than a superficial
// level, it should be fine to let anyone mess with the board other than ghosts.
/obj/structure/noticeboard/examine(var/mob/user)
if(!user)
user = usr
if(user.Adjacent(src))
. = ..()
if(Adjacent(user))
var/dat = "<B>Noticeboard</B><BR>"
for(var/obj/item/weapon/paper/P in src)
dat += "<A href='?src=\ref[src];read=\ref[P]'>[P.name]</A> <A href='?src=\ref[src];write=\ref[P]'>Write</A> <A href='?src=\ref[src];remove=\ref[P]'>Remove</A><BR>"
user << browse("<HEAD><TITLE>Notices</TITLE></HEAD>[dat]","window=noticeboard")
onclose(user, "noticeboard")
else
..()
/obj/structure/noticeboard/Topic(href, href_list)
..()
+3 -3
View File
@@ -46,11 +46,11 @@
if(health < maxhealth)
switch(health / maxhealth)
if(0.0 to 0.5)
to_chat(user, "<span class='warning'>It looks severely damaged!</span>")
. += "<span class='warning'>It looks severely damaged!</span>"
if(0.25 to 0.5)
to_chat(user, "<span class='warning'>It looks damaged!</span>")
. += "<span class='warning'>It looks damaged!</span>"
if(0.5 to 1.0)
to_chat(user, "<span class='notice'>It has a few scrapes and dents.</span>")
. += "<span class='notice'>It has a few scrapes and dents.</span>"
/obj/structure/railing/take_damage(amount)
health -= amount
+9 -9
View File
@@ -25,27 +25,27 @@
var/fulltile = FALSE // Set to true on full-tile variants.
/obj/structure/window/examine(mob/user)
. = ..(user)
. = ..()
if(health == maxhealth)
to_chat(user, "<span class='notice'>It looks fully intact.</span>")
. += "<span class='notice'>It looks fully intact.</span>"
else
var/perc = health / maxhealth
if(perc > 0.75)
to_chat(user, "<span class='notice'>It has a few cracks.</span>")
. += "<span class='notice'>It has a few cracks.</span>"
else if(perc > 0.5)
to_chat(user, "<span class='warning'>It looks slightly damaged.</span>")
. += "<span class='warning'>It looks slightly damaged.</span>"
else if(perc > 0.25)
to_chat(user, "<span class='warning'>It looks moderately damaged.</span>")
. += "<span class='warning'>It looks moderately damaged.</span>"
else
to_chat(user, "<span class='danger'>It looks heavily damaged.</span>")
. += "<span class='danger'>It looks heavily damaged.</span>"
if(silicate)
if (silicate < 30)
to_chat(user, "<span class='notice'>It has a thin layer of silicate.</span>")
. += "<span class='notice'>It has a thin layer of silicate.</span>"
else if (silicate < 70)
to_chat(user, "<span class='notice'>It is covered in silicate.</span>")
. += "<span class='notice'>It is covered in silicate.</span>"
else
to_chat(user, "<span class='notice'>There is a thick layer of silicate covering it.</span>")
. += "<span class='notice'>There is a thick layer of silicate covering it.</span>"
/obj/structure/window/take_damage(var/damage = 0, var/sound_effect = 1)
var/initialhealth = health