Files
Paradise/code/game/mecha/mecha_wreckage.dm
T
bad8b31afa Changes all .len to length() where applicable (#25174)
* Globals work

* Double access works

* All other things

* Revert "All other things"

This reverts commit 6574442eb6.

* More changes that compile and work

* IT WORKS AAAAAA

* Changes even more .len to length()

* Apply suggestions from code review

* Update code/datums/mind.dm

* Update code/__HELPERS/sorts/InsertSort.dm

Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>

* Update code/__HELPERS/sanitize_values.dm

Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>

---------

Co-authored-by: FunnyMan3595 (Charlie Nolan) <funnyman@google.com>
Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>
2024-04-19 17:32:09 +00:00

221 lines
8.1 KiB
Plaintext

///////////////////////////////////
//////// Mecha wreckage ////////
///////////////////////////////////
/obj/structure/mecha_wreckage
name = "exosuit wreckage"
desc = "Remains of some unfortunate mecha. Completely unrepairable, but perhaps something can be salvaged."
icon = 'icons/mecha/mecha.dmi'
density = TRUE
anchored = FALSE
opacity = FALSE
var/list/welder_salvage = list(/obj/item/stack/sheet/plasteel, /obj/item/stack/sheet/metal, /obj/item/stack/rods)
var/salvage_num = 5
var/list/crowbar_salvage = list()
var/wires_removed = FALSE
var/mob/living/silicon/ai/AI //AIs to be salvaged
var/list/parts
/obj/structure/mecha_wreckage/Initialize(mapload, mob/living/silicon/ai/AI_pilot)
. = ..()
if(parts)
for(var/i in 1 to 2)
if(!length(parts))
break
if(prob(60))
continue
var/part = pick(parts)
welder_salvage += part
parts = null
if(!AI_pilot) //Type-checking for this is already done in mecha/Destroy()
return
AI = AI_pilot
AI.apply_damage(150, BURN) //Give the AI a bit of damage from the "shock" of being suddenly shut down
AI.death() //The damage is not enough to kill the AI, but to be 'corrupted files' in need of repair.
AI.forceMove(src) //Put the dead AI inside the wreckage for recovery
add_overlay(mutable_appearance('icons/obj/projectiles.dmi', "green_laser")) //Overlay for the recovery beacon
AI.controlled_mech = null
AI.remote_control = null
/obj/structure/mecha_wreckage/Destroy()
QDEL_NULL(AI)
QDEL_LIST_CONTENTS(crowbar_salvage)
return ..()
/obj/structure/mecha_wreckage/examine(mob/user)
. = ..()
if(!AI)
return
. += "<span class='notice'>The AI recovery beacon is active.</span>"
/obj/structure/mecha_wreckage/crowbar_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(length(crowbar_salvage))
var/obj/S = pick(crowbar_salvage)
S.forceMove(user.drop_location())
user.visible_message("<span class='notice'>[user] pries [S] from [src].</span>", "<span class='notice'>You pry [S] from [src].</span>")
crowbar_salvage -= S
return
to_chat(user, "<span class='notice'>You don't see anything that can be pried with [I]!</span>")
/obj/structure/mecha_wreckage/welder_act(mob/user, obj/item/I)
. = TRUE
if(!I.tool_use_check(user, 0))
return
if(salvage_num <= 0 || !length(welder_salvage))
to_chat(user, "<span class='notice'>You don't see anything that can be cut with [I]!</span>")
return
if(prob(30))
to_chat(user, "<span class='notice'>You fail to salvage anything valuable from [src]!</span>")
return
var/type = pick(welder_salvage)
var/N = new type(get_turf(user))
user.visible_message("[user] cuts [N] from [src].", "<span class='notice'>You cut [N] from [src].</span>")
if(!istype(N, /obj/item/stack))
welder_salvage -= type
salvage_num--
/obj/structure/mecha_wreckage/wirecutter_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(wires_removed)
to_chat(user, "<span class='notice'>You don't see anything that can be cut with [I]!</span>")
return
var/N = new /obj/item/stack/cable_coil(get_turf(user), rand(1, 3))
user.visible_message("[user] cuts [N] from [src].", "<span class='notice'>You cut [N] from [src].</span>")
wires_removed = TRUE
/obj/structure/mecha_wreckage/transfer_ai(interaction, mob/user, mob/living/silicon/ai/the_ai, obj/item/aicard/card)
if(!..())
return
//Proc called on the wreck by the AI card.
if(interaction != AI_TRANS_TO_CARD) //AIs can only be transferred in one direction, from the wreck to the card.
return
if(!AI) //No AI in the wreck
to_chat(user, "<span class='warning'>No AI backups found.</span>")
return
cut_overlays() //Remove the recovery beacon overlay
AI.forceMove(card) //Move the dead AI to the card.
if(AI.client) //AI player is still in the dead AI and is connected
to_chat(AI, "The remains of your file system have been recovered on a mobile storage device.")
else //Give the AI a heads-up that it is probably going to get fixed.
AI.notify_ghost_cloning("You have been recovered from the wreckage!", source = card)
to_chat(user, "<span class='boldnotice'>Backup files recovered</span>: [AI.name] ([rand(1000, 9999)].exe) salvaged from [name] and stored within local memory.")
AI = null
/obj/structure/mecha_wreckage/gygax
name = "\improper Gygax wreckage"
icon_state = "gygax-broken"
parts = list(
/obj/item/mecha_parts/part/gygax_torso,
/obj/item/mecha_parts/part/gygax_head,
/obj/item/mecha_parts/part/gygax_left_arm,
/obj/item/mecha_parts/part/gygax_right_arm,
/obj/item/mecha_parts/part/gygax_left_leg,
/obj/item/mecha_parts/part/gygax_right_leg
)
/obj/structure/mecha_wreckage/gygax/dark
name = "\improper Dark Gygax wreckage"
icon_state = "darkgygax-broken"
/obj/structure/mecha_wreckage/marauder
name = "\improper Marauder wreckage"
icon_state = "marauder-broken"
/obj/structure/mecha_wreckage/ares
name = "\improper Ares wreckage"
icon_state = "ares-broken"
desc = "The truth is you lost an expensive piece of Nanotrasen-issue equipment. That suit is going to come out of your pay, and you will remain in this corporation until you are five hundred and ten years old, which is the number of years it will take for you to pay for an Ares Biohazard Containment Exosuit you have lost!"
/obj/structure/mecha_wreckage/mauler
name = "\improper Mauler wreckage"
icon_state = "mauler-broken"
desc = "The syndicate won't be very happy about this..."
/obj/structure/mecha_wreckage/seraph
name = "\improper Seraph wreckage"
icon_state = "seraph-broken"
/obj/structure/mecha_wreckage/reticence
name = "\improper Reticence wreckage"
icon_state = "reticence-broken"
color = "#87878715"
desc = "..."
/obj/structure/mecha_wreckage/ripley
name = "\improper Ripley wreckage"
icon_state = "ripley-broken"
parts = list(/obj/item/mecha_parts/part/ripley_torso,
/obj/item/mecha_parts/part/ripley_left_arm,
/obj/item/mecha_parts/part/ripley_right_arm,
/obj/item/mecha_parts/part/ripley_left_leg,
/obj/item/mecha_parts/part/ripley_right_leg)
/obj/structure/mecha_wreckage/ripley/mkii
name = "\improper Ripley MK-II wreckage"
icon_state = "ripleymkii-broken"
/obj/structure/mecha_wreckage/ripley/firefighter
name = "\improper Firefighter wreckage"
icon_state = "firefighter-broken"
parts = list(/obj/item/mecha_parts/part/ripley_torso,
/obj/item/mecha_parts/part/ripley_left_arm,
/obj/item/mecha_parts/part/ripley_right_arm,
/obj/item/mecha_parts/part/ripley_left_leg,
/obj/item/mecha_parts/part/ripley_right_leg,
/obj/item/clothing/suit/fire)
/obj/structure/mecha_wreckage/ripley/deathripley
name = "\improper Death-Ripley wreckage"
icon_state = "deathripley-broken"
parts = null
/obj/structure/mecha_wreckage/honker
name = "\improper H.O.N.K wreckage"
icon_state = "honker-broken"
desc = "All is right in the universe."
parts = list(
/obj/item/mecha_parts/chassis/honker,
/obj/item/mecha_parts/part/honker_torso,
/obj/item/mecha_parts/part/honker_head,
/obj/item/mecha_parts/part/honker_left_arm,
/obj/item/mecha_parts/part/honker_right_arm,
/obj/item/mecha_parts/part/honker_left_leg,
/obj/item/mecha_parts/part/honker_right_leg)
/obj/structure/mecha_wreckage/durand
name = "\improper Durand wreckage"
icon_state = "durand-broken"
parts = list(
/obj/item/mecha_parts/part/durand_torso,
/obj/item/mecha_parts/part/durand_head,
/obj/item/mecha_parts/part/durand_left_arm,
/obj/item/mecha_parts/part/durand_right_arm,
/obj/item/mecha_parts/part/durand_left_leg,
/obj/item/mecha_parts/part/durand_right_leg)
/obj/structure/mecha_wreckage/durand/old
icon_state = "old_durand-broken"
/obj/structure/mecha_wreckage/phazon
name = "\improper Phazon wreckage"
icon_state = "phazon-broken"
/obj/structure/mecha_wreckage/odysseus
name = "\improper Odysseus wreckage"
icon_state = "odysseus-broken"
parts = list(
/obj/item/mecha_parts/part/odysseus_torso,
/obj/item/mecha_parts/part/odysseus_head,
/obj/item/mecha_parts/part/odysseus_left_arm,
/obj/item/mecha_parts/part/odysseus_right_arm,
/obj/item/mecha_parts/part/odysseus_left_leg,
/obj/item/mecha_parts/part/odysseus_right_leg)