Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New year's eve fixes #2271

Merged
merged 15 commits into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions code/__defines/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@
#define PROJECTILE_CONTINUE -1 //if the projectile should continue flying after calling bullet_act()
#define PROJECTILE_FORCE_MISS -2 //if the projectile should treat the attack as a miss (suppresses attack and admin logs) - only applies to mobs.

//Camera capture modes
#define CAPTURE_MODE_REGULAR 0 //Regular polaroid camera mode
#define CAPTURE_MODE_ALL 1 //Admin camera mode
#define CAPTURE_MODE_PARTIAL 3 //Simular to regular mode, but does not do dummy check

//objectives
#define CONFIG_OBJECTIVE_NONE 2
#define CONFIG_OBJECTIVE_VERB 1
Expand Down
103 changes: 57 additions & 46 deletions code/_helpers/icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -872,53 +872,64 @@ The _flatIcons list is a cache for generated icon files.
result.Swap(i, gap + i)
swapped = 1
return result
/*
generate_image function generates image of specified range and location
arguments tx, ty, tz are target coordinates (requred), range defines render distance to opposite corner (requred)
cap_mode is capturing mode (optional), user is capturing mob (requred only wehen cap_mode = CAPTURE_MODE_REGULAR),
lighting determines lighting capturing (optional), suppress_errors suppreses errors and continues to capture (optional).
/**
* Generate_image function generates image of specified range and location:
* * arguments `target_x`, `target_y`, `target_z` are target coordinates (requred).
* * `range` defines render distance to opposite corner (requred).
* * lighting determines lighting capturing (optional), suppress_errors suppreses errors and continues to capture (optional).
* * `checker` is a person from which side will be perfored capture check, should be `/mob/living` target_ype.
*/
/proc/generate_image(var/tx as num, var/ty as num, var/tz as num, var/range as num, var/cap_mode = CAPTURE_MODE_PARTIAL, var/mob/living/user, var/lighting = 1, var/suppress_errors = 1)
var/list/turfstocapture = list()
//Lines below determine what tiles will be rendered
for(var/xoff = 0 to range)
for(var/yoff = 0 to range)
var/turf/T = locate(tx + xoff,ty + yoff,tz)
if(T)
if(cap_mode == CAPTURE_MODE_REGULAR)
if(user.can_capture_turf(T))
turfstocapture.Add(T)
continue
else
turfstocapture.Add(T)
/proc/create_area_image(target_x, target_y, target_z, range, show_lighting = TRUE, mob/living/checker)
// They're all should be set.
ASSERT(target_x)
ASSERT(target_y)
ASSERT(target_z)
ASSERT(range)

// - Collecting list of turfs to render -

var/list/render_turfs = list()
for(var/x_offset = 0 to range)
for(var/y_offset = 0 to range)
var/turf/T = locate(target_x + x_offset, target_y + y_offset, target_z)
if(checker && !checker?.can_capture_turf(T))
continue
else
//Capture includes non-existan turfs
if(!suppress_errors)
return
//Lines below determine what objects will be rendered
var/list/atoms = list()
for(var/turf/T in turfstocapture)
atoms.Add(T)
for(var/atom/A in T)
if(istype(A, /atom/movable/lighting_overlay) && lighting) //Special case for lighting
atoms.Add(A)
render_turfs.Add(T)

// - Collecting list of atoms to render -

var/list/render_atoms = list()
for(var/turf/T as anything in render_turfs)
render_atoms.Add(T)

for(var/atom/A as anything in T)
// In some cases we want to filter lighting overlays.
if(istype(A, /atom/movable/lighting_overlay) && show_lighting)
render_atoms.Add(A)
continue

