Merge pull request #5832 from Baystation12/master

master - > dev
This commit is contained in:
Chinsky
2014-07-29 18:37:19 +04:00
9 changed files with 187 additions and 89 deletions

View File

@@ -251,7 +251,7 @@ proc/get_damage_icon_part(damage_state, body_part)
icon_key = "[icon_key]0"
else if(part.status & ORGAN_ROBOT)
icon_key = "[icon_key]2"
else if(part.status & ORGAN_DEAD) //Do we even have necrosis in our current code? ~Z
else if(part.status & ORGAN_DEAD)
icon_key = "[icon_key]3"
else
icon_key = "[icon_key]1"
@@ -274,6 +274,10 @@ proc/get_damage_icon_part(damage_state, body_part)
//No icon stored, so we need to start with a basic one.
var/datum/organ/external/chest = get_organ("chest")
base_icon = chest.get_icon(g)
if(chest.status & ORGAN_DEAD)
base_icon.ColorTone(necrosis_color_mod)
base_icon.SetIntensity(0.7)
for(var/datum/organ/external/part in organs)

View File

@@ -53,10 +53,10 @@
/obj/item/weapon/photo/proc/show(mob/user as mob)
user << browse_rsc(img, "tmp_photo.png")
user << browse("<html><head><title>[name]</title></head>" \
+ "<body style='overflow:hidden'>" \
+ "<div> <img src='tmp_photo.png' width = '180'" \
+ "[scribble ? "<div> Written on the back:<br><i>[scribble]</i>" : ]"\
+ "</body></html>", "window=book;size=200x[scribble ? 400 : 200]")
+ "<body style='overflow:hidden;margin:0;text-align:center'>" \
+ "<img src='tmp_photo.png' width='192' style='-ms-interpolation-mode:nearest-neighbor' />" \
+ "[scribble ? "<br>Written on the back:<br><i>[scribble]</i>" : ""]"\
+ "</body></html>", "window=book;size=192x[scribble ? 400 : 192]")
onclose(user, "[name]")
return
@@ -152,41 +152,51 @@
..()
/obj/item/device/camera/proc/get_icon(turf/the_turf as turf)
/obj/item/device/camera/proc/get_icon(list/turfs, turf/center)
//Bigger icon base to capture those icons that were shifted to the next tile
//i.e. pretty much all wall-mounted machinery
var/icon/res = icon('icons/effects/96x96.dmi', "")
var/icon/turficon = build_composite_icon(the_turf)
res.Blend(turficon, ICON_OVERLAY, 33, 33)
// Initialize the photograph to black.
res.Blend("#000", ICON_OVERLAY)
var/atoms[] = list()
for(var/atom/A in the_turf)
if(A.invisibility) continue
atoms.Add(A)
for(var/turf/the_turf in turfs)
// Add outselves to the list of stuff to draw
atoms.Add(the_turf);
// As well as anything that isn't invisible.
for(var/atom/A in the_turf)
if(A.invisibility) continue
atoms.Add(A)
//Sorting icons based on levels
var/gap = atoms.len
var/swapped = 1
while (gap > 1 || swapped)
swapped = 0
if(gap > 1)
gap = round(gap / 1.247330950103979)
if(gap < 1)
gap = 1
for(var/i = 1; gap + i <= atoms.len; i++)
var/atom/l = atoms[i] //Fucking hate
var/atom/r = atoms[gap+i] //how lists work here
if(l.layer > r.layer) //no "atoms[i].layer" for me
atoms.Swap(i, gap + i)
swapped = 1
// Sort the atoms into their layers
var/list/sorted = sort_atoms_by_layer(atoms)
for(var/i; i <= atoms.len; i++)
var/atom/A = atoms[i]
for(var/i; i <= sorted.len; i++)
var/atom/A = sorted[i]
if(A)
var/icon/img = getFlatIcon(A, A.dir)//build_composite_icon(A)
var/icon/img = getFlatIcon(A)//build_composite_icon(A)
// If what we got back is actually a picture, draw it.
if(istype(img, /icon))
res.Blend(new/icon(img, "", A.dir), ICON_OVERLAY, 33 + A.pixel_x, 33 + A.pixel_y)
// Check if we're looking at a mob that's lying down
if(istype(A, /mob/living) && A:lying)
// If they are, apply that effect to their picture.
img.BecomeLying()
// Calculate where we are relative to the center of the photo
var/xoff = (A.x - center.x) * 32
var/yoff = (A.y - center.y) * 32
if (istype(A,/atom/movable))
xoff+=A:step_x
yoff+=A:step_y
res.Blend(img, blendMode2iconMode(A.blend_mode), 33 + A.pixel_x + xoff, 33 + A.pixel_y + yoff)
// Lastly, render any contained effects on top.
for(var/turf/the_turf in turfs)
// Calculate where we are relative to the center of the photo
var/xoff = (the_turf.x - center.x) * 32
var/yoff = (the_turf.y - center.y) * 32
res.Blend(getFlatIcon(the_turf.loc), blendMode2iconMode(the_turf.blend_mode),33 + xoff,33 + yoff)
return res
@@ -217,8 +227,8 @@
var/y_c = target.y + 1
var/z_c = target.z
var/icon/temp = icon('icons/effects/96x96.dmi',"")
var/icon/black = icon('icons/turf/space.dmi', "black")
var/list/turfs = list()
var/mobs = ""
for(var/i = 1; i <= 3; i++)
for(var/j = 1; j <= 3; j++)
@@ -228,9 +238,7 @@
if(user.client) //To make shooting through security cameras possible
viewer = user.client.eye
if(dummy in viewers(world.view, viewer))
temp.Blend(get_icon(T), ICON_OVERLAY, 32 * (j-1-1), 32 - 32 * (i-1))
else
temp.Blend(black, ICON_OVERLAY, 32 * (j-1), 64 - 32 * (i-1))
turfs.Add(T)
mobs += get_mobs(T)
dummy.loc = null
dummy = null //Alas, nameless creature //garbage collect it instead
@@ -238,12 +246,14 @@
y_c--
x_c = x_c - 3
var/icon/photoimage = get_icon(turfs, target)
var/obj/item/weapon/photo/P = new/obj/item/weapon/photo()
P.loc = user.loc
if(!user.get_inactive_hand())
user.put_in_inactive_hand(P)
var/icon/small_img = icon(temp)
var/icon/tiny_img = icon(temp)
var/icon/small_img = icon(photoimage)
var/icon/tiny_img = icon(photoimage)
var/icon/ic = icon('icons/obj/items.dmi',"photo")
var/icon/pc = icon('icons/obj/bureaucracy.dmi', "photo")
small_img.Scale(8, 8)
@@ -252,7 +262,7 @@
pc.Blend(tiny_img,ICON_OVERLAY, 12, 19)
P.icon = ic
P.tiny = pc
P.img = temp
P.img = photoimage
P.desc = mobs
P.pixel_x = rand(-10, 10)
P.pixel_y = rand(-10, 10)

