Merge remote-tracking branch 'upstream/master' into arconomy

This commit is contained in:
ArcaneMusic
2020-02-25 13:11:56 -05:00
437 changed files with 6416 additions and 4324 deletions
+1 -1
View File
@@ -235,7 +235,7 @@
if(brain.force_replace_ai_name)
A.fully_replace_character_name(A.name, brain.replacement_ai_name())
SSblackbox.record_feedback("amount", "ais_created", 1)
deadchat_broadcast(" has been brought online at <b>[get_area_name(A, TRUE)]</b>.", "<span class='name'>[A]</span>", follow_target=A)
deadchat_broadcast(" has been brought online at <b>[get_area_name(A, TRUE)]</b>.", "<span class='name'>[A]</span>", follow_target=A, message_type=DEADCHAT_ANNOUNCEMENT)
qdel(src)
else
state = AI_READY_CORE
+159 -39
View File
@@ -39,21 +39,29 @@
name = "canvas"
desc = "Draw out your soul on this canvas!"
icon = 'icons/obj/artstuff.dmi'
icon_state = "square"
icon_state = "11x11"
resistance_flags = FLAMMABLE
var/width = 11
var/height = 11
var/list/grid
var/list/top_colors
var/canvas_color = "#ffffff" //empty canvas color
var/ui_x = 400
var/ui_y = 400
var/used = FALSE
var/painting_name //Painting name, this is set after framing.
var/framed = FALSE //Blocks edits, set on framing
var/finalized = FALSE //Blocks edits
var/icon_generated = FALSE
var/icon/generated_icon
// Painting overlay offset when framed
var/framed_offset_x = 11
var/framed_offset_y = 10
pixel_x = 10
pixel_y = 9
/obj/item/canvas/Initialize()
. = ..()
top_colors = list()
reset_grid()
/obj/item/canvas/proc/reset_grid()
@@ -85,6 +93,7 @@
. = ..()
.["grid"] = grid
.["name"] = painting_name
.["finalized"] = finalized
/obj/item/canvas/examine(mob/user)
. = ..()
@@ -92,7 +101,7 @@
/obj/item/canvas/ui_act(action, params)
. = ..()
if(. || framed)
if(. || finalized)
return
var/mob/user = usr
switch(action)
@@ -104,34 +113,50 @@
var/x = text2num(params["x"])
var/y = text2num(params["y"])
grid[x][y] = color
top_colors = get_most_common_colors(3)
used = TRUE
update_icon()
. = TRUE
if("finalize")
. = TRUE
if(!finalized)
finalize(user)
/obj/item/canvas/proc/finalize(mob/user)
finalized = TRUE
generate_proper_overlay()
try_rename(user)
/obj/item/canvas/update_overlays()
. = ..()
for(var/i in 2 to top_colors.len) //first is used as base color
var/mutable_appearance/detail = mutable_appearance(icon, "[icon_state]_detail_[i-1]")
detail.appearance_flags |= RESET_COLOR
detail.color = top_colors[i]
if(!icon_generated)
if(used)
var/mutable_appearance/detail = mutable_appearance(icon,"[icon_state]wip")
detail.pixel_x = 1
detail.pixel_y = 1
. += detail
else
var/mutable_appearance/detail = mutable_appearance(generated_icon)
detail.pixel_x = 1
detail.pixel_y = 1
. += detail
/obj/item/canvas/update_icon_state()
. = ..()
if(top_colors.len)
color = top_colors[1]
/obj/item/canvas/proc/generate_proper_overlay()
if(icon_generated)
return
var/png_filename = "data/paintings/temp_painting.png"
var/result = rustg_dmi_create_png(png_filename,"[width]","[height]",get_data_string())
if(result)
CRASH("Error generating painting png : [result]")
generated_icon = new(png_filename)
icon_generated = TRUE
update_icon()
/obj/item/canvas/proc/get_most_common_colors(count)
var/list/tally = list()
for(var/x in 1 to width)
for(var/y in 1 to height)
tally[grid[x][y]] += 1
sortTim(tally,/proc/cmp_numeric_dsc,associative=TRUE)
. = list()
for(var/result in tally)
. += result
if(length(.) >= count)
break
/obj/item/canvas/proc/get_data_string()
var/list/data = list()
for(var/y in 1 to height)
for(var/x in 1 to width)
data += grid[x][y]
return data.Join("")
//Todo make this element ?
/obj/item/canvas/proc/get_paint_tool_color(obj/item/I)
@@ -153,27 +178,44 @@
else if(istype(I, /obj/item/soap) || istype(I, /obj/item/reagent_containers/glass/rag))
return canvas_color
/obj/item/canvas/proc/try_rename(mob/user)
var/new_name = stripped_input(user,"What do you want to name the painting?")
if(!painting_name && new_name && user.canUseTopic(src,BE_CLOSE))
painting_name = new_name
SStgui.update_uis(src)
/obj/item/canvas/nineteenXnineteen
icon_state = "square"
icon_state = "19x19"
width = 19
height = 19
ui_x = 600
ui_y = 600
pixel_x = 6
pixel_y = 9
framed_offset_x = 8
framed_offset_y = 9
/obj/item/canvas/twentythreeXnineteen
icon_state = "wide"
icon_state = "23x19"
width = 23
height = 19
ui_x = 800
ui_y = 600
pixel_x = 4
pixel_y = 10
framed_offset_x = 6
framed_offset_y = 8
/obj/item/canvas/twentythreeXtwentythree
icon_state = "square"
icon_state = "23x23"
width = 23
height = 23
ui_x = 800
ui_y = 800
pixel_x = 5
pixel_y = 9
framed_offset_x = 5
framed_offset_y = 6
/obj/item/wallframe/painting
name = "painting frame"
@@ -191,6 +233,7 @@
icon_state = "frame-empty"
buildable_sign = FALSE
var/obj/item/canvas/C
var/persistence_id
/obj/structure/sign/painting/Initialize(mapload, dir, building)
. = ..()
@@ -217,7 +260,6 @@
/obj/structure/sign/painting/wirecutter_act(mob/living/user, obj/item/I)
. = ..()
if(C)
C.framed = FALSE
C.forceMove(drop_location())
C = null
to_chat(user, "<span class='notice'>You remove the painting from the frame.</span>")
@@ -227,20 +269,98 @@
/obj/structure/sign/painting/proc/frame_canvas(mob/user,obj/item/canvas/new_canvas)
if(user.transferItemToLoc(new_canvas,src))
C = new_canvas
C.framed = TRUE
if(!C.finalized)
C.finalize(user)
to_chat(user,"<span class='notice'>You frame [C].</span>")
update_icon()
/obj/structure/sign/painting/proc/try_rename(mob/user)
var/new_name = stripped_input(user,"What do you want to name the painting?")
if(C && !C.painting_name && new_name && user.canUseTopic(src,BE_CLOSE))
C.painting_name = new_name
SStgui.update_uis(C)
if(!C.painting_name)
C.try_rename(user)
/obj/structure/sign/painting/update_icon_state()
. = ..()
if(C && C.generated_icon)
icon_state = null
else
icon_state = "frame-empty"
/obj/structure/sign/painting/update_overlays()
. = ..()
if(C && C.top_colors.len)
var/mutable_appearance/MA = mutable_appearance(icon, "frame-content-overlay")
MA.appearance_flags |= RESET_COLOR
MA.color = C.top_colors[1]
if(C && C.generated_icon)
var/mutable_appearance/MA = mutable_appearance(C.generated_icon)
MA.pixel_x = C.framed_offset_x
MA.pixel_y = C.framed_offset_y
. += MA
var/mutable_appearance/frame = mutable_appearance(C.icon,"[C.icon_state]frame")
frame.pixel_x = C.framed_offset_x - 1
frame.pixel_y = C.framed_offset_y - 1
. += frame
/obj/structure/sign/painting/proc/load_persistent()
if(!persistence_id)
return
if(!SSpersistence.paintings || !SSpersistence.paintings[persistence_id] || !length(SSpersistence.paintings[persistence_id]))
return
var/list/chosen = pick(SSpersistence.paintings[persistence_id])
var/title = chosen["title"]
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.")
return
var/icon/I = new(png)
var/obj/item/canvas/new_canvas
var/w = I.Width()
var/h = I.Height()
for(var/T in typesof(/obj/item/canvas))
new_canvas = T
if(initial(new_canvas.width) == w && initial(new_canvas.height) == h)
new_canvas = new T(src)
break
new_canvas.fill_grid_from_icon(I)
new_canvas.generated_icon = I
new_canvas.icon_generated = TRUE
new_canvas.finalized = TRUE
new_canvas.painting_name = title
C = new_canvas
update_icon()
/obj/structure/sign/painting/proc/save_persistent()
if(!persistence_id || !C)
return
if(sanitize_filename(persistence_id) != persistence_id)
stack_trace("Invalid persistence_id - [persistence_id]")
return
var/data = C.get_data_string()
var/md5 = md5(data)
var/list/current = SSpersistence.paintings[persistence_id]
if(!current)
current = list()
for(var/list/entry in current)
if(entry["md5"] == md5)
return
var/png_directory = "data/paintings/[persistence_id]/"
var/png_path = png_directory + "[md5].png"
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))
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)
//Presets for art gallery mapping, for paintings to be shared across stations
/obj/structure/sign/painting/library
persistence_id = "library"
/obj/structure/sign/painting/library_secure
persistence_id = "library_secure"
/obj/structure/sign/painting/library_private // keep your smut away from prying eyes, or non-librarians at least
persistence_id = "library_private"
+1 -1
View File
@@ -218,7 +218,7 @@ LINEN BINS
dream_messages = list("a book", "an explosion", "lightning", "a staff", "a skeleton", "a robe", "magic")
/obj/item/bedsheet/nanotrasen
name = "nanotrasen bedsheet"
name = "\improper Nanotrasen bedsheet"
desc = "It has the Nanotrasen logo on it and has an aura of duty."
icon_state = "sheetNT"
item_state = "sheetNT"
+1 -1
View File
@@ -129,7 +129,7 @@
if(burn_time_remaining() < MAXIMUM_BURN_TIMER)
flame_expiry_timer = world.time + MAXIMUM_BURN_TIMER
else
fuel_added = CLAMP(fuel_added + amount, 0, MAXIMUM_BURN_TIMER)
fuel_added = clamp(fuel_added + amount, 0, MAXIMUM_BURN_TIMER)
/obj/structure/fireplace/proc/burn_time_remaining()
if(lit)
+1 -1
View File
@@ -125,7 +125,7 @@
else
cur_oct[cur_note] = text2num(ni)
if(user.dizziness > 0 && prob(user.dizziness / 2))
cur_note = CLAMP(cur_note + rand(round(-user.dizziness / 10), round(user.dizziness / 10)), 1, 7)
cur_note = clamp(cur_note + rand(round(-user.dizziness / 10), round(user.dizziness / 10)), 1, 7)
if(user.dizziness > 0 && prob(user.dizziness / 5))
if(prob(30))
cur_acc[cur_note] = "#"
+3 -3
View File
@@ -69,13 +69,13 @@
icon_state = "firefighter"
/obj/structure/showcase/machinery/implanter
name = "Nanotrasen automated mindshield implanter exhibit"
name = "\improper Nanotrasen automated mindshield implanter exhibit"
desc = "A flimsy model of a standard Nanotrasen automated mindshield implant machine. With secure positioning harnesses and a robotic surgical injector, brain damage and other serious medical anomalies are now up to 60% less likely!"
icon = 'icons/obj/machines/implantchair.dmi'
icon_state = "implantchair"
/obj/structure/showcase/machinery/microwave
name = "Nanotrasen-brand microwave"
name = "\improper Nanotrasen-brand microwave"
desc = "The famous Nanotrasen-brand microwave, the multi-purpose cooking appliance every station needs! This one appears to be drawn onto a cardboard box."
icon = 'icons/obj/kitchen.dmi'
icon_state = "mw"
@@ -91,7 +91,7 @@
desc = "A stand with a model of the perfect Nanotrasen Employee bolted to it. Signs indicate it is robustly genetically engineered, as well as being ruthlessly loyal."
/obj/structure/showcase/machinery/tv
name = "Nanotrasen corporate newsfeed"
name = "\improper Nanotrasen corporate newsfeed"
desc = "A slightly battered looking TV. Various Nanotrasen infomercials play on a loop, accompanied by a jaunty tune."
icon = 'icons/obj/computer.dmi'
icon_state = "television"
+2 -92
View File
@@ -98,102 +98,12 @@
wash_atom(AM)
/obj/machinery/shower/proc/wash_atom(atom/A)
SEND_SIGNAL(A, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_WEAK)
A.washed(src)
reagents.reaction(A, TOUCH, reaction_volume)
if(isobj(A))
wash_obj(A)
else if(isturf(A))
wash_turf(A)
else if(isliving(A))
wash_mob(A)
if(isliving(A))
check_heat(A)
contamination_cleanse(A)
/obj/machinery/shower/proc/wash_obj(obj/O)
. = SEND_SIGNAL(O, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_WEAK)
O.remove_atom_colour(WASHABLE_COLOUR_PRIORITY)
/obj/machinery/shower/proc/wash_turf(turf/tile)
SEND_SIGNAL(tile, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_WEAK)
tile.remove_atom_colour(WASHABLE_COLOUR_PRIORITY)
for(var/obj/effect/E in tile)
if(is_cleanable(E))
qdel(E)
/obj/machinery/shower/proc/wash_mob(mob/living/L)
SEND_SIGNAL(L, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_WEAK)
L.remove_atom_colour(WASHABLE_COLOUR_PRIORITY)
SEND_SIGNAL(L, COMSIG_ADD_MOOD_EVENT, "shower", /datum/mood_event/nice_shower)
if(iscarbon(L))
var/mob/living/carbon/M = L
. = TRUE
for(var/obj/item/I in M.held_items)
wash_obj(I)
if(M.back && wash_obj(M.back))
M.update_inv_back(0)
var/list/obscured = M.check_obscured_slots()
if(M.head && wash_obj(M.head))
M.update_inv_head()
if(M.glasses && !(ITEM_SLOT_EYES in obscured) && wash_obj(M.glasses))
M.update_inv_glasses()
if(M.wear_mask && !(ITEM_SLOT_MASK in obscured) && wash_obj(M.wear_mask))
M.update_inv_wear_mask()
if(M.ears && !(HIDEEARS in obscured) && wash_obj(M.ears))
M.update_inv_ears()
if(M.wear_neck && !(ITEM_SLOT_NECK in obscured) && wash_obj(M.wear_neck))
M.update_inv_neck()
if(M.shoes && !(HIDESHOES in obscured) && wash_obj(M.shoes))
M.update_inv_shoes()
var/washgloves = FALSE
if(M.gloves && !(HIDEGLOVES in obscured))
washgloves = TRUE
if(ishuman(M))
var/mob/living/carbon/human/H = M
if(H.wear_suit && wash_obj(H.wear_suit))
H.update_inv_wear_suit()
else if(H.w_uniform && wash_obj(H.w_uniform))
H.update_inv_w_uniform()
if(washgloves)
SEND_SIGNAL(H, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD)
if(!H.is_mouth_covered())
H.lip_style = null
H.update_body()
if(H.belt && wash_obj(H.belt))
H.update_inv_belt()
else
SEND_SIGNAL(M, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD)
else
SEND_SIGNAL(L, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD)
/obj/machinery/shower/proc/contamination_cleanse(atom/thing)
var/datum/component/radioactive/healthy_green_glow = thing.GetComponent(/datum/component/radioactive)
if(!healthy_green_glow || QDELETED(healthy_green_glow))
return
var/strength = healthy_green_glow.strength
if(strength <= RAD_BACKGROUND_RADIATION)
qdel(healthy_green_glow)
return
healthy_green_glow.strength -= max(0, (healthy_green_glow.strength - (RAD_BACKGROUND_RADIATION * 2)) * 0.2)
/obj/machinery/shower/process()
if(on)
wash_atom(loc)
+3 -3
View File
@@ -144,11 +144,11 @@
setDir(turn(dir, 90))
/obj/structure/sign/nanotrasen
name = "\improper Nanotrasen Logo"
desc = "A sign with the Nanotrasen Logo on it. Glory to Nanotrasen!"
name = "\improper Nanotrasen logo"
desc = "A sign with the Nanotrasen logo on it. Glory to Nanotrasen!"
icon_state = "nanotrasen"
/obj/structure/sign/logo
name = "nanotrasen logo"
name = "\improper Nanotrasen logo"
desc = "The Nanotrasen corporate logo."
icon_state = "nanotrasen_sign1"
+2 -2
View File
@@ -182,8 +182,8 @@
if(!click_params || !click_params["icon-x"] || !click_params["icon-y"])
return
//Clamp it so that the icon never moves more than 16 pixels in either direction (thus leaving the table turf)
I.pixel_x = CLAMP(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2)
I.pixel_y = CLAMP(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2)
I.pixel_x = clamp(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2)
I.pixel_y = clamp(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2)
AfterPutItemOnTable(I, user)
return TRUE
else