if(!A.alpha || A.invisibility)
continue
if(A.invisibility) continue
atoms.Add(A)
//Lines below actually render all colected data
atoms = sort_atoms_by_layer(atoms)
var/icon/cap = icon('icons/effects/96x96.dmi', "")
cap.Scale(range*32, range*32)
cap.Blend("#000", ICON_OVERLAY)
for(var/atom/A in atoms)
if(A)
var/icon/img = getFlatIcon(A)
if(istype(img, /icon))
if(istype(A, /mob/living) && A:lying)
img.BecomeLying()
var/xoff = (A.x - tx) * 32
var/yoff = (A.y - ty) * 32
cap.Blend(img, blendMode2iconMode(A.blend_mode), A.pixel_x + xoff, A.pixel_y + yoff)

return cap

render_atoms.Add(A)

// - Performing rendering with collected atoms in list -

render_atoms = sort_atoms_by_layer(render_atoms)
var/icon/capture = icon('icons/effects/96x96.dmi', "")
capture.Scale(range * world.icon_size, range * world.icon_size)
capture.Blend(COLOR_BLACK, ICON_OVERLAY)
for(var/atom/A as anything in render_atoms)
var/icon/image = getFlatIcon(A)
MistakeNot4892 marked this conversation as resolved.
Show resolved Hide resolved

if(ismob(A))
var/mob/M = A
if(M.lying)
image.BecomeLying()

var/x_offset = (A.x - target_x) * world.icon_size
var/y_offset = (A.y - target_y) * world.icon_size
capture.Blend(image, blendMode2iconMode(A.blend_mode), A.pixel_x + x_offset, A.pixel_y + y_offset)

return capture
2 changes: 1 addition & 1 deletion code/_onclick/hud/screen_objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
name = "default attack selector"
icon_state = "attack_selector"
screen_loc = ui_attack_selector
maptext_y = 5
maptext_y = 12
var/mob/living/carbon/human/owner

/obj/screen/default_attack_selector/Click(location, control, params)
Expand Down
21 changes: 15 additions & 6 deletions code/game/machinery/Sleeper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,25 @@
occupant.SetStasis(stasis)

/obj/machinery/sleeper/on_update_icon()
overlays.Cut()
cut_overlays()
icon_state = "med_pod"

if(occupant)
var/image/pickle = new
pickle.appearance = occupant
var/mutable_appearance/pickle = new /mutable_appearance(occupant)
var/list/icon_scale_values = occupant.get_icon_scale_mult()
var/desired_scale_x = icon_scale_values[1]
var/desired_scale_y = icon_scale_values[2]

var/matrix/M = matrix()
M.Scale(desired_scale_x, desired_scale_y)
M.Translate(0, (1.5 * world.icon_size) * (desired_scale_y - 1))
pickle.transform = M

pickle.layer = FLOAT_LAYER
pickle.pixel_z = 12
overlays += pickle
var/image/I = image(icon, "med_lid[!!(occupant && !(stat & (BROKEN|NOPOWER)))]")
overlays += I
add_overlay(pickle)

add_overlay(image(icon, "med_lid[!!(occupant && !(stat & (BROKEN|NOPOWER)))]"))

/obj/machinery/sleeper/DefaultTopicState()
return global.outside_topic_state
Expand Down
17 changes: 16 additions & 1 deletion code/game/objects/items/weapons/storage/storage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
. = (loc == user && istype(over, /obj/screen)) || ..()

/obj/item/storage/handle_mouse_drop(var/atom/over, var/mob/user)
if(canremove && (ishuman(user) || isrobot(user)))
if(canremove && (ishuman(user) || isrobot(user) || isanimal(user)) && !user.incapacitated(INCAPACITATION_DISRUPTED))
MistakeNot4892 marked this conversation as resolved.
Show resolved Hide resolved
if(over == user)
open(user)
return TRUE
Expand All @@ -50,6 +50,21 @@
return TRUE
. = ..()

/obj/item/storage/AltClick(mob/user)
if(!canremove)
return

if(!Adjacent(user))
return

if(!(ishuman(user) || isrobot(user) || issmall(user)))
return

if(user.incapacitated(INCAPACITATION_DISRUPTED))
return

open(user)

/obj/item/storage/proc/return_inv()

