diff --git a/SQL/paradise_schema.sql b/SQL/paradise_schema.sql
index 90915cc5743..6047042d743 100644
--- a/SQL/paradise_schema.sql
+++ b/SQL/paradise_schema.sql
@@ -291,6 +291,7 @@ CREATE TABLE `player` (
`keybindings` LONGTEXT COLLATE 'utf8mb4_unicode_ci' DEFAULT NULL,
`server_region` VARCHAR(32) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
`muted_adminsounds_ckeys` MEDIUMTEXT NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
+ `viewrange` VARCHAR(5) NOT NULL DEFAULT '19x15' COLLATE 'utf8mb4_general_ci',
PRIMARY KEY (`id`),
UNIQUE KEY `ckey` (`ckey`),
KEY `lastseen` (`lastseen`),
diff --git a/SQL/updates/48-49.sql b/SQL/updates/48-49.sql
new file mode 100644
index 00000000000..a7b4773bc32
--- /dev/null
+++ b/SQL/updates/48-49.sql
@@ -0,0 +1,4 @@
+# Updating SQL from 48 to 49 -AffectedArc07
+# Add new viewrange toggle
+ALTER TABLE `player`
+ ADD COLUMN `viewrange` VARCHAR(5) NOT NULL DEFAULT '19x15' AFTER `muted_adminsounds_ckeys`;
diff --git a/_maps/map_files/generic/centcomm.dmm b/_maps/map_files/generic/centcomm.dmm
index b169f51d7d0..779f2802b21 100644
--- a/_maps/map_files/generic/centcomm.dmm
+++ b/_maps/map_files/generic/centcomm.dmm
@@ -4608,6 +4608,9 @@
},
/turf/simulated/floor/transparent/glass,
/area/centcom/specops)
+"qf" = (
+/turf/simulated/wall/r_wall,
+/area/space)
"qg" = (
/obj/item/twohanded/required/kirbyplants,
/obj/item/storage/secure/safe{
@@ -13471,21 +13474,21 @@ aN
aN
aN
aN
-rE
-rE
-rE
-rE
-rE
-rE
-rE
-rE
-rE
-rE
-rE
-rE
-rE
-rE
-am
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
aN
aN
aN
@@ -13728,21 +13731,21 @@ aN
aN
aN
aN
-rE
-rE
-rE
-rE
-rE
-rE
-rE
-rE
-rE
-rE
-rE
-rE
-rE
-rE
-rE
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
aN
aN
aN
@@ -13999,7 +14002,7 @@ rE
rE
rE
rE
-rE
+am
aN
aN
aN
@@ -15277,7 +15280,7 @@ rE
rE
rE
rE
-ad
+rE
rE
rE
rE
@@ -15791,7 +15794,7 @@ rE
rE
rE
rE
-rE
+ad
rE
rE
rE
@@ -17326,21 +17329,21 @@ ck
ck
ck
aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
+rE
+rE
+rE
+rE
+rE
+rE
+rE
+rE
+rE
+rE
+rE
+rE
+rE
+rE
+rE
aN
aN
aN
@@ -17583,21 +17586,21 @@ ck
ck
ck
aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
+rE
+rE
+rE
+rE
+rE
+rE
+rE
+rE
+rE
+rE
+rE
+rE
+rE
+rE
+rE
aN
aN
aN
@@ -17840,21 +17843,21 @@ ck
ck
ck
aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
aN
aN
aN
@@ -18097,21 +18100,21 @@ ck
ck
ck
aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
-aN
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
+qf
aN
aN
aN
diff --git a/code/__DEFINES/misc_defines.dm b/code/__DEFINES/misc_defines.dm
index 45402cba078..fb9df5b59e2 100644
--- a/code/__DEFINES/misc_defines.dm
+++ b/code/__DEFINES/misc_defines.dm
@@ -103,9 +103,12 @@
#define in_range(source, user) (get_dist(source, user) <= 1)
#define RANGE_TURFS(RADIUS, CENTER) \
+ RECT_TURFS(RADIUS, RADIUS, CENTER)
+
+#define RECT_TURFS(H_RADIUS, V_RADIUS, CENTER) \
block( \
- locate(max(CENTER.x-(RADIUS),1), max(CENTER.y-(RADIUS),1), CENTER.z), \
- locate(min(CENTER.x+(RADIUS),world.maxx), min(CENTER.y+(RADIUS),world.maxy), CENTER.z) \
+ locate(max(CENTER.x-(H_RADIUS),1), max(CENTER.y-(V_RADIUS),1), CENTER.z), \
+ locate(min(CENTER.x+(H_RADIUS),world.maxx), min(CENTER.y+(V_RADIUS),world.maxy), CENTER.z) \
)
/// Returns the turfs on the edge of a square with CENTER in the middle and with the given RADIUS. If used near the edge of the map, will still work fine.
@@ -372,7 +375,7 @@
#define INVESTIGATE_BOMB "bombs"
// The SQL version required by this version of the code
-#define SQL_VERSION 48
+#define SQL_VERSION 49
// Vending machine stuff
#define CAT_NORMAL 1
@@ -531,6 +534,9 @@
#define REFLECTABILITY_PHYSICAL 1
#define REFLECTABILITY_ENERGY 2
+// This isnt in client_defines due to scoping issues
+#define DEFAULT_CLIENT_VIEWSIZE "19x15"
+
// Deadchat control defines
/// Will execute a single command after the cooldown based on player votes.
diff --git a/code/_onclick/hud/hud_datum.dm b/code/_onclick/hud/hud_datum.dm
index 8f28eef4da0..e3dbaf78b26 100644
--- a/code/_onclick/hud/hud_datum.dm
+++ b/code/_onclick/hud/hud_datum.dm
@@ -121,15 +121,6 @@
if(display_hud_version > HUD_VERSIONS) //If the requested version number is greater than the available versions, reset back to the first version
display_hud_version = 1
- if(mymob.client.view < world.view)
- if(mymob.client.view < ARBITRARY_VIEWRANGE_NOHUD)
- to_chat(mymob, "HUD is unavailable with this view range.")
- display_hud_version = HUD_STYLE_NOHUD
- else
- if(display_hud_version == HUD_STYLE_STANDARD)
- to_chat(mymob, "Standard HUD mode is unavailable with a smaller-than-normal view range.")
- display_hud_version = HUD_STYLE_REDUCED
-
switch(display_hud_version)
if(HUD_STYLE_STANDARD) //Default HUD
hud_shown = TRUE //Governs behavior of other procs
diff --git a/code/_onclick/hud/parallax.dm b/code/_onclick/hud/parallax.dm
index eb45c09702a..54db7946baf 100644
--- a/code/_onclick/hud/parallax.dm
+++ b/code/_onclick/hud/parallax.dm
@@ -248,17 +248,24 @@
/obj/screen/parallax_layer/proc/update_o(view)
if(!view)
view = world.view
- var/list/new_overlays = list()
- var/count = CEILING(view/(480/world.icon_size), 1)+1
- for(var/x in -count to count)
- for(var/y in -count to count)
+
+ var/static/parallax_scaler = world.icon_size / 480
+
+ // Turn the view size into a grid of correctly scaled overlays
+ var/list/viewscales = getviewsize(view)
+ var/countx = CEILING((viewscales[1] / 2) * parallax_scaler, 1) + 1
+ var/county = CEILING((viewscales[2] / 2) * parallax_scaler, 1) + 1
+ var/list/new_overlays = new
+ for(var/x in -countx to countx)
+ for(var/y in -county to county)
if(x == 0 && y == 0)
continue
var/mutable_appearance/texture_overlay = mutable_appearance(icon, icon_state)
- texture_overlay.transform = matrix(1, 0, x*480, 0, 1, y*480)
+ texture_overlay.transform = matrix(1, 0, x * 480, 0, 1, y * 480)
new_overlays += texture_overlay
-
- overlays = new_overlays
+ cut_overlays()
+ add_overlay(new_overlays)
+ // Cache this
view_sized = view
/obj/screen/parallax_layer/proc/update_status(mob/M)
diff --git a/code/game/gamemodes/miniantags/demons/slaughter demon/slaughter.dm b/code/game/gamemodes/miniantags/demons/slaughter demon/slaughter.dm
index 461613f99e5..0540e5d280d 100644
--- a/code/game/gamemodes/miniantags/demons/slaughter demon/slaughter.dm
+++ b/code/game/gamemodes/miniantags/demons/slaughter demon/slaughter.dm
@@ -175,7 +175,7 @@
/datum/action/innate/demon/whisper/proc/choose_targets(mob/user = usr)//yes i am copying from telepathy..hush...
var/list/validtargets = list()
- for(var/mob/living/M in view(user.client.view, get_turf(user)))
+ for(var/mob/living/M in view(user.client.maxview(), get_turf(user)))
if(M && M.mind && M.stat != DEAD)
if(M == user)
continue
diff --git a/code/game/objects/items/blueprints.dm b/code/game/objects/items/blueprints.dm
index 0a91b9be764..d6ff9c422d5 100644
--- a/code/game/objects/items/blueprints.dm
+++ b/code/game/objects/items/blueprints.dm
@@ -134,19 +134,22 @@
set_viewer(usr)
attack_self(usr)
-/obj/item/areaeditor/blueprints/proc/get_images(turf/T, viewsize)
+
+/obj/item/areaeditor/blueprints/proc/get_images(turf/central_turf, viewsize)
. = list()
- for(var/tt in RANGE_TURFS(viewsize, T))
- var/turf/TT = tt
- if(TT.blueprint_data)
- . += TT.blueprint_data
+ var/list/dimensions = getviewsize(viewsize)
+ var/horizontal_radius = dimensions[1] / 2
+ var/vertical_radius = dimensions[2] / 2
+ for(var/turf/nearby_turf as anything in RECT_TURFS(horizontal_radius, vertical_radius, central_turf))
+ if(nearby_turf.blueprint_data)
+ . += nearby_turf.blueprint_data
/obj/item/areaeditor/blueprints/proc/set_viewer(mob/user, message = "")
if(user && user.client)
if(viewing)
clear_viewer()
viewing = user.client
- showing = get_images(get_turf(user), viewing.view)
+ showing = get_images(get_turf(viewing.eye || user), viewing.view)
viewing.images |= showing
if(message)
to_chat(user, message)
diff --git a/code/game/objects/items/devices/lightreplacer.dm b/code/game/objects/items/devices/lightreplacer.dm
index 07c2bb70bff..dd7b22349a3 100644
--- a/code/game/objects/items/devices/lightreplacer.dm
+++ b/code/game/objects/items/devices/lightreplacer.dm
@@ -233,7 +233,7 @@
return
if(!isturf(T))
return
- if(get_dist(src, T) >= (U.client.view + 2)) // To prevent people from using it over cameras
+ if(get_dist(src, T) >= (U.client.maxview() + 2)) // To prevent people from using it over cameras
return
var/used = FALSE
diff --git a/code/game/objects/items/weapons/rpd.dm b/code/game/objects/items/weapons/rpd.dm
index 0cb28f2691d..55639bd8087 100644
--- a/code/game/objects/items/weapons/rpd.dm
+++ b/code/game/objects/items/weapons/rpd.dm
@@ -282,7 +282,7 @@
// If we get here, then we're effectively acting on the turf, probably placing a pipe.
if(ranged) //woosh beam if bluespaced at a distance
- if(get_dist(src, T) <= (user.client.view + 2))\
+ if(get_dist(src, T) <= (user.client.maxview() + 2))\
user.Beam(T, icon_state = "rped_upgrade", icon = 'icons/effects/effects.dmi', time = 5)
else
message_admins("\[EXPLOIT] [key_name_admin(user)] attempted to place pipes with a BRPD via a camera console. (Attempted range exploit)")
diff --git a/code/game/objects/items/weapons/stock_parts.dm b/code/game/objects/items/weapons/stock_parts.dm
index 75627cf5c99..7e17d12bb77 100644
--- a/code/game/objects/items/weapons/stock_parts.dm
+++ b/code/game/objects/items/weapons/stock_parts.dm
@@ -24,7 +24,7 @@
/obj/item/storage/part_replacer/afterattack(obj/machinery/M, mob/user, flag, params)
if(!flag && works_from_distance && istype(M))
// Make sure its in range
- if(get_dist(src, M) <= (user.client.view + 2))
+ if(get_dist(src, M) <= (user.client.maxview() + 2))
if(M.component_parts)
M.exchange_parts(user, src)
user.Beam(M,icon_state="rped_upgrade", icon='icons/effects/effects.dmi', time=5)
diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm
index 8112dae7a59..e1a4acb1c4a 100644
--- a/code/game/turfs/turf.dm
+++ b/code/game/turfs/turf.dm
@@ -503,6 +503,8 @@
/turf/proc/add_blueprints(atom/movable/AM)
var/image/I = new
+ I.plane = GAME_PLANE
+ I.layer = OBJ_LAYER
I.appearance = AM.appearance
I.appearance_flags = RESET_COLOR|RESET_ALPHA|RESET_TRANSFORM
I.loc = src
diff --git a/code/modules/client/client_defines.dm b/code/modules/client/client_defines.dm
index 6f59c8656cf..686f2eae34c 100644
--- a/code/modules/client/client_defines.dm
+++ b/code/modules/client/client_defines.dm
@@ -56,7 +56,7 @@
preload_rsc = 0 // This is 0 so we can set it to an URL once the player logs in and have them download the resources from a different server.
- var/global/obj/screen/click_catcher/void
+ var/obj/screen/click_catcher/void
var/ip_intel = "Disabled"
diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm
index 30f8b8569e5..8bf2926bb32 100644
--- a/code/modules/client/client_procs.dm
+++ b/code/modules/client/client_procs.dm
@@ -322,6 +322,9 @@
// ToS accepted
tos_consent = TRUE
+ // Setup widescreen
+ view = prefs.viewrange
+
prefs.init_keybindings(prefs.keybindings_overrides) //The earliest sane place to do it where prefs are not null, if they are null you can't do crap at lobby
prefs.last_ip = address //these are gonna be used for banning
prefs.last_id = computer_id //these are gonna be used for banning
@@ -371,6 +374,10 @@
winset(src, null, "command=\".configure graphics-hwmode off\"")
winset(src, null, "command=\".configure graphics-hwmode on\"")
+ // Try doing this before mob login
+ generate_clickcatcher()
+ apply_clickcatcher()
+
. = ..() //calls mob.Login()
mob.update_client_colour(0) // Activate colourblind mode if they have one set
@@ -394,9 +401,6 @@
// activate_darkmode() calls the CL update button proc, so we dont want it double called
SSchangelog.UpdatePlayerChangelogButton(src)
- generate_clickcatcher()
- apply_clickcatcher()
-
if(show_update_prompt)
show_update_notice()
@@ -433,6 +437,7 @@
to_chat(src, "You are currently connected [prefs.server_region ? "via the [prefs.server_region] relay" : "directly"] to Paradise.")
to_chat(src, "You can change this using the Change Region verb in the OOC tab, as selecting a region closer to you may reduce latency.")
+
/client/proc/is_connecting_from_localhost()
var/static/list/localhost_addresses = list("127.0.0.1", "::1")
if((!address && !world.port) || (address in localhost_addresses))
@@ -1251,6 +1256,11 @@
winset(src, null, "command=\".configure graphics-hwmode off\"")
winset(src, null, "command=\".configure graphics-hwmode on\"")
+/// Returns the biggest number from client.view so we can do easier maths
+/client/proc/maxview()
+ var/list/screensize = getviewsize(view)
+ return max(screensize[1], screensize[2])
+
#undef LIMITER_SIZE
#undef CURRENT_SECOND
#undef SECOND_COUNT
diff --git a/code/modules/client/login_processing/10-load_preferences.dm b/code/modules/client/login_processing/10-load_preferences.dm
index e503a993d2b..94ff3027223 100644
--- a/code/modules/client/login_processing/10-load_preferences.dm
+++ b/code/modules/client/login_processing/10-load_preferences.dm
@@ -28,7 +28,8 @@
colourblind_mode,
keybindings,
server_region,
- muted_adminsounds_ckeys
+ muted_adminsounds_ckeys,
+ viewrange
FROM player
WHERE ckey=:ckey"}, list(
"ckey" = C.ckey
diff --git a/code/modules/client/preference/link_processing.dm b/code/modules/client/preference/link_processing.dm
index 6d7e18e5ffc..f8748353b30 100644
--- a/code/modules/client/preference/link_processing.dm
+++ b/code/modules/client/preference/link_processing.dm
@@ -937,6 +937,24 @@
if("winflash")
toggles2 ^= PREFTOGGLE_2_WINDOWFLASHING
+ if("setviewrange")
+ var/list/viewrange_options = list(
+ "15x15 (Classic)" = "15x15",
+ "17x15 (Wide)" = "17x15",
+ "19x15 (Ultrawide)" = "19x15"
+ )
+
+ var/new_range = input(user, "Select a view range") as anything in viewrange_options
+ var/actual_new_range = viewrange_options[new_range]
+
+ viewrange = actual_new_range
+
+ if(actual_new_range != parent.view)
+ parent.view = actual_new_range
+ // Update the size of the click catcher
+ var/list/actualview = getviewsize(parent.view)
+ parent.void.UpdateGreed(actualview[1],actualview[2])
+
if("afk_watch")
if(!(toggles2 & PREFTOGGLE_2_AFKWATCH))
to_chat(user, "You will now get put into cryo dorms after [GLOB.configuration.afk.auto_cryo_minutes] minutes. \
diff --git a/code/modules/client/preference/preferences.dm b/code/modules/client/preference/preferences.dm
index 8216fffda1e..8697623348c 100644
--- a/code/modules/client/preference/preferences.dm
+++ b/code/modules/client/preference/preferences.dm
@@ -128,6 +128,8 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts
var/server_region = null
/// List of admin ckeys this player wont hear sounds from
var/list/admin_sound_ckey_ignore = list()
+ /// View range preference for this client
+ var/viewrange = DEFAULT_CLIENT_VIEWSIZE
/datum/preferences/New(client/C, datum/db_query/Q) // Process our query
parent = C
@@ -431,6 +433,7 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts
dat += "Play Lobby Music: [(sound & SOUND_LOBBY) ? "Yes" : "No"]
"
dat += "Randomized Character Slot: [toggles2 & PREFTOGGLE_2_RANDOMSLOT ? "Yes" : "No"]
"
dat += "Thought Bubble: [(toggles2 & PREFTOGGLE_2_THOUGHT_BUBBLE) ? "Yes" : "No"]
"
+ dat += "View Range: [viewrange]
"
dat += "Window Flashing: [(toggles2 & PREFTOGGLE_2_WINDOWFLASHING) ? "Yes" : "No"]
"
// RIGHT SIDE OF THE PAGE
dat += "
"
@@ -573,7 +576,7 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts
dat += "Reset Setup"
dat += ""
- var/datum/browser/popup = new(user, "preferences", " Character Setup ", 820, 720)
+ var/datum/browser/popup = new(user, "preferences", "Character Setup ", 820, 770)
popup.set_content(dat.Join(""))
popup.open(FALSE)
diff --git a/code/modules/client/preference/preferences_mysql.dm b/code/modules/client/preference/preferences_mysql.dm
index 2d1719cf15d..390e37ec465 100644
--- a/code/modules/client/preference/preferences_mysql.dm
+++ b/code/modules/client/preference/preferences_mysql.dm
@@ -29,6 +29,7 @@
keybindings = init_keybindings(raw = query.item[22])
server_region = query.item[23]
raw_muted_admins = query.item[24]
+ viewrange = query.item[25]
lastchangelog_2 = lastchangelog // Clone please
@@ -98,7 +99,8 @@
colourblind_mode=:colourblind_mode,
keybindings=:keybindings,
server_region=:server_region,
- muted_adminsounds_ckeys=:muted_adminsounds_ckeys
+ muted_adminsounds_ckeys=:muted_adminsounds_ckeys,
+ viewrange=:viewrange
WHERE ckey=:ckey"}, list(
// OH GOD THE PARAMETERS
"ooccolour" = ooccolor,
@@ -125,6 +127,7 @@
"ckey" = C.ckey,
"server_region" = server_region,
"muted_adminsounds_ckeys" = json_encode(admin_sound_ckey_ignore),
+ "viewrange" = viewrange,
))
if(!query.warn_execute())
diff --git a/code/modules/client/view.dm b/code/modules/client/view.dm
index ac862933afb..48b621c5e3b 100644
--- a/code/modules/client/view.dm
+++ b/code/modules/client/view.dm
@@ -38,22 +38,24 @@
var/datum/viewmod/V = ViewMods[mod_id]
highest_range = max(highest_range, V.size)
- SetView(highest_range ? highest_range : world.view)
+ SetView(highest_range ? highest_range : prefs.viewrange)
ViewModsActive = (highest_range > 0)
/client/proc/SetView(view_range)
- if(view_range == world.view)
+ if(view_range == prefs.viewrange)
winset(src, "mapwindow.map", "icon-size=[ViewPreferedIconSize]")
else
winset(src, "mapwindow.map", "icon-size=0")
view = view_range
- if(mob && mob.hud_used)
+ var/view_range_calc = maxview()
+
+ if(mob?.hud_used)
// If view range is less than world.view, assume the HUD will not fit under normal mode and turn it to reduced
- if(view_range < world.view)
+ if(view_range_calc < world.view)
// If it's really tiny, turn their hud off completely
- if(view_range <= ARBITRARY_VIEWRANGE_NOHUD)
+ if(view_range_calc <= ARBITRARY_VIEWRANGE_NOHUD)
mob.hud_used.show_hud(HUD_STYLE_NOHUD)
else
mob.hud_used.show_hud(HUD_STYLE_REDUCED)
diff --git a/code/modules/mining/lavaland/loot/ashdragon_loot.dm b/code/modules/mining/lavaland/loot/ashdragon_loot.dm
index 058908f38b1..dcf6e895f93 100644
--- a/code/modules/mining/lavaland/loot/ashdragon_loot.dm
+++ b/code/modules/mining/lavaland/loot/ashdragon_loot.dm
@@ -240,7 +240,7 @@
do_sparks(5, FALSE, user)
return
- if(target in view(user.client.view, get_turf(user)))
+ if(target in view(user.client.maxview(), get_turf(user)))
var/turf/simulated/T = get_turf(target)
if(!istype(T))
diff --git a/code/modules/mob/living/carbon/brain/MMI.dm b/code/modules/mob/living/carbon/brain/MMI.dm
index 1614eda90f7..0e14404bbc7 100644
--- a/code/modules/mob/living/carbon/brain/MMI.dm
+++ b/code/modules/mob/living/carbon/brain/MMI.dm
@@ -272,7 +272,7 @@
// As a synthetic, the only limit on visibility is view range
/obj/item/mmi/contents_ui_distance(src_object, mob/living/user)
. = ..()
- if((src_object in view(src)) && get_dist(src_object, src) <= user.client.view)
+ if((src_object in view(src)) && get_dist(src_object, src) <= user.client.maxview())
return STATUS_INTERACTIVE // interactive (green visibility)
return user.shared_living_ui_distance()
diff --git a/code/modules/mob/living/living_life.dm b/code/modules/mob/living/living_life.dm
index ff0619c84d2..8fd00117bee 100644
--- a/code/modules/mob/living/living_life.dm
+++ b/code/modules/mob/living/living_life.dm
@@ -79,7 +79,7 @@
if(!isnum(forced_look))
var/atom/A = locateUID(forced_look)
if(istype(A))
- var/view = client ? client.view : world.view
+ var/view = client ? client.maxview() : world.view
if(get_dist(src, A) > view || !(src in viewers(view, A)))
forced_look = null
to_chat(src, "Your direction target has left your view, you are no longer facing anything.")
diff --git a/code/modules/point/point.dm b/code/modules/point/point.dm
index d62393cad07..5d9506e1731 100644
--- a/code/modules/point/point.dm
+++ b/code/modules/point/point.dm
@@ -148,7 +148,7 @@
point_at(A)
return TRUE
- if(client && !(A in view(client.view, src)))
+ if(client && !(A in view(client.maxview(), src)))
return FALSE
point_at(A)
diff --git a/code/modules/projectiles/firing.dm b/code/modules/projectiles/firing.dm
index 405494de5e7..fe839a0eee7 100644
--- a/code/modules/projectiles/firing.dm
+++ b/code/modules/projectiles/firing.dm
@@ -89,14 +89,14 @@
//Split Y+Pixel_Y up into list(Y, Pixel_Y)
var/list/screen_loc_Y = splittext(screen_loc_params[2],":")
- var/x = text2num(screen_loc_X[1]) * world.icon_size + text2num(screen_loc_X[2]) - world.icon_size + (user.client ? user.client.pixel_x : 0)
- var/y = text2num(screen_loc_Y[1]) * world.icon_size + text2num(screen_loc_Y[2]) - world.icon_size + (user.client ? user.client.pixel_y : 0)
+ var/x = (text2num(screen_loc_X[1]) - 1) * world.icon_size + text2num(screen_loc_X[2])
+ var/y = (text2num(screen_loc_Y[1]) - 1) * world.icon_size + text2num(screen_loc_Y[2])
//Calculate the "resolution" of screen based on client's view and world's icon size. This will work if the user can view more tiles than average.
- var/screenview = (user.client.view * 2 + 1) * world.icon_size //Refer to http://www.byond.com/docs/ref/info.html#/client/var/view for mad maths
+ var/list/screenview = getviewsize(user.client.view)
- var/ox = round(screenview/2) //"origin" x
- var/oy = round(screenview/2) //"origin" y
+ var/ox = round((screenview[1] * world.icon_size) / 2) - user.client.pixel_x //"origin" x
+ var/oy = round((screenview[2] * world.icon_size) / 2) - user.client.pixel_y //"origin" y
var/angle = ATAN2(y - oy, x - ox)
Angle = angle
if(spread)
diff --git a/code/modules/shuttle/navigation_computer.dm b/code/modules/shuttle/navigation_computer.dm
index 963c0a75641..33fa7219a22 100644
--- a/code/modules/shuttle/navigation_computer.dm
+++ b/code/modules/shuttle/navigation_computer.dm
@@ -97,7 +97,7 @@
to_remove += SSshuttle.hidden_shuttle_turf_images
user.client.images -= to_remove
- user.client.SetView(7)
+ user.client.SetView(user.client.prefs.viewrange)
/obj/machinery/computer/camera_advanced/shuttle_docker/proc/placeLandingSpot()
if(designating_target_loc || !current_user)
diff --git a/code/modules/tgui/states/default.dm b/code/modules/tgui/states/default.dm
index fe7385c33b7..1da3895ed5d 100644
--- a/code/modules/tgui/states/default.dm
+++ b/code/modules/tgui/states/default.dm
@@ -31,7 +31,7 @@ GLOBAL_DATUM_INIT(default_state, /datum/ui_state/default, new)
// Robots can interact with anything they can see.
var/list/clientviewlist = getviewsize(client.view)
- if((src_object in view(src)) && (get_dist(src, src_object) <= min(clientviewlist[1],clientviewlist[2])))
+ if((src_object in view(src)) && (get_dist(src, src_object) <= max(clientviewlist[1], clientviewlist[2])))
return STATUS_INTERACTIVE
return STATUS_DISABLED // Otherwise they can keep the UI open.
diff --git a/code/modules/tooltip/tooltip.dm b/code/modules/tooltip/tooltip.dm
index ea6e8c38d47..e53d53adba5 100644
--- a/code/modules/tooltip/tooltip.dm
+++ b/code/modules/tooltip/tooltip.dm
@@ -70,7 +70,8 @@ Notes:
params = {"{ "cursor": "[params]", "screenLoc": "[thing.screen_loc]" }"}
//Send stuff to the tooltip
- owner << output(list2params(list(params, owner.view, "[title][content]", theme, special)), "[control]:tooltip.update")
+ var/view_size = getviewsize(owner.view)
+ owner << output(list2params(list(params, view_size[1] , view_size[2], "[title][content]", theme, special)), "[control]:tooltip.update")
//If a hide() was hit while we were showing, run hide() again to avoid stuck tooltips
showing = 0
diff --git a/code/modules/tooltip/tooltip.html b/code/modules/tooltip/tooltip.html
index 0be70b4229d..1fa8e72e54b 100644
--- a/code/modules/tooltip/tooltip.html
+++ b/code/modules/tooltip/tooltip.html
@@ -90,7 +90,8 @@
'tileSize': 32,
'control': '',
'params': {},
- 'clientView': 0,
+ 'client_view_w': 0,
+ 'client_view_h': 0,
'text': '',
'theme': '',
'padding': 2,
@@ -102,7 +103,7 @@
window.location = 'byond://winset?id='+tooltip.control+';is-visible=false';
},
updateCallback: function(map) {
- if(typeof map === 'undefined' || !map) {return false;}
+ if (typeof map === 'undefined' || !map) {return false;}
//alert(tooltip.params+' | '+tooltip.clientView+' | '+tooltip.text+' | '+tooltip.theme); //DEBUG
@@ -110,36 +111,49 @@
window.location = 'byond://winset?id='+tooltip.control+';anchor1=0,0;size=999x999';
//Get the real icon size according to the client view
+ //FYI, this bit is even more borrowed from goon, our widescreen broke tooltips so I took a look at how they do it
+ //To improve our code. Thanks gooncoders, very cool
var mapWidth = map['view-size'].x,
mapHeight = map['view-size'].y,
- tilesShown = (tooltip.clientView * 2) + 1,
- realIconSize = mapWidth / tilesShown,
- resizeRatio = realIconSize / tooltip.tileSize,
+ tilesShownX = tooltip.client_view_w
+ tilesShownY = tooltip.client_view_h
+ realIconSizeX = mapWidth / tilesShownX,
+ realIconSizeY = mapHeight / tilesShownY,
+ resizeRatioX = realIconSizeX / tooltip.tileSize,
+ resizeRatioY = realIconSizeY / tooltip.tileSize,
//Calculate letterboxing offsets
leftOffset = (map.size.x - mapWidth) / 2,
topOffset = (map.size.y - mapHeight) / 2;
//alert(realIconSize + ' | ' +tooltip.tileSize + ' | ' + resizeRatio); //DEBUG
- //Parse out the tile and cursor locations from params (e.g. "icon-x=32;icon-y=29;screen-loc=3:10,15:29")
+ const parameters = new Object();
+
+ //Parse out the contents of params (e.g. "icon-x=32;icon-y=29;screen-loc=3:10,15:29")
+ //It is worth noting that params is not always ordered in the same way. We therefore need to write the code
+ //To load their values in independantly of their order
var paramsA = tooltip.params.cursor.split(';');
- if(paramsA.length < 3) {return false;} //Sometimes screen-loc is never sent ahaha fuck you byond
+ for (var i = 0; i < paramsA.length; i++) {
+ var entry = paramsA[i];
+ var nameAndValue = entry.split("=");
+ parameters[nameAndValue[0]] = nameAndValue[1];
+ }
+
+ //Sometimes screen-loc is never sent ahaha fuck you byond
+ if (!parameters["icon-x"] || !parameters["icon-y"] || !parameters["screen-loc"]) {
+ return false;
+ }
//icon-x
- var iconX = paramsA[0];
- iconX = iconX.split('=');
- iconX = parseInt(iconX[1]);
+ var iconX = parseInt(parameters["icon-x"]);
//icon-y
- var iconY = paramsA[1];
- iconY = iconY.split('=');
- iconY = parseInt(iconY[1]);
+ var iconY = parseInt(parameters["icon-y"]);
//screen-loc
- var screenLoc = paramsA[2];
- screenLoc = screenLoc.split('=');
- screenLoc = screenLoc[1].split(',');
- if(screenLoc.length < 2) {return false;}
+ var screenLoc = parameters["screen-loc"];
+ screenLoc = screenLoc.split(',');
+ if (screenLoc.length < 2) {return false;}
var left = screenLoc[0];
var top = screenLoc[1];
- if(!left || !top) {return false;}
+ if (!left || !top) {return false;}
screenLoc = left.split(':');
left = parseInt(screenLoc[0]);
var enteredX = parseInt(screenLoc[1]);
@@ -152,30 +166,30 @@
var oScreenLoc = tooltip.params.screenLoc.split(','); //o for original ok
var west = oScreenLoc[0].split(':');
- if(west.length > 1) { //Only if west has a pixel offset
+ if (west.length > 1) { //Only if west has a pixel offset
var westOffset = parseInt(west[1]);
- if(westOffset !== 0) {
- if((iconX + westOffset) !== enteredX) { //Cursor entered on the offset tile
+ if (westOffset !== 0) {
+ if ((iconX + westOffset) !== enteredX) { //Cursor entered on the offset tile
left = left + (westOffset < 0 ? 1 : -1);
}
- leftOffset = leftOffset + (westOffset * resizeRatio);
+ leftOffset = leftOffset + (westOffset * resizeRatioX);
}
}
- if(oScreenLoc.length > 1) { //If north is given
+ if (oScreenLoc.length > 1) { //If north is given
var north = oScreenLoc[1].split(':');
- if(north.length > 1) { //Only if north has a pixel offset
+ if (north.length > 1) { //Only if north has a pixel offset
var northOffset = parseInt(north[1]);
- if(northOffset !== 0) {
- if((iconY + northOffset) === enteredY) { //Cursor entered on the original tile
+ if (northOffset !== 0) {
+ if ((iconY + northOffset) === enteredY) { //Cursor entered on the original tile
top--;
- topOffset = topOffset - ((tooltip.tileSize + northOffset) * resizeRatio);
+ topOffset = topOffset - ((tooltip.tileSize + northOffset) * resizeRatioY);
} else { //Cursor entered on the offset tile
- if(northOffset < 0) { //Offset southwards
- topOffset = topOffset - ((tooltip.tileSize + northOffset) * resizeRatio);
+ if (northOffset < 0) { //Offset southwards
+ topOffset = topOffset - ((tooltip.tileSize + northOffset) * resizeRatioY);
} else { //Offset northwards
top--;
- topOffset = topOffset - (northOffset * resizeRatio);
+ topOffset = topOffset - (northOffset * resizeRatioY);
}
}
}
@@ -183,17 +197,17 @@
}
//Handle special cases (for fuck sake)
- if(tooltip.special !== 'none') {
+ if (tooltip.special !== 'none') {
//Put yo special cases here
}
//Clamp values
- left = (left < 0 ? 0 : (left > tilesShown ? tilesShown : left));
- top = (top < 0 ? 0 : (top > tilesShown ? tilesShown : top));
+ left = (left < 0 ? 0 : (left > tilesShownX ? tilesShownX : left));
+ top = (top < 0 ? 0 : (top > tilesShownY ? tilesShownY : top));
//Calculate where on the screen the popup should appear (below the hovered tile)
- var posX = Math.round(((left - 1) * realIconSize) + leftOffset + tooltip.padding); //-1 to position at the left of the target tile
- var posY = Math.round(((tilesShown - top + 1) * realIconSize) + topOffset + tooltip.padding); //+1 to position at the bottom of the target tile
+ var posX = Math.round(((left - 1) * realIconSizeX) + leftOffset + tooltip.padding); //-1 to position at the left of the target tile
+ var posY = Math.round(((tilesShownY - top + 1) * realIconSizeY) + topOffset + tooltip.padding); //+1 to position at the bottom of the target tile
//alert(mapWidth+' | '+mapHeight+' | '+tilesShown+' | '+realIconSize+' | '+leftOffset+' | '+topOffset+' | '+left+' | '+top+' | '+posX+' | '+posY); //DEBUG
@@ -207,11 +221,16 @@
$wrap.width($wrap.width() + 2); //Dumb hack to fix a bizarre sizing bug
- var docWidth = $wrap.outerWidth(),
- docHeight = $wrap.outerHeight();
+ var pixelRatio = 1;
+ if (window.devicePixelRatio) {
+ pixelRatio = window.devicePixelRatio;
+ }
- if(posY + docHeight > map.size.y) { //Is the bottom edge below the window? Snap it up if so
- posY = (posY - docHeight) - realIconSize - tooltip.padding;
+ var docWidth = Math.floor($wrap.outerWidth() * pixelRatio),
+ docHeight = Math.floor($wrap.outerHeight() * pixelRatio);
+
+ if (posY + docHeight > map.size.y) { //Is the bottom edge below the window? Snap it up if so
+ posY = (posY - docHeight) - realIconSizeY - tooltip.padding;
}
//Actually size, move and show the tooltip box
@@ -221,10 +240,11 @@
tooltip.hide();
});
},
- update: function(params, clientView, text, theme, special) {
+ update: function(params, client_vw , clien_vh , text, theme, special) {
//Assign our global object
tooltip.params = $.parseJSON(params);
- tooltip.clientView = parseInt(clientView);
+ tooltip.client_view_w = parseInt(client_vw);
+ tooltip.client_view_h = parseInt(clien_vh);
tooltip.text = text;
tooltip.theme = theme;
tooltip.special = special;
diff --git a/code/world_definition.dm b/code/world_definition.dm
index 9b4b94a0c3e..924262b8500 100644
--- a/code/world_definition.dm
+++ b/code/world_definition.dm
@@ -5,7 +5,7 @@
mob = /mob/new_player
turf = /turf/space
area = /area/space
- view = "15x15"
+ view = "15x15" // If you ever set this to a non-square value you will need to update a lot of the code!
cache_lifespan = 0 //stops player uploaded stuff from being kept in the rsc past the current session
fps = 20 // If this isnt hard-defined, anything relying on this variable before world load will cry a lot
name = "Paradise Station 13"
diff --git a/config/example/config.toml b/config/example/config.toml
index edf788a9251..cfa0eff8796 100644
--- a/config/example/config.toml
+++ b/config/example/config.toml
@@ -144,7 +144,7 @@ ipc_screens = [
# Enable/disable the database on a whole
sql_enabled = false
# SQL version. If this is a mismatch, round start will be delayed
-sql_version = 48
+sql_version = 49
# SQL server address. Can be an IP or DNS name
sql_address = "127.0.0.1"
# SQL server port
|