mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-22 11:38:12 +01:00
Fix Zoomed Item Qdel Loop (#19523)
* lets refactor that * unzoom fix * taur fix
This commit is contained in:
@@ -739,25 +739,24 @@
|
||||
handle_click_empty(user)
|
||||
return
|
||||
|
||||
/obj/item/gun/proc/toggle_scope(zoom_amount=2.0)
|
||||
/obj/item/gun/proc/toggle_scope(mob/user, zoom_amount=2.0)
|
||||
//looking through a scope limits your periphereal vision
|
||||
//still, increase the view size by a tiny amount so that sniping isn't too restricted to NSEW
|
||||
var/zoom_offset = round(world.view * zoom_amount)
|
||||
var/view_size = round(world.view + zoom_amount)
|
||||
var/scoped_accuracy_mod = zoom_offset
|
||||
|
||||
zoom(zoom_offset, view_size)
|
||||
if(zoom)
|
||||
toggle_zoom(user, zoom_offset, view_size)
|
||||
if(zoom) // If zoom in was successful
|
||||
accuracy = scoped_accuracy + scoped_accuracy_mod
|
||||
if(recoil)
|
||||
recoil = round(recoil*zoom_amount+1) //recoil is worse when looking through a scope
|
||||
|
||||
//make sure accuracy and recoil are reset regardless of how the item is unzoomed.
|
||||
/obj/item/gun/zoom()
|
||||
..()
|
||||
if(!zoom)
|
||||
accuracy = initial(accuracy)
|
||||
recoil = initial(recoil)
|
||||
/obj/item/gun/unzoom()
|
||||
. = ..()
|
||||
//make sure accuracy and recoil are reset regardless of how the item is unzoomed.
|
||||
accuracy = initial(accuracy)
|
||||
recoil = initial(recoil)
|
||||
|
||||
/obj/item/gun/examine(mob/user)
|
||||
. = ..()
|
||||
|
||||
@@ -330,7 +330,7 @@
|
||||
set name = "Use Scope"
|
||||
set popup_menu = 1
|
||||
|
||||
toggle_scope(2.0)
|
||||
toggle_scope(usr, 2.0)
|
||||
|
||||
/*
|
||||
* Laser Scattergun (proof of concept)
|
||||
@@ -428,7 +428,7 @@
|
||||
set name = "Aim Down Sights"
|
||||
set popup_menu = 1
|
||||
|
||||
toggle_scope(scope_multiplier)
|
||||
toggle_scope(usr, scope_multiplier)
|
||||
|
||||
/obj/item/gun/energy/monorifle/combat
|
||||
name = "combat mono-rifle"
|
||||
|
||||
@@ -205,7 +205,7 @@
|
||||
set name = "Use Scope"
|
||||
set popup_menu = 1
|
||||
|
||||
toggle_scope(2.0)
|
||||
toggle_scope(usr, 2.0)
|
||||
|
||||
/obj/item/gun/energy/locked/frontier/rifle/update_icon()
|
||||
if(recharging)
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
set name = "Use Scope"
|
||||
set popup_menu = 1
|
||||
|
||||
toggle_scope(2.0)
|
||||
toggle_scope(usr, 2.0)
|
||||
|
||||
////////////// Dragunov Sniper Rifle //////////////
|
||||
|
||||
@@ -111,4 +111,4 @@
|
||||
set name = "Use Scope"
|
||||
set popup_menu = 1
|
||||
|
||||
toggle_scope(2.0)
|
||||
toggle_scope(usr, 2.0)
|
||||
|
||||
Reference in New Issue
Block a user