Merge branch 'master' of https://github.com/tgstation/-tg-station into prisoners

# Conflicts:
#	_maps/map_files/BoxStation/BoxStation.dmm
This commit is contained in:
Bawhoppen
2020-03-01 03:30:17 -06:00
114 changed files with 3297 additions and 2042 deletions
+39 -3
View File
@@ -50,6 +50,7 @@
var/used = FALSE
var/painting_name //Painting name, this is set after framing.
var/finalized = FALSE //Blocks edits
var/author_ckey
var/icon_generated = FALSE
var/icon/generated_icon
@@ -123,6 +124,7 @@
/obj/item/canvas/proc/finalize(mob/user)
finalized = TRUE
author_ckey = user.ckey
generate_proper_overlay()
try_rename(user)
@@ -237,6 +239,7 @@
/obj/structure/sign/painting/Initialize(mapload, dir, building)
. = ..()
SSpersistence.painting_frames += src
AddComponent(/datum/component/art, 20)
if(dir)
setDir(dir)
@@ -244,6 +247,10 @@
pixel_x = (dir & 3)? 0 : (dir == 4 ? -30 : 30)
pixel_y = (dir & 3)? (dir ==1 ? -30 : 30) : 0
/obj/structure/sign/painting/Destroy()
. = ..()
SSpersistence.painting_frames -= src
/obj/structure/sign/painting/attackby(obj/item/I, mob/user, params)
if(!C && istype(I, /obj/item/canvas))
frame_canvas(user,I)
@@ -305,6 +312,7 @@
return
var/list/chosen = pick(SSpersistence.paintings[persistence_id])
var/title = chosen["title"]
var/author = chosen["ckey"]
var/png = "data/paintings/[persistence_id]/[chosen["md5"]].png"
if(!fexists(png))
stack_trace("Persistent painting [chosen["md5"]].png was not found in [persistence_id] directory.")
@@ -323,6 +331,7 @@
new_canvas.icon_generated = TRUE
new_canvas.finalized = TRUE
new_canvas.painting_name = title
new_canvas.author_ckey = author
C = new_canvas
update_icon()
@@ -345,15 +354,14 @@
var/result = rustg_dmi_create_png(png_path,"[C.width]","[C.height]",data)
if(result)
CRASH("Error saving persistent painting: [result]")
current += list(list("title" = C.painting_name , "md5" = md5))
current += list(list("title" = C.painting_name , "md5" = md5, "ckey" = C.author_ckey))
SSpersistence.paintings[persistence_id] = current
/obj/item/canvas/proc/fill_grid_from_icon(icon/I)
var/w = I.Width() + 1
var/h = I.Height() + 1
for(var/x in 1 to width)
for(var/y in 1 to height)
grid[x][y] = I.GetPixel(w-x,h-y)
grid[x][y] = I.GetPixel(x,h-y)
//Presets for art gallery mapping, for paintings to be shared across stations
/obj/structure/sign/painting/library
@@ -364,3 +372,31 @@
/obj/structure/sign/painting/library_private // keep your smut away from prying eyes, or non-librarians at least
persistence_id = "library_private"
/obj/structure/sign/painting/vv_get_dropdown()
. = ..()
VV_DROPDOWN_OPTION(VV_HK_REMOVE_PAINTING, "Remove Persistent Painting")
/obj/structure/sign/painting/vv_do_topic(list/href_list)
. = ..()
if(href_list[VV_HK_REMOVE_PAINTING])
if(!check_rights(NONE))
return
var/mob/user = usr
if(!persistence_id || !C)
to_chat(user,"<span class='warning'>This is not a persistent painting.</span>")
return
var/md5 = md5(C.get_data_string())
var/author = C.author_ckey
var/list/current = SSpersistence.paintings[persistence_id]
if(current)
for(var/list/entry in current)
if(entry["md5"] == md5)
current -= entry
var/png = "data/paintings/[persistence_id]/[md5].png"
fdel(png)
for(var/obj/structure/sign/painting/P in SSpersistence.painting_frames)
if(P.C && md5(P.C.get_data_string()) == md5)
QDEL_NULL(P.C)
log_admin("[key_name(user)] has deleted a persistent painting made by [author].")
message_admins("<span class='notice'>[key_name_admin(user)] has deleted persistent painting made by [author].</span>")
@@ -104,7 +104,7 @@
new /obj/item/clothing/shoes/sneakers/black(src)
new /obj/item/clothing/suit/chaplainsuit/nun(src)
new /obj/item/clothing/head/nun_hood(src)
new /obj/item/clothing/suit/hooded/chaplainsuit/monkfrock(src)
new /obj/item/clothing/suit/hooded/chaplainsuit/monkhabit(src)
new /obj/item/clothing/suit/chaplainsuit/holidaypriest(src)
new /obj/item/storage/backpack/cultpack(src)
new /obj/item/storage/fancy/candle_box(src)
+155 -1
View File
@@ -10,6 +10,7 @@
max_integrity = 200
integrity_failure = 0.25
var/obj/item/showpiece = null
var/obj/item/showpiece_type = null //This allows for showpieces that can only hold items if they're the same istype as this.
var/alert = TRUE
var/open = FALSE
var/openable = TRUE
@@ -17,6 +18,7 @@
var/start_showpiece_type = null //add type for items on display
var/list/start_showpieces = list() //Takes sublists in the form of list("type" = /obj/item/bikehorn, "trophy_message" = "henk")
var/trophy_message = ""
var/glass_fix = TRUE
/obj/structure/displaycase/Initialize()
. = ..()
@@ -131,11 +133,14 @@
to_chat(user, "<span class='notice'>You [open ? "close":"open"] [src].</span>")
toggle_lock(user)
else if(open && !showpiece)
if(showpiece_type && !istype(W, showpiece_type))
to_chat(user, "<span class='notice'>This doesn't belong in this kind of display.</span>")
return TRUE
if(user.transferItemToLoc(W, src))
showpiece = W
to_chat(user, "<span class='notice'>You put [W] on display.</span>")
update_icon()
else if(istype(W, /obj/item/stack/sheet/glass) && broken)
else if(glass_fix && broken && istype(W, /obj/item/stack/sheet/glass))
var/obj/item/stack/sheet/glass/G = W
if(G.get_amount() < 2)
to_chat(user, "<span class='warning'>You need two glass sheets to fix the case!</span>")
@@ -206,6 +211,21 @@
electronics = I
to_chat(user, "<span class='notice'>You install the airlock electronics.</span>")
else if(istype(I, /obj/item/stock_parts/card_reader))
var/obj/item/stock_parts/card_reader/C = I
to_chat(user, "<span class='notice'>You start adding [C] to [src]...</span>")
if(do_after(user, 20, target = src))
var/obj/structure/displaycase/forsale/sale = new(src.loc)
if(electronics)
electronics.forceMove(sale)
sale.electronics = electronics
if(electronics.one_access)
sale.req_one_access = electronics.accesses
else
sale.req_access = electronics.accesses
qdel(src)
qdel(C)
else if(istype(I, /obj/item/stack/sheet/glass))
var/obj/item/stack/sheet/glass/G = I
if(G.get_amount() < 10)
@@ -342,3 +362,137 @@
name = initial(I.name)
icon = initial(I.icon)
icon_state = initial(I.icon_state)
/obj/structure/displaycase/forsale
name = "vend-a-tray"
icon = 'icons/obj/stationobjs.dmi'
icon_state = "laserbox0"
desc = "A display case with an ID-card swiper. Use your ID to purchase the contents."
density = FALSE
max_integrity = 100
req_access = list(ACCESS_KITCHEN)
showpiece_type = /obj/item/reagent_containers/food
alert = FALSE //No, we're not calling the fire department because someone stole your cookie.
glass_fix = FALSE //Fixable with tools instead.
var/sale_price = 20
var/datum/bank_account/payments_acc = null
/obj/structure/displaycase/forsale/update_icon() //remind me to fix my shitcode later
var/icon/I
if(open)
I = icon('icons/obj/stationobjs.dmi',"laserboxb0")
else
I = icon('icons/obj/stationobjs.dmi',"laserbox0")
if(!showpiece && !open)
I = icon('icons/obj/stationobjs.dmi',"laserbox_open")
if(broken)
I = icon('icons/obj/stationobjs.dmi',"laserbox_broken")
if(showpiece)
var/icon/S = getFlatIcon(showpiece)
S.Scale(17,17)
I.Blend(S,ICON_UNDERLAY,8,12)
src.icon = I
return
/obj/structure/displaycase/forsale/attackby(obj/item/I, mob/living/user, params)
if(isidcard(I))
//Card Registration
var/obj/item/card/id/potential_acc = I
if(!potential_acc.registered_account)
to_chat(user, "<span class='warning'>This ID card has no account registered!</span>")
return
if(payments_acc && payments_acc != potential_acc.registered_account)
to_chat(user, "<span class='warning'>This Vend-a-tray is already registered!</span>")
return
if(!payments_acc && potential_acc.registered_account)
payments_acc = potential_acc.registered_account
playsound(src, 'sound/machines/click.ogg', 20, TRUE)
to_chat(user, "<span class='notice'>Vend-a-tray registered. Use your ID on grab intent to change the sale price, or disarm intent to open the tray.</span>")
return
//Buying the contained item with the ID.
switch(user.a_intent)
if(INTENT_HELP)
if(!showpiece)
to_chat(user, "<span class='notice'>There's nothing for sale.</span>")
return TRUE
if(broken)
to_chat(user, "<span class='notice'>[src] appears to be broken.</span>")
return TRUE
var/confirm = alert(user, "Purchase [showpiece] for [sale_price]?", "Purchase?", "Confirm", "Cancel")
if(confirm == "Cancel" || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return TRUE
var/datum/bank_account/account = potential_acc.registered_account
if(!account.has_money(sale_price))
to_chat(user, "<span class='notice'>You do not possess the funds to purchase this.</span>")
return TRUE
else
account.adjust_money(-sale_price)
if(payments_acc)
payments_acc.adjust_money(sale_price)
user.put_in_hands(showpiece)
to_chat(user, "<span class='notice'>You purchase [showpiece] for [sale_price] credits.</span>")
playsound(src, 'sound/effects/cashregister.ogg', 40, TRUE)
icon = 'icons/obj/stationobjs.dmi'
flick("laserbox_vend", src)
showpiece = null
update_icon()
return TRUE
//Setting the object's price.
if(INTENT_GRAB)
var/new_price_input = input(user,"Set the sale price for this vend-a-tray.","new price",0) as num|null
if(isnull(new_price_input) || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
new_price_input = clamp(round(new_price_input, 1), 10, 1000)
sale_price = new_price_input
to_chat(user, "<span class='notice'>The cost is now set to [sale_price].</span>")
return TRUE
if(I.tool_behaviour == TOOL_WRENCH && open && user.a_intent == INTENT_HELP )
if(anchored)
to_chat(user, "<span class='notice'>You start unsecuring [src]...</span>")
else
to_chat(user, "<span class='notice'>You start securing [src]...</span>")
if(I.use_tool(src, user, 16, volume=50))
if(QDELETED(I))
return
if(anchored)
to_chat(user, "<span class='notice'>You unsecure [src].</span>")
else
to_chat(user, "<span class='notice'>You secure [src].</span>")
anchored = !anchored
return
else if(I.tool_behaviour == TOOL_WRENCH && !open && user.a_intent == INTENT_HELP)
to_chat(user, "<span class='notice'>[src] must be open to move it.</span>")
return
if(istype(I, /obj/item/pda))
return TRUE
. = ..()
/obj/structure/displaycase/forsale/multitool_act(mob/living/user, obj/item/I)
. = ..()
if(obj_integrity <= (integrity_failure * max_integrity))
to_chat(user, "<span class='notice'>You start recalibrating [src]'s hover field...</span>")
if(do_after(user, 20, target = src))
broken = 0
obj_integrity = max_integrity
update_icon()
return TRUE
/obj/structure/displaycase/forsale/emag_act(mob/user)
. = ..()
payments_acc = null
req_access = list()
to_chat(user, "<span class='warning'>[src]'s card reader fizzles and smokes, and the account owner is reset.</span>")
/obj/structure/displaycase/forsale/examine(mob/user)
. = ..()
if(showpiece && !open)
. += "<span class='notice'>[showpiece] is for sale for [sale_price] credits.</span>"
if(broken)
. += "<span class='notice'>[src] is sparking and the hover field generator seems to be overloaded. Use a multitool to fix it.</span>"
/obj/structure/displaycase/forsale/obj_break(damage_flag)
if(!broken && !(flags_1 & NODECONSTRUCT_1))
broken = TRUE
playsound(src, "shatter", 70, TRUE)
update_icon()
trigger_alarm() //In case it's given an alarm anyway.
@@ -151,7 +151,14 @@
outside_tube()
/obj/structure/transit_tube_pod/proc/outside_tube()
var/list/savedcontents = contents.Copy()
var/saveddir = dir
var/turf/destination = get_edge_target_turf(src,saveddir)
visible_message("<span class='warning'>[src] ejects its insides out!</span>")
deconstruct(FALSE)//we automatically deconstruct the pod
for(var/i in savedcontents)
var/atom/movable/AM = i
AM.throw_at(destination,rand(1,3),5)
/obj/structure/transit_tube_pod/return_air()
return air_contents