var/list/L = list( )
Expand Down
15 changes: 8 additions & 7 deletions code/game/objects/items/weapons/storage/storage_ui/default.dm
Original file line number Diff line number Diff line change
Expand Up @@ -177,21 +177,21 @@
arrange_item_slots(row_num, col_count)

//This proc draws out the inventory and places the items on it. It uses the standard position.
/datum/storage_ui/default/proc/arrange_item_slots(var/rows, var/cols)
var/cx = 4
var/cy = 2+rows
boxes.screen_loc = "LEFT+3:16,BOTTOM+1.7:16 to LEFT+[3+cols]:16,BOTTOM+[1.7+rows]:16"
/datum/storage_ui/default/proc/arrange_item_slots(rows, cols)
var/cx = 3
var/cy = 1.7 + rows
boxes.screen_loc = "LEFT+3:16,BOTTOM+1.7:16 to LEFT+[3 + cols]:16,BOTTOM+[1.7 + rows]:16"

for(var/obj/O in storage.contents)
O.screen_loc = "LEFT+[cx]:16,BOTTOM+[cy]:16"
O.maptext = ""
O.hud_layerise()
cx++
if (cx > (4+cols))
cx = 4
if (cx > (3 + cols))
cx = 3
cy--

closer.screen_loc = "LEFT+[4+cols+1]:16,BOTTOM+2:16"
closer.screen_loc = "LEFT+[3 + cols + 1]:16,BOTTOM+1.7:16"
MistakeNot4892 marked this conversation as resolved.
Show resolved Hide resolved

/datum/storage_ui/default/proc/space_orient_objs()

Expand Down Expand Up @@ -231,6 +231,7 @@
storage_start.overlays += stored_continue
storage_start.overlays += stored_end

O.reset_offsets()
O.screen_loc = "LEFT+3:[round((startpoint+endpoint)/2)+2-O.pixel_x],BOTTOM+1.7:[16-O.pixel_y]"
O.maptext = ""
O.hud_layerise()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/buildmode/areas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Right Click - List/Create Area
var/used_colors = 0
var/list/max_colors = length(distinct_colors)
var/list/vision_colors = list()
for (var/turf/T in range(get_effective_view(user.client), user))
for (var/turf/T in range(user?.client?.view || world.view, user))
MistakeNot4892 marked this conversation as resolved.
Show resolved Hide resolved
var/image/I = new('icons/turf/overlays.dmi', T, "whiteOverlay")
var/ref = "\ref[T.loc]"
if (!vision_colors[ref])
Expand Down
9 changes: 7 additions & 2 deletions code/modules/admin/callproc/callproc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
return CANCEL
switch(input("Type of [arguments.len+1]\th variable", "argument [arguments.len+1]") as null|anything in list(
"finished", "null", "text", "num", "type", "obj reference", "mob reference",
"area/turf reference", "icon", "file", "client", "mob's area", "marked datum", "click on atom"))
"area/turf reference", "icon", "file", "client", "mob's area", "path", "marked datum", "click on atom"))
if(null)
return CANCEL

Expand Down Expand Up @@ -177,6 +177,11 @@
if("Cancel")
return CANCEL

if ("path")
current = text2path(input("Enter path for [arguments.len+1]\th argument") as null|text)
if (isnull(current))
return CANCEL

if("marked datum")
current = C.holder.marked_datum()
if(!current)
Expand Down Expand Up @@ -220,7 +225,7 @@
returnval = call(target, procname)()
else
log_admin("[key_name(src)] called [procname]() with [arguments.len ? "the arguments [list2params(arguments)]" : "no arguments"].")
returnval = call(procname)(arglist(arguments))
returnval = call(text2path("/proc/[procname]"))(arglist(arguments))

