diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index b78bf5e34ba..8b4cc9be8cf 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -275,6 +275,10 @@ var/global/list/ghost_accs_options = list(GHOST_ACCS_NONE, GHOST_ACCS_DIR, GHOST #define GHOST_OTHERS_DEFAULT_OPTION GHOST_OTHERS_THEIR_SETTING +#define GHOST_MAX_VIEW_RANGE_DEFAULT 10 +#define GHOST_MAX_VIEW_RANGE_MEMBER 14 + + var/global/list/ghost_others_options = list(GHOST_OTHERS_SIMPLE, GHOST_OTHERS_DEFAULT_SPRITE, GHOST_OTHERS_THEIR_SETTING) //Same as ghost_accs_options. //Color Defines diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index 9cc04f1d513..69aa8548a5f 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -32,9 +32,13 @@ */ /atom/Click(location,control,params) usr.ClickOn(src, params) + /atom/DblClick(location,control,params) usr.DblClickOn(src,params) +/atom/MouseWheel(delta_x,delta_y,location,control,params) + usr.MouseWheelOn(src, delta_x, delta_y, params) + /* Standard mob ClickOn() Handles exceptions: Buildmode, middle click, modified clicks, mech actions @@ -372,3 +376,19 @@ if(T) T.Click(location, control, params) . = 1 + + +/* MouseWheelOn */ + +/mob/proc/MouseWheelOn(atom/A, delta_x, delta_y, params) + return + +/mob/dead/observer/MouseWheelOn(atom/A, delta_x, delta_y, params) + var/list/modifier = params2list(params) + if(modifier["shift"]) + var/view = 0 + if(delta_y > 0) + view = -1 + else + view = 1 + add_view_range(view) \ No newline at end of file diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 93e004cb396..c980f6a0f81 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -323,6 +323,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp if(mind.current.key && copytext(mind.current.key,1,2)!="@") //makes sure we don't accidentally kick any clients usr << "Another consciousness is in your body...It is resisting you." return + client.view = world.view SStgui.on_transfer(src, mind.current) // Transfer NanoUIs. mind.current.key = key return 1 @@ -446,6 +447,29 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp else A << "This mob is not located in the game world." +/mob/dead/observer/verb/change_view_range() + set category = "Ghost" + set name = "View Range" + set desc = "Change your view range." + + var/max_view = client.prefs.unlock_content ? GHOST_MAX_VIEW_RANGE_MEMBER : GHOST_MAX_VIEW_RANGE_DEFAULT + if(client.view == world.view) + var/list/views = list() + for(var/i in 1 to max_view) + views |= i + var/new_view = input("Choose your new view", "Modify view range", 7) as null|anything in views + if(new_view) + client.view = Clamp(new_view, 1, max_view) + else + client.view = world.view + +/mob/dead/observer/verb/add_view_range(input as num) + set name = "Add View Range" + set hidden = TRUE + var/max_view = client.prefs.unlock_content ? GHOST_MAX_VIEW_RANGE_MEMBER : GHOST_MAX_VIEW_RANGE_DEFAULT + if(input) + client.view = Clamp(client.view + input, 1, max_view) + /mob/dead/observer/verb/boo() set category = "Ghost" set name = "Boo!" diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index 4b42ccfa867..28546c41c2c 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -71,3 +71,5 @@ update_client_colour() if(client) client.click_intercept = null + + client.view = world.view // Resets the client.view in case it was changed. \ No newline at end of file diff --git a/interface/skin.dmf b/interface/skin.dmf index 523e6ab422e..a482ca68713 100644 --- a/interface/skin.dmf +++ b/interface/skin.dmf @@ -167,6 +167,14 @@ macro "default" name = "CTRL+NUMPAD8" command = "body-toggle-head" is-disabled = false + elem + name = "CTRL+ADD" + command = "Add-View-Range 1" + is-disabled = false + elem + name = "CTRL+SUBTRACT" + command = "Add-View-Range -1" + is_disabled = false elem name = "F1" command = "adminhelp" @@ -461,6 +469,14 @@ macro "hotkeys" name = "NUMPAD8" command = "body-toggle-head" is-disabled = false + elem + name = "CTRL+ADD" + command = "Add-View-Range 1" + is-disabled = false + elem + name = "CTRL+SUBTRACT" + command = "Add-View-Range -1" + is_disabled = false elem name = "F1" command = "adminhelp"