mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-24 12:37:26 +01:00
Migrate hand teleporter and shooting targets to the new attack chain. (#32239)
* Migrate shooting targets and hand tele to new attack chain. * Add sound to target welding. * Call parent in activate_self() in teleportation.dm Signed-off-by: Alan <alfalfascout@users.noreply.github.com> * Apply suggestion from CRUNCH review. Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com> Signed-off-by: Alan <alfalfascout@users.noreply.github.com> --------- Signed-off-by: Alan <alfalfascout@users.noreply.github.com> Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com>
This commit is contained in:
@@ -5,16 +5,17 @@
|
||||
icon = 'icons/obj/objects.dmi'
|
||||
icon_state = "target_h"
|
||||
var/hp = 1800
|
||||
new_attack_chain = TRUE
|
||||
|
||||
/obj/item/target/Destroy()
|
||||
cut_overlays()
|
||||
// if a target is deleted and associated with a stake, force stake to forget
|
||||
// If a target is deleted and associated with a stake, force stake to forget.
|
||||
for(var/obj/structure/target_stake/T in view(3, src))
|
||||
if(T.pinned_target == src)
|
||||
T.pinned_target = null
|
||||
T.density = TRUE
|
||||
break
|
||||
return ..() // delete target
|
||||
return ..() // Delete target.
|
||||
|
||||
/obj/item/target/Move()
|
||||
..()
|
||||
@@ -28,12 +29,12 @@
|
||||
// a stake's density to 0 meaning it can't be pushed anymore. Instead of pushing
|
||||
// the stake now, we have to push the target.
|
||||
|
||||
|
||||
/obj/item/target/welder_act(mob/user, obj/item/I)
|
||||
/obj/item/target/welder_act(mob/user, obj/item/weldingtool/tool)
|
||||
. = TRUE
|
||||
if(!use_tool(src, user, 0, volume = I.tool_volume))
|
||||
if(!use_tool(src, user, 0, volume = tool.tool_volume))
|
||||
return
|
||||
overlays.Cut()
|
||||
playsound(loc, tool.usesound, 50, 1)
|
||||
to_chat(user, SPAN_NOTICE("You slice off [src]'s uneven chunks of aluminium and scorch marks."))
|
||||
|
||||
/obj/item/target/attack_hand(mob/user)
|
||||
@@ -68,25 +69,25 @@
|
||||
/obj/item/target/syndicate
|
||||
icon_state = "target_s"
|
||||
desc = "A shooting target that looks like a syndicate scum."
|
||||
hp = 2600 // i guess syndie targets are sturdier?
|
||||
hp = 2600 // I guess syndie targets are sturdier?
|
||||
|
||||
/obj/item/target/alien
|
||||
icon_state = "target_q"
|
||||
desc = "A shooting target that looks like a xenomorphic alien."
|
||||
hp = 2350 // alium onest too kinda
|
||||
hp = 2350 // Alium ones too kinda.
|
||||
|
||||
#define DECALTYPE_SCORCH 1
|
||||
#define DECALTYPE_BULLET 2
|
||||
|
||||
/obj/item/target/bullet_act(obj/projectile/P)
|
||||
var/p_x = P.p_x + pick(0,0,0,0,0,-1,1) // really ugly way of coding "sometimes offset P.p_x!"
|
||||
var/p_x = P.p_x + pick(0,0,0,0,0,-1,1) // Really ugly way of coding "sometimes offset P.p_x!"
|
||||
var/p_y = P.p_y + pick(0,0,0,0,0,-1,1)
|
||||
var/decaltype = DECALTYPE_SCORCH
|
||||
if(istype(P, /obj/projectile/bullet))
|
||||
decaltype = DECALTYPE_BULLET
|
||||
|
||||
var/icon/C = icon(icon, icon_state)
|
||||
if(LAZYLEN(overlays) <= 35 && C.GetPixel(p_x, p_y)) // if the located pixel isn't blank (null)
|
||||
if(LAZYLEN(overlays) <= 35 && C.GetPixel(p_x, p_y)) // If the located pixel isn't blank (null).
|
||||
hp -= P.damage
|
||||
if(hp <= 0)
|
||||
visible_message(SPAN_DANGER("[src] breaks into tiny pieces and collapses!"))
|
||||
@@ -97,7 +98,7 @@
|
||||
bullet_hole.pixel_y = p_y - 1
|
||||
if(decaltype == DECALTYPE_SCORCH)
|
||||
if(P.damage >= 20 || istype(P, /obj/projectile/beam/practice))
|
||||
bullet_hole.dir = pick(NORTH,SOUTH,EAST,WEST) // random scorch design. light_scorch does not have different directions
|
||||
bullet_hole.dir = pick(NORTH,SOUTH,EAST,WEST) // Random scorch design. light_scorch does not have different directions.
|
||||
else
|
||||
bullet_hole.icon_state = "light_scorch"
|
||||
else
|
||||
@@ -105,7 +106,7 @@
|
||||
add_overlay(bullet_hole)
|
||||
return
|
||||
|
||||
return -1 // the bullet/projectile goes through the target! Ie, you missed
|
||||
return -1 // The bullet/projectile goes through the target! I.e., you missed.
|
||||
|
||||
#undef DECALTYPE_SCORCH
|
||||
#undef DECALTYPE_BULLET
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
var/active_portals = 0
|
||||
/// Variable contains next time hand tele can be used to make it not EMP proof
|
||||
var/emp_timer = 0
|
||||
new_attack_chain = TRUE
|
||||
|
||||
/obj/item/hand_tele/examine_more(mob/user)
|
||||
. = ..()
|
||||
@@ -42,46 +43,52 @@
|
||||
. = ..()
|
||||
AddElement(/datum/element/high_value_item)
|
||||
|
||||
/obj/item/hand_tele/attack_self__legacy__attackchain(mob/user)
|
||||
/obj/item/hand_tele/activate_self(mob/user)
|
||||
if(..())
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
// The turf the user is currently located in.
|
||||
var/turf/current_location = get_turf(user)
|
||||
if(emp_timer > world.time)
|
||||
do_sparks(5, 0, loc)
|
||||
to_chat(user, SPAN_WARNING("[src] attempts to create a portal, but abruptly shuts off."))
|
||||
return
|
||||
if(!current_location||!is_teleport_allowed(current_location.z))//If turf was not found or they're somewhere teleproof
|
||||
to_chat(user, SPAN_NOTICE("\The [src] is malfunctioning."))
|
||||
return
|
||||
var/list/L = list()
|
||||
to_chat(user, SPAN_WARNING("[src] attempts to create a portal, but abruptly shuts off!"))
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
if(!current_location || !is_teleport_allowed(current_location.z)) // If turf was not found or they're somewhere teleproof.
|
||||
to_chat(user, SPAN_WARNING("[src] is malfunctioning!"))
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
var/list/locations = list()
|
||||
for(var/obj/machinery/computer/teleporter/com in SSmachines.get_by_type(/obj/machinery/computer/teleporter))
|
||||
if(com.target)
|
||||
if(com.power_station && com.power_station.teleporter_hub && com.power_station.engaged)
|
||||
L["[com.id] (Active)"] = com.target
|
||||
locations["[com.id] (Active)"] = com.target
|
||||
else
|
||||
L["[com.id] (Inactive)"] = com.target
|
||||
locations["[com.id] (Inactive)"] = com.target
|
||||
var/list/turfs = list()
|
||||
var/area/A
|
||||
for(var/turf/T in orange(10))
|
||||
if(T.x>world.maxx-8 || T.x<8)
|
||||
continue //putting them at the edge is dumb
|
||||
if(T.y>world.maxy-8 || T.y<8)
|
||||
var/area/each_area
|
||||
for(var/turf/each_turf in orange(10))
|
||||
if(each_turf.x > world.maxx - 8 || each_turf.x < 8)
|
||||
continue // Putting them at the edge is dumb.
|
||||
if(each_turf.y > world.maxy - 8 || each_turf.y < 8)
|
||||
continue
|
||||
A = get_area(T)
|
||||
if(A.tele_proof)
|
||||
each_area = get_area(each_turf)
|
||||
if(each_area.tele_proof)
|
||||
continue // Telescience-proofed areas require a beacon.
|
||||
turfs += T
|
||||
turfs += each_turf
|
||||
if(length(turfs))
|
||||
L["None (Dangerous)"] = pick(turfs)
|
||||
locations["None (Dangerous)"] = pick(turfs)
|
||||
flick("hand_tele_activated", src)
|
||||
var/t1 = tgui_input_list(user, "Please select a teleporter to lock in on.", "Hand Teleporter", L)
|
||||
if(!t1 || (!user.is_in_active_hand(src) || user.stat || user.restrained()))
|
||||
return
|
||||
var/picked_location = tgui_input_list(user, "Please select a teleporter to lock in on.", "Hand Teleporter", locations)
|
||||
if(!picked_location || (!user.is_in_active_hand(src) || user.stat || user.restrained()))
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
if(active_portals >= 3)
|
||||
user.show_message(SPAN_NOTICE("\The [src] is recharging!"))
|
||||
return
|
||||
var/T = L[t1]
|
||||
user.show_message(SPAN_WARNING("[src] is recharging!"))
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
var/destination = locations[picked_location]
|
||||
user.show_message(SPAN_NOTICE("Locked In."), 2)
|
||||
var/obj/effect/portal/P = new /obj/effect/portal/hand_tele(get_turf(src), T, src, creation_mob = user)
|
||||
var/obj/effect/portal/P = new /obj/effect/portal/hand_tele(get_turf(src), destination, src, creation_mob = user)
|
||||
try_move_adjacent(P)
|
||||
active_portals++
|
||||
add_fingerprint(user)
|
||||
|
||||
Reference in New Issue
Block a user