to_chat(usr, "<span class='info'>[procname]() returned: [json_encode(returnval)]</span>")
SSstatistics.add_field_details("admin_verb","APC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
Expand Down
6 changes: 3 additions & 3 deletions code/modules/admin/map_capture.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var/ligths = 0
if(alert("Do you want lighting to be included in capture?", "Map Capture", "No", "Yes") == "Yes")
ligths = 1
var/cap = generate_image(tx ,ty ,tz ,range, CAPTURE_MODE_PARTIAL, null, ligths, 1)
var/cap = create_area_image(tx ,ty ,tz, range, ligths)
var/file_name = "map_capture_x[tx]_y[ty]_z[tz]_r[range].png"
to_chat(usr, "Saved capture in cache as [file_name].")
send_rsc(usr, cap, file_name)
Expand All @@ -30,7 +30,7 @@

/datum/admins/proc/capture_map_capture_next(currentz, currentx, currenty, ligths)
if(locate(currentx, currenty, currentz))
var/cap = generate_image(currentx ,currenty ,currentz ,32, CAPTURE_MODE_PARTIAL, null, ligths, 1)
var/cap = create_area_image(currentx,currenty, currentz, 32, ligths)
var/file_name = "map_capture_x[currentx]_y[currenty]_z[currentz]_r32.png"
to_chat(usr, "Saved capture in cache as [file_name].")
send_rsc(usr, cap, file_name)
Expand All @@ -41,7 +41,7 @@
currenty = currenty + 32
currentx = 1
if(locate(currentx, currenty, currentz))
var/cap = generate_image(currentx ,currenty ,currentz ,32, CAPTURE_MODE_PARTIAL, null, ligths, 1)
var/cap = create_area_image(currentx,currenty, currentz, 32, ligths)
var/file_name = "map_capture_x[currentx]_y[currenty]_z[currentz]_r32.png"
to_chat(usr, "Saved capture in cache as [file_name].")
send_rsc(usr, cap, file_name)
Expand Down
23 changes: 12 additions & 11 deletions code/modules/client/client_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -529,17 +529,18 @@ var/global/const/MAX_VIEW = 41
if(mob)
mob.reload_fullscreen()

/client/proc/toggle_fullscreen(new_value)
if((new_value == PREF_BASIC) || (new_value == PREF_FULL))
winset(src, "mainwindow", "is-maximized=false;can-resize=false;titlebar=false")
if(new_value == PREF_FULL)
winset(src, "mainwindow", "menu=null;statusbar=false")
winset(src, "mainwindow.split", "pos=0x0")
else
winset(src, "mainwindow", "is-maximized=false;can-resize=true;titlebar=true")
winset(src, "mainwindow", "menu=menu;statusbar=true")
winset(src, "mainwindow.split", "pos=3x0")
winset(src, "mainwindow", "is-maximized=true")
/client/proc/toggle_fullscreen(value)
set waitfor = FALSE

winset(src, null, {"
mainwindow.is-maximized = false;
mainwindow.can-resize = [(value == PREF_BASIC) || (value == PREF_FULL) ? "false" : "true"];
mainwindow.titlebar = [(value == PREF_BASIC) || (value == PREF_FULL) ? "false" : "true"];
mainwindow.menu = [value == PREF_FULL ? "null" : "menu"];
mainwindow.statusbar = [value == PREF_FULL ? "false" : "true"];
mainwindow.split.pos = [(value == PREF_BASIC) || (value == PREF_FULL) ? "0x0" : "3x0"];
"})
winset(src, null, "mainwindow.is-maximized = true;")
afterthought2 marked this conversation as resolved.
Show resolved Hide resolved

/client/verb/fit_viewport()
set name = "Fit Viewport"
Expand Down
3 changes: 1 addition & 2 deletions code/modules/client/preference_setup/global/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,7 @@ var/global/list/_client_preferences_by_type
/datum/client_preference/fullscreen_mode
description = "Fullscreen Mode"
key = "FULLSCREEN"
options = list(PREF_BASIC, PREF_FULL, PREF_NO)
default_value = PREF_NO
options = list(PREF_NO, PREF_BASIC, PREF_FULL)

/datum/client_preference/fullscreen_mode/changed(mob/preference_mob, new_value)
if(preference_mob.client)
Expand Down
Loading