[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-21 16:04:35 -07:00
committed by GitHub
parent fd68853af6
commit 303e88c0b2
141 changed files with 1307 additions and 1386 deletions

View File

@@ -72,7 +72,7 @@
var/wielded_item_state
var/one_handed_penalty = 0 // Penalty applied if someone fires a two-handed gun with one hand.
var/obj/screen/auto_target/auto_target
var/atom/movable/screen/auto_target/auto_target
var/shooting = 0
var/next_fire_time = 0
@@ -266,7 +266,7 @@
auto_target.delay_del = 1//And reset the del so its like they got a new one and doesnt instantly vanish
to_chat(user, span_notice("You ready \the [src]! Click and drag the target around to shoot."))
else//Otherwise just make a new one
auto_target = new/obj/screen/auto_target(get_turf(A), src)
auto_target = new/atom/movable/screen/auto_target(get_turf(A), src)
visible_message(span_danger("\The [user] readies the [src]!"))
playsound(src, 'sound/weapons/targeton.ogg', 50, 1)
to_chat(user, span_notice("You ready \the [src]! Click and drag the target around to shoot."))
@@ -334,7 +334,7 @@
if (istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech. why?
return
if (!( istype(over_object, /obj/screen) ))
if (!( istype(over_object, /atom/movable/screen) ))
return ..()
//makes sure that the thing is equipped, so that we can't drag it into our hand from miles away.
@@ -345,7 +345,7 @@
if (( usr.restrained() ) || ( usr.stat ))
return
if ((src.loc == usr) && !(istype(over_object, /obj/screen)) && !usr.unEquip(src))
if ((src.loc == usr) && !(istype(over_object, /atom/movable/screen)) && !usr.unEquip(src))
return
switch(over_object.name)

View File

@@ -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