[MIRROR] obj screen to atom movable screen (#11719)

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-09-22 01:04:35 +02:00
committed by GitHub
co-authored by Kashargul
parent fd68853af6
commit 303e88c0b2
141 changed files with 1307 additions and 1386 deletions
@@ -5,7 +5,7 @@
//A significant portion of this code was donated by Mport from SS:CM
//This is used by guns shooting in automatic mode
/obj/screen/auto_target
/atom/movable/screen/auto_target
name = "targeter"
icon = null//We dont want people to see this guy
density = FALSE
@@ -14,18 +14,18 @@
var/active = 0//Just tells us that it was clicked on so we should start shooting
var/delay_del = 0//Delays the del if we retarget without shooting
/obj/screen/auto_target/Initialize(mapload, var/obj/item/gun/G)
/atom/movable/screen/auto_target/Initialize(mapload, var/obj/item/gun/G)
. = ..()
gun = G
var/image/I = image('icons/effects/Targeted.dmi', src, "locked")
I.override = 1
usr << I
/obj/screen/auto_target/CanPass()//Everything should ignore this guy and just pass by
/atom/movable/screen/auto_target/CanPass()//Everything should ignore this guy and just pass by
return 1
//Used to get rid of this if they target but dont actually shoot or stop shooting (no ammo) yet are still dragging us around
/obj/screen/auto_target/proc/autodel()
/atom/movable/screen/auto_target/proc/autodel()
set waitfor=0
if(active == 1)
return
@@ -42,7 +42,7 @@
return
//When the player clicks on the target it will disable the autodel and tell the gun to shoot
/obj/screen/auto_target/MouseDown(location,control,params)
/atom/movable/screen/auto_target/MouseDown(location,control,params)
active += 1//Tell the autodel that we are actually using this now
if(gun.shooting == 0)//If we are not shooting start shooting, we need this here or they have to drag to a new turf before it starts shooting, felt weird
gun.Fire(loc, usr, params)
@@ -50,7 +50,7 @@
//Called when they drag the object somewhere else
//If its not already shooting (should be though due to the above, but this does let it click at you when it runs dry) then start shooting,
/obj/screen/auto_target/MouseDrag(over_object,src_location,over_location,src_control,over_control,params)
/atom/movable/screen/auto_target/MouseDrag(over_object,src_location,over_location,src_control,over_control,params)
if(gun.shooting == 0)//If we are not shooting start shooting
gun.Fire(loc, usr, params)
if(over_location != loc)//This updates the loc to our new location when we drag it to a new turf
@@ -59,11 +59,11 @@
qdel(src)
//This gets rid of us when they let go of the click, but only after they actually drag the target to a new turf which is why the below also has to exist
/obj/screen/auto_target/MouseDrop(over_object,src_location,over_location,src_control,over_control,params)
/atom/movable/screen/auto_target/MouseDrop(over_object,src_location,over_location,src_control,over_control,params)
qdel(src)
return
//This is needed so if they just MouseDown and then let go it will stop shooting, otherwise we stick around till they run out of bullets
/obj/screen/auto_target/MouseUp(object,location,control,params)
/atom/movable/screen/auto_target/MouseUp(object,location,control,params)
qdel(src)
return