View File

@@ -43,6 +43,7 @@
..()
cell = new /obj/item/weapon/cell/high
verbs -= /atom/movable/verb/pull
verbs -= /obj/vehicle/train/cargo/engine/verb/stop_engine
key = new()
var/image/I = new(icon = 'icons/obj/vehicles.dmi', icon_state = "cargo_engine_overlay", layer = src.layer + 0.2) //over mobs
overlays += I
@@ -70,8 +71,8 @@
if(istype(W, /obj/item/weapon/key/cargo_train))
if(!key)
user.drop_item()
W.forceMove(src)
key = W
W.loc = src
verbs += /obj/vehicle/train/cargo/engine/verb/remove_key
return
..()
@@ -97,7 +98,7 @@
var/obj/machinery/door/D = Obstacle
var/mob/living/carbon/human/H = load
if(istype(D) && istype(H))
D.Bumped(H) //a little hacky, but hey, it works, and repects access rights
D.Bumped(H) //a little hacky, but hey, it works, and respects access rights
..()
@@ -194,6 +195,8 @@
turn_on()
if (on)
usr << "You start [src]'s engine."
verbs += /obj/vehicle/train/cargo/engine/verb/stop_engine
verbs -= /obj/vehicle/train/cargo/engine/verb/start_engine
else
if(cell.charge < power_use)
usr << "[src] is out of power."
@@ -215,6 +218,8 @@
turn_off()
if (!on)
usr << "You stop [src]'s engine."
verbs -= /obj/vehicle/train/cargo/engine/verb/stop_engine
verbs += /obj/vehicle/train/cargo/engine/verb/start_engine
/obj/vehicle/train/cargo/engine/verb/remove_key()
set name = "Remove key"
@@ -243,7 +248,7 @@
/obj/vehicle/train/cargo/trolley/load(var/atom/movable/C)
if(ismob(C) && !passenger_allowed)
return 0
if(!istype(C,/obj/machinery) && !istype(C,/obj/structure/closet) && !istype(C,/obj/structure/largecrate) && !istype(C,/obj/structure/reagent_dispensers) && !istype(C,/obj/structure/ore_box) && !ismob(C))
if(!istype(C,/obj/machinery) && !istype(C,/obj/structure/closet) && !istype(C,/obj/structure/largecrate) && !istype(C,/obj/structure/reagent_dispensers) && !istype(C,/obj/structure/ore_box) && !istype(C, /mob/living/carbon/human))
return 0
..()
@@ -255,7 +260,7 @@
return 1
/obj/vehicle/train/cargo/engine/load(var/atom/movable/C)
if(!ismob(C))
if(!istype(C, /mob/living/carbon/human))
return 0
return ..()

