mirror of
https://github.com/goonstation/goonstation-2020.git
synced 2026-07-12 23:52:20 +01:00
036a29b765
includes a lot of small things + fixes. big ones are Simple Lights, New Grab stuff, Disorient Eye/Ear protection armor values, access reprogrammer and deconstruction device also added flabo to the list of contributors, we missed her on the first go! check changelog for full list, i merged that too
257 lines
7.1 KiB
Plaintext
257 lines
7.1 KiB
Plaintext
/obj/machinery/teleport
|
|
name = "teleport"
|
|
icon = 'icons/obj/teleporter.dmi'
|
|
density = 1
|
|
anchored = 1.0
|
|
mats = 10
|
|
deconstruct_flags = DECON_SCREWDRIVER | DECON_WRENCH | DECON_CROWBAR | DECON_WELDER | DECON_WIRECUTTERS | DECON_MULTITOOL
|
|
|
|
New()
|
|
..()
|
|
|
|
/obj/machinery/teleport/portal_ring
|
|
name = "portal ring"
|
|
desc = "Generates a portal which leads to whatever beacon the computer set it to."
|
|
icon_state = "tele0"
|
|
var/obj/machinery/computer/teleporter/linked_computer = null
|
|
var/obj/machinery/teleport/portal_generator/linked_generator = null
|
|
var/datum/light/light
|
|
power_usage = 0
|
|
|
|
New()
|
|
..()
|
|
find_links()
|
|
light = new /datum/light/point
|
|
light.set_brightness(0.6)
|
|
light.set_color(0.4, 0.4, 1)
|
|
light.attach(src)
|
|
|
|
attack_ai()
|
|
src.attack_hand()
|
|
|
|
Bumped(M as mob|obj)
|
|
SPAWN_DBG( 0 )
|
|
if (src.icon_state == "tele1")
|
|
teleport(M)
|
|
use_power(5000)
|
|
return
|
|
return
|
|
|
|
process()
|
|
if (src.icon_state == "tele1") // REALLY. really. really? r e a l l y?
|
|
power_usage = 5000
|
|
else
|
|
power_usage = 0
|
|
..()
|
|
if (status & NOPOWER)
|
|
icon_state = "tele0"
|
|
|
|
proc/teleport(atom/movable/M as mob|obj)
|
|
if (find_links() < 2)
|
|
src.visible_message("<b>[src]</b> intones, \"System error. Cannot find required equipment links.\"")
|
|
return
|
|
if (!linked_computer.locked)
|
|
src.visible_message("<b>[src]</b> intones, \"System error. Cannot verify locked co-ordinates.\"")
|
|
return
|
|
if (istype(M, /atom/movable))
|
|
var/turf/originTurf = get_turf(src)
|
|
var/originArea
|
|
if (originTurf)
|
|
originArea = originTurf.loc
|
|
if (istype(originArea, /area/centcom) || (istype(originArea, /area/shuttle) && originTurf.z == 4)) // If the origin area is centcom or a shuttle on centcom, fail.
|
|
return
|
|
do_teleport(M, linked_computer.locked, 0) //dead-on precision
|
|
else
|
|
var/datum/effects/system/spark_spread/s = unpool(/datum/effects/system/spark_spread)
|
|
s.set_up(5, 1, src)
|
|
s.start()
|
|
|
|
proc/find_links()
|
|
linked_computer = null
|
|
linked_generator = null
|
|
var/found = 0
|
|
for(var/obj/machinery/computer/teleporter/T in orange(2,src))
|
|
linked_computer = T
|
|
found++
|
|
break
|
|
for(var/obj/machinery/teleport/portal_generator/S in orange(2,src))
|
|
linked_generator = S
|
|
found++
|
|
break
|
|
return found
|
|
|
|
/obj/machinery/teleport/portal_generator
|
|
name = "portal generator"
|
|
desc = "This fancy piece of machinery generates the portal. You can flick it on and off."
|
|
icon_state = "controller"
|
|
var/active = 0
|
|
var/engaged = 0
|
|
var/obj/machinery/computer/teleporter/linked_computer = null
|
|
var/list/linked_rings = list()
|
|
power_usage = 250
|
|
|
|
New()
|
|
..()
|
|
find_links()
|
|
|
|
attack_ai()
|
|
src.attack_hand()
|
|
|
|
attack_hand()
|
|
if(engaged)
|
|
src.disengage()
|
|
else
|
|
src.engage()
|
|
|
|
attackby(var/obj/item/W)
|
|
src.attack_hand()
|
|
|
|
power_change()
|
|
..()
|
|
if(status & NOPOWER)
|
|
icon_state = "controller-p"
|
|
if (istype(linked_computer))
|
|
linked_computer.icon_state = "tele0"
|
|
linked_computer.light.disable()
|
|
else
|
|
icon_state = "controller"
|
|
|
|
proc/engage()
|
|
if(status & (BROKEN|NOPOWER))
|
|
return
|
|
if (find_links() < 2)
|
|
src.visible_message("<b>[src]</b> intones, \"System error. Cannot find required equipment links.\"")
|
|
return
|
|
for (var/obj/machinery/teleport/portal_ring/R in linked_rings)
|
|
R.icon_state = "tele1"
|
|
R.light.enable()
|
|
use_power(5000)
|
|
src.visible_message("<b>[src]</b> intones, \"Teleporter engaged.\"")
|
|
src.add_fingerprint(usr)
|
|
src.engaged = 1
|
|
return
|
|
|
|
proc/disengage()
|
|
if(status & (BROKEN|NOPOWER))
|
|
return
|
|
if (find_links() < 2)
|
|
src.visible_message("<b>[src]</b> intones, \"System error. Cannot find required equipment links.\"")
|
|
return
|
|
for (var/obj/machinery/teleport/portal_ring/R in linked_rings)
|
|
R.icon_state = "tele0"
|
|
R.light.disable()
|
|
src.visible_message("<b>[src]</b> intones, \"Teleporter disengaged.\"")
|
|
src.add_fingerprint(usr)
|
|
src.engaged = 0
|
|
return
|
|
|
|
proc/find_links()
|
|
linked_computer = null
|
|
linked_rings = list()
|
|
var/found = 0
|
|
for(var/obj/machinery/computer/teleporter/T in orange(2,src))
|
|
linked_computer = T
|
|
T.linkedportalgen = src
|
|
found++
|
|
break
|
|
for(var/obj/machinery/teleport/portal_ring/H in orange(2,src))
|
|
linked_rings += H
|
|
if (linked_rings.len > 0) found++
|
|
return found
|
|
|
|
/proc/find_loc(obj/R as obj)
|
|
if (!R) return null
|
|
var/turf/T = R.loc
|
|
while(!istype(T, /turf))
|
|
T = T.loc
|
|
if(!T || istype(T, /area)) return null
|
|
return T
|
|
|
|
/proc/do_teleport(atom/movable/M as mob|obj, atom/destination, precision, var/use_teleblocks = 1, var/sparks = 1)
|
|
if(istype(M, /obj/effects))
|
|
qdel(M)
|
|
return
|
|
|
|
var/turf/destturf = get_turf(destination)
|
|
if (!istype(destturf))
|
|
return
|
|
|
|
if (isrestrictedz(destturf.z))
|
|
precision = 0
|
|
|
|
var/tx = destturf.x + rand(precision * -1, precision)
|
|
var/ty = destturf.y + rand(precision * -1, precision)
|
|
|
|
var/turf/tmploc
|
|
|
|
if (ismob(destination.loc)) //If this is an implant.
|
|
tmploc = locate(tx, ty, destturf.z)
|
|
else
|
|
tmploc = locate(tx, ty, destination.z)
|
|
|
|
if(tx == destturf.x && ty == destturf.y && (istype(destination.loc, /obj/storage/closet) || istype(destination.loc, /obj/storage/secure/closet)))
|
|
tmploc = destination.loc
|
|
|
|
if(tmploc==null)
|
|
return
|
|
|
|
var/m_blocked = 0
|
|
|
|
|
|
for (var/atom in teleport_jammers)
|
|
var/atom/A = atom
|
|
if (get_dist(tmploc,A) <= 5)
|
|
if (istype(atom, /obj/machinery/telejam))
|
|
var/obj/machinery/telejam/T = atom
|
|
if (!T.active)
|
|
continue
|
|
var/r = get_dist(T, tmploc)
|
|
if (r > T.range)
|
|
continue
|
|
m_blocked = 1
|
|
break
|
|
|
|
if (get_dist(tmploc,A) <= 4)
|
|
if (istype(atom, /obj/item/device/flockblocker))
|
|
var/obj/item/device/flockblocker/F = atom
|
|
if (!F.active)
|
|
continue
|
|
var/r = get_dist(F, tmploc)
|
|
if (r > F.range)
|
|
continue
|
|
m_blocked = 1
|
|
break
|
|
|
|
//if((istype(tmploc,/area/wizard_station)) || (istype(tmploc,/area/syndicate_station)))
|
|
if ((istype(tmploc.loc, /area) && tmploc.loc:teleport_blocked) || m_blocked)
|
|
if(use_teleblocks)
|
|
if(isliving(M))
|
|
boutput(M, "<span style=\"color:red\"><b>Teleportation failed!</b></span>")
|
|
else
|
|
for(var/mob/thing in M)
|
|
boutput(thing, "<span style=\"color:red\"><b>Teleportation failed!</b></span>")
|
|
return
|
|
|
|
M.set_loc(tmploc)
|
|
if (sparks)
|
|
var/datum/effects/system/spark_spread/s = unpool(/datum/effects/system/spark_spread)
|
|
s.set_up(5, 1, M)
|
|
s.start()
|
|
return
|
|
|
|
// /mob/living/carbon/human/list_ejectables() looked pretty similar to what I wanted, but this doesn't have organs that you need to live
|
|
//drop a non-vital organ or a limb //shamelessly stolen from Harry Potter as is this whole ability
|
|
proc/splinch(var/mob/M as mob, var/probability)
|
|
if (prob(probability))
|
|
if (istype(M, /mob/living/carbon/human))
|
|
var/mob/living/carbon/human/H = M
|
|
var/part_splinched
|
|
|
|
part_splinched = pick("l_arm", "r_arm", "l_leg", "l_leg","left_eye", "right_eye", "left_lung", "right_lung", "butt", "left_kidney", "right_kidney", "spleen", "pancreas", "appendix", "stomach", "intestines")
|
|
if (part_splinched == "l_arm" || part_splinched == "r_arm" || part_splinched == "l_leg" || part_splinched == "l_leg")
|
|
return H.sever_limb(part_splinched)
|
|
else
|
|
return H.organHolder.drop_organ(part_splinched)
|
|
|
|
// owner.visible_message("<span style=\"color:red\"><b>[M]</b> splinches themselves and their [part_splinched] falls off!</span>")
|