View File

@@ -68,8 +68,7 @@
if(user != load)
if(user in src) //for handling players stuck in src - this shouldn't happen - but just in case it does
user.loc = T
contents -= user
user.forceMove(T)
return 1
return 0
@@ -93,8 +92,7 @@
return 0
if(user != load && (user in src))
user.loc = loc //for handling players stuck in src
contents -= user
user.forceMove(loc) //for handling players stuck in src
else if(load)
unload(user) //unload if loaded
else if(!load && !user.buckled)

View File

@@ -50,7 +50,7 @@
anchored = init_anc
if(load)
load.loc = loc
load.forceMove(loc)// = loc
load.dir = dir
return 1
@@ -196,7 +196,7 @@
new /obj/item/weapon/cable_coil/cut(Tsec)
if(cell)
cell.loc = Tsec
cell.forceMove(Tsec)
cell.update_icon()
cell = null
@@ -234,8 +234,8 @@
return
H.drop_from_inventory(C)
C.forceMove(src)
cell = C
C.loc = null //this wont be GC'd since it's referrenced above
powercheck()
usr << "<span class='notice'>You install [C] in [src].</span>"
@@ -244,7 +244,8 @@
return
usr << "<span class='notice'>You remove [cell] from [src].</span>"
cell.loc = get_turf(H)
cell.forceMove(get_turf(H))
H.put_in_hands(cell)
cell = null
powercheck()
@@ -271,7 +272,7 @@
if(istype(crate))
crate.close()
C.loc = loc
C.forceMove(loc)
C.dir = dir
C.anchored = 1
@@ -310,7 +311,7 @@
var/list/options = new()
for(var/test_dir in alldirs)
var/new_dir = get_step_to(src, get_step(src, test_dir))
if(new_dir)
if(new_dir && load.Adjacent(new_dir))
options += new_dir
if(options.len)
dest = pick(options)
@@ -320,8 +321,7 @@
if(!isturf(dest)) //if there still is nowhere to unload, cancel out since the vehicle is probably in nullspace
return 0
load.loc = dest
load.forceMove(dest)
load.dir = get_dir(loc, dest)
load.anchored = initial(load.anchored)
load.pixel_x = initial(load.pixel_x)