mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 04:22:39 +01:00
Pre-update tweaks (#1409)
Remove backup files Reduce Travis' macro count
This commit is contained in:
@@ -139,7 +139,6 @@ world/loop_checks = 0
|
||||
return
|
||||
if(!istype(A))
|
||||
warning("qdel() passed object of type [A.type]. qdel() can only handle /datum types.")
|
||||
crash_with("qdel() passed object of type [A.type]. qdel() can only handle /datum types.")
|
||||
del(A)
|
||||
if(garbage_collector)
|
||||
garbage_collector.total_dels++
|
||||
|
||||
@@ -1,350 +0,0 @@
|
||||
/*
|
||||
Camera monitoring computers
|
||||
|
||||
NOTE: If we actually split the station camera network into regions that will help with sorting through the
|
||||
tediously large list of cameras. The new camnet_key architecture lets you switch between keys easily,
|
||||
so you don't lose the capability of seeing everything, you just switch to a subnet.
|
||||
*/
|
||||
|
||||
/obj/machinery/computer3/security
|
||||
default_prog = /datum/file/program/security
|
||||
spawn_parts = list(/obj/item/part/computer/storage/hdd,/obj/item/part/computer/networking/cameras)
|
||||
spawn_files = list(/datum/file/camnet_key)
|
||||
icon_state = "frame-sec"
|
||||
|
||||
|
||||
/obj/machinery/computer3/security/wooden_tv
|
||||
name = "security cameras"
|
||||
desc = "An old TV hooked into the stations camera network."
|
||||
icon = 'icons/obj/computer.dmi'
|
||||
icon_state = "security_det"
|
||||
|
||||
legacy_icon = 1
|
||||
allow_disassemble = 0
|
||||
|
||||
// No operating system
|
||||
New()
|
||||
..(built=0)
|
||||
os = program
|
||||
circuit.OS = os
|
||||
|
||||
|
||||
/obj/machinery/computer3/security/mining
|
||||
name = "Outpost Cameras"
|
||||
desc = "Used to access the various cameras on the outpost."
|
||||
spawn_files = list(/datum/file/camnet_key/mining)
|
||||
|
||||
/*
|
||||
Camera monitoring computers, wall-mounted
|
||||
*/
|
||||
/obj/machinery/computer3/wall_comp/telescreen
|
||||
default_prog = /datum/file/program/security
|
||||
spawn_parts = list(/obj/item/part/computer/storage/hdd,/obj/item/part/computer/networking/cameras)
|
||||
spawn_files = list(/datum/file/camnet_key)
|
||||
|
||||
/obj/machinery/computer3/wall_comp/telescreen/entertainment
|
||||
desc = "Damn, they better have /tg/thechannel on these things."
|
||||
spawn_files = list(/datum/file/camnet_key/entertainment)
|
||||
|
||||
|
||||
/*
|
||||
File containing an encrypted camera network key.
|
||||
|
||||
(Where by encrypted I don't actually mean encrypted at all)
|
||||
*/
|
||||
/datum/file/camnet_key
|
||||
name = "Security Camera Network Main Key"
|
||||
var/title = "Station"
|
||||
var/desc = "Connects to station security cameras."
|
||||
var/networks = list("ALL") // A little workaround as it is not possible to place station_networks here
|
||||
var/screen = "cameras"
|
||||
|
||||
execute(var/datum/file/source)
|
||||
if(istype(source,/datum/file/program/security))
|
||||
var/datum/file/program/security/prog = source
|
||||
prog.key = src
|
||||
prog.camera_list = null
|
||||
return
|
||||
if(istype(source,/datum/file/program/ntos))
|
||||
for(var/obj/item/part/computer/storage/S in list(computer.hdd,computer.floppy))
|
||||
for(var/datum/file/F in S.files)
|
||||
if(istype(F,/datum/file/program/security))
|
||||
var/datum/file/program/security/Sec = F
|
||||
Sec.key = src
|
||||
Sec.camera_list = null
|
||||
Sec.execute(source)
|
||||
return
|
||||
computer.Crash(MISSING_PROGRAM)
|
||||
|
||||
/datum/file/camnet_key/New()
|
||||
for(var/N in networks)
|
||||
if(N == "ALL")
|
||||
networks = station_networks
|
||||
break
|
||||
return ..()
|
||||
|
||||
/datum/file/camnet_key/mining
|
||||
name = "Mining Camera Network Key"
|
||||
title = "mining station"
|
||||
desc = "Connects to mining security cameras."
|
||||
networks = list(NETWORK_MINE)
|
||||
screen = "miningcameras"
|
||||
|
||||
/datum/file/camnet_key/research
|
||||
name = "Research Camera Network Key"
|
||||
title = "research"
|
||||
networks = list(NETWORK_RESEARCH)
|
||||
|
||||
/datum/file/camnet_key/bombrange
|
||||
name = "R&D Bomb Range Camera Network Key"
|
||||
title = "bomb range"
|
||||
desc = "Monitors the bomb range."
|
||||
networks = list(NETWORK_RESEARCH)
|
||||
|
||||
/datum/file/camnet_key/xeno
|
||||
name = "R&D Misc. Research Camera Network Key"
|
||||
title = "special research"
|
||||
networks = list(NETWORK_RESEARCH)
|
||||
|
||||
/datum/file/camnet_key/singulo
|
||||
name = "Singularity Camera Network Key"
|
||||
title = "singularity"
|
||||
networks = list(NETWORK_ENGINE)
|
||||
|
||||
/datum/file/camnet_key/entertainment
|
||||
name = "Entertainment Channel Encryption Key"
|
||||
title = "entertainment"
|
||||
desc = "Damn, I hope they have /tg/thechannel on here."
|
||||
networks = list(NETWORK_THUNDER)
|
||||
screen = "entertainment"
|
||||
|
||||
/datum/file/camnet_key/creed
|
||||
name = "Special Ops Camera Encryption Key"
|
||||
title = "special ops"
|
||||
desc = "Connects to special ops secure camera feeds."
|
||||
networks = list(NETWORK_ERT)
|
||||
|
||||
/datum/file/camnet_key/prison
|
||||
name = "Prison Camera Network Key"
|
||||
title = "prison"
|
||||
desc = "Monitors the prison."
|
||||
networks = list(NETWORK_SECURITY)
|
||||
|
||||
/datum/file/camnet_key/syndicate
|
||||
name = "Camera Network Key"
|
||||
title = "%!#BUFFER OVERFLOW"
|
||||
desc = "Connects to security cameras."
|
||||
networks = list("ALL")
|
||||
hidden_file = 1
|
||||
|
||||
|
||||
/*
|
||||
Computer part needed to connect to cameras
|
||||
*/
|
||||
|
||||
/obj/item/part/computer/networking/cameras
|
||||
name = "camera network access module"
|
||||
desc = "Connects a computer to the camera network."
|
||||
|
||||
// I have no idea what the following does
|
||||
var/mapping = 0//For the overview file, interesting bit of code.
|
||||
|
||||
//proc/camera_list(var/datum/file/camnet_key/key)
|
||||
get_machines(var/datum/file/camnet_key/key)
|
||||
if (!computer || computer.z > 6)
|
||||
return null
|
||||
|
||||
cameranet.process_sort()
|
||||
|
||||
var/list/L = list()
|
||||
for(var/obj/machinery/camera/C in cameranet.cameras)
|
||||
var/list/temp = C.network & key.networks
|
||||
if(temp.len)
|
||||
L.Add(C)
|
||||
|
||||
return L
|
||||
verify_machine(var/obj/machinery/camera/C,var/datum/file/camnet_key/key = null)
|
||||
if(!istype(C) || !C.can_use())
|
||||
return 0
|
||||
|
||||
if(key)
|
||||
var/list/temp = C.network & key.networks
|
||||
if(!temp.len)
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/*
|
||||
Camera monitoring program
|
||||
|
||||
The following things should break you out of the camera view:
|
||||
* The computer resetting, being damaged, losing power, etc
|
||||
* The program quitting
|
||||
* Closing the window
|
||||
* Going out of range of the computer
|
||||
* Becoming incapacitated
|
||||
* The camera breaking, emping, disconnecting, etc
|
||||
*/
|
||||
|
||||
/datum/file/program/security
|
||||
name = "camera monitor"
|
||||
desc = "Connects to the Nanotrasen Camera Network"
|
||||
image = 'icons/ntos/camera.png'
|
||||
active_state = "camera-static"
|
||||
|
||||
var/datum/file/camnet_key/key = null
|
||||
var/last_pic = 1.0
|
||||
var/last_camera_refresh = 0
|
||||
var/camera_list = null
|
||||
|
||||
var/obj/machinery/camera/current = null
|
||||
|
||||
execute(var/datum/file/program/caller)
|
||||
..(caller)
|
||||
if(computer && !key)
|
||||
var/list/fkeys = computer.list_files(/datum/file/camnet_key)
|
||||
if(fkeys && fkeys.len)
|
||||
key = fkeys[1]
|
||||
update_icon()
|
||||
computer.update_icon()
|
||||
for(var/mob/living/L in viewers(1))
|
||||
if(!istype(L,/mob/living/silicon/ai) && L.machine == src)
|
||||
L.reset_view(null)
|
||||
|
||||
|
||||
Reset()
|
||||
..()
|
||||
reset_current()
|
||||
for(var/mob/living/L in viewers(1))
|
||||
if(!istype(L,/mob/living/silicon/ai) && L.machine == src)
|
||||
L.reset_view(null)
|
||||
|
||||
interact()
|
||||
if(!interactable())
|
||||
return
|
||||
|
||||
if(!computer.camnet)
|
||||
computer.Crash(MISSING_PERIPHERAL)
|
||||
return
|
||||
|
||||
if(!key)
|
||||
var/list/fkeys = computer.list_files(/datum/file/camnet_key)
|
||||
if(fkeys && fkeys.len)
|
||||
key = fkeys[1]
|
||||
update_icon()
|
||||
computer.update_icon()
|
||||
if(!key)
|
||||
return
|
||||
|
||||
if(computer.camnet.verify_machine(current))
|
||||
usr.reset_view(current)
|
||||
|
||||
if(world.time - last_camera_refresh > 50 || !camera_list)
|
||||
last_camera_refresh = world.time
|
||||
|
||||
var/list/temp_list = computer.camnet.get_machines(key)
|
||||
|
||||
camera_list = "Network Key: [key.title] [topic_link(src,"keyselect","\[ Select key \]")]<hr>"
|
||||
for(var/obj/machinery/camera/C in temp_list)
|
||||
if(C.can_use())
|
||||
camera_list += "[C.c_tag] - [topic_link(src,"show=\ref[C]","Show")]<br>"
|
||||
else
|
||||
camera_list += "[C.c_tag] - <b>DEACTIVATED</b><br>"
|
||||
//camera_list += "<br>" + topic_link(src,"close","Close")
|
||||
|
||||
popup.set_content(camera_list)
|
||||
popup.open()
|
||||
|
||||
|
||||
update_icon()
|
||||
if(key)
|
||||
overlay.icon_state = key.screen
|
||||
name = key.title + " Camera Monitor"
|
||||
else
|
||||
overlay.icon_state = "camera-static"
|
||||
name = initial(name)
|
||||
|
||||
|
||||
|
||||
Topic(var/href,var/list/href_list)
|
||||
if(!interactable() || !computer.camnet || ..(href,href_list))
|
||||
return
|
||||
|
||||
if("show" in href_list)
|
||||
var/obj/machinery/camera/C = locate(href_list["show"])
|
||||
if(istype(C) && C.can_use())
|
||||
set_current(C)
|
||||
usr.reset_view(C)
|
||||
return
|
||||
|
||||
if("keyselect" in href_list)
|
||||
reset_current()
|
||||
usr.reset_view(null)
|
||||
key = input(usr,"Select a camera network key:", "Key Select", null) as null|anything in computer.list_files(/datum/file/camnet_key)
|
||||
select_key(key)
|
||||
if(key)
|
||||
interact()
|
||||
else
|
||||
usr << "The screen turns to static."
|
||||
return
|
||||
|
||||
/datum/file/program/security/proc/select_key(var/selected_key)
|
||||
key = selected_key
|
||||
camera_list = null
|
||||
update_icon()
|
||||
computer.update_icon()
|
||||
|
||||
/datum/file/program/security/proc/set_current(var/obj/machinery/camera/C)
|
||||
if(current == C)
|
||||
return
|
||||
|
||||
if(current)
|
||||
reset_current()
|
||||
|
||||
src.current = C
|
||||
if(current)
|
||||
var/mob/living/L = current.loc
|
||||
if(istype(L))
|
||||
L.tracking_initiated()
|
||||
|
||||
/datum/file/program/security/proc/reset_current()
|
||||
if(current)
|
||||
var/mob/living/L = current.loc
|
||||
if(istype(L))
|
||||
L.tracking_cancelled()
|
||||
current = null
|
||||
|
||||
// Atlantis: Required for camnetkeys to work.
|
||||
/datum/file/program/security/hidden
|
||||
hidden_file = 1
|
||||
|
||||
/*
|
||||
Camera monitoring program
|
||||
|
||||
Works much as the parent program, except:
|
||||
* It requires a camera to be found using the proximity network card.
|
||||
* It begins with all cam-access.
|
||||
*/
|
||||
|
||||
/datum/file/program/security/syndicate
|
||||
name = "camer# moni!%r"
|
||||
desc = "Cons the Nanotrash Camera Network"
|
||||
var/special_key = new/datum/file/camnet_key/syndicate
|
||||
var/camera_conn = null
|
||||
|
||||
interact()
|
||||
if(!interactable())
|
||||
return
|
||||
|
||||
if(!computer.net)
|
||||
computer.Crash(MISSING_PERIPHERAL)
|
||||
return
|
||||
|
||||
camera_conn = computer.net.connect_to(/obj/machinery/camera,camera_conn)
|
||||
|
||||
if(!camera_conn)
|
||||
computer.Crash(NETWORK_FAILURE)
|
||||
return
|
||||
|
||||
// On interact, override camera key selection
|
||||
select_key(special_key)
|
||||
..()
|
||||
@@ -1,513 +0,0 @@
|
||||
/area/turret_protected
|
||||
name = "Turret Protected Area"
|
||||
var/list/turretTargets = list()
|
||||
|
||||
/area/turret_protected/proc/subjectDied(target)
|
||||
if( isliving(target) )
|
||||
if( !issilicon(target) )
|
||||
var/mob/living/L = target
|
||||
if( L.stat )
|
||||
if( L in turretTargets )
|
||||
src.Exited(L)
|
||||
|
||||
|
||||
/area/turret_protected/Entered(O)
|
||||
..()
|
||||
if( iscarbon(O) )
|
||||
turretTargets |= O
|
||||
else if( istype(O, /obj/mecha) )
|
||||
var/obj/mecha/Mech = O
|
||||
if( Mech.occupant )
|
||||
turretTargets |= Mech
|
||||
else if(istype(O,/mob/living/simple_animal))
|
||||
turretTargets |= O
|
||||
return 1
|
||||
|
||||
/area/turret_protected/Exited(O)
|
||||
if( ismob(O) && !issilicon(O) )
|
||||
turretTargets -= O
|
||||
else if( istype(O, /obj/mecha) )
|
||||
turretTargets -= O
|
||||
..()
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/turret
|
||||
name = "turret"
|
||||
icon = 'icons/obj/turrets.dmi'
|
||||
icon_state = "grey_target_prism"
|
||||
var/raised = 0
|
||||
var/enabled = 1
|
||||
anchored = 1
|
||||
layer = 3
|
||||
invisibility = INVISIBILITY_LEVEL_TWO
|
||||
density = 1
|
||||
var/lasers = 0
|
||||
var/lasertype = 1
|
||||
// 1 = lasers
|
||||
// 2 = cannons
|
||||
// 3 = pulse
|
||||
// 4 = change (HONK)
|
||||
// 5 = bluetag
|
||||
// 6 = redtag
|
||||
var/health = 80
|
||||
var/maxhealth = 80
|
||||
var/auto_repair = 0
|
||||
var/obj/machinery/turretcover/cover = null
|
||||
var/popping = 0
|
||||
var/wasvalid = 0
|
||||
var/lastfired = 0
|
||||
var/shot_delay = 30 //3 seconds between shots
|
||||
var/datum/effect/effect/system/spark_spread/spark_system
|
||||
use_power = 1
|
||||
idle_power_usage = 50
|
||||
active_power_usage = 300
|
||||
// var/list/targets
|
||||
var/atom/movable/cur_target
|
||||
var/targeting_active = 0
|
||||
var/area/turret_protected/protected_area
|
||||
|
||||
/obj/machinery/turret/proc/take_damage(damage)
|
||||
src.health -= damage
|
||||
if(src.health<=0)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/obj/machinery/turret/attack_hand(var/mob/living/carbon/human/user)
|
||||
|
||||
if(!istype(user))
|
||||
return ..()
|
||||
|
||||
if(user.species.can_shred(user) && !(stat & BROKEN))
|
||||
playsound(src.loc, 'sound/weapons/slash.ogg', 25, 1, -1)
|
||||
visible_message("\red <B>[user] has slashed at [src]!</B>")
|
||||
src.take_damage(15)
|
||||
return
|
||||
|
||||
/obj/machinery/turret/bullet_act(var/obj/item/projectile/Proj)
|
||||
if(!(Proj.damage_type == BRUTE || Proj.damage_type == BURN))
|
||||
return
|
||||
take_damage(Proj.damage)
|
||||
..()
|
||||
return
|
||||
|
||||
/obj/machinery/turret/New()
|
||||
maxhealth = health
|
||||
spark_system = new /datum/effect/effect/system/spark_spread
|
||||
spark_system.set_up(5, 0, src)
|
||||
spark_system.attach(src)
|
||||
// targets = new
|
||||
..()
|
||||
return
|
||||
|
||||
/obj/machinery/turret/proc/update_health()
|
||||
if(src.health<=0)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/obj/machinery/turretcover
|
||||
name = "pop-up turret cover"
|
||||
icon = 'icons/obj/turrets.dmi'
|
||||
icon_state = "turretCover"
|
||||
anchored = 1
|
||||
layer = 3.5
|
||||
density = 0
|
||||
var/obj/machinery/turret/host = null
|
||||
|
||||
/obj/machinery/turret/proc/isPopping()
|
||||
return (popping!=0)
|
||||
|
||||
/obj/machinery/turret/power_change()
|
||||
..()
|
||||
if(stat & BROKEN)
|
||||
icon_state = "grey_target_prism"
|
||||
else
|
||||
if( !(stat & NOPOWER) )
|
||||
if (src.enabled)
|
||||
if (src.lasers)
|
||||
icon_state = "orange_target_prism"
|
||||
else
|
||||
icon_state = "target_prism"
|
||||
else
|
||||
icon_state = "grey_target_prism"
|
||||
stat &= ~NOPOWER
|
||||
else
|
||||
spawn(rand(0, 15))
|
||||
src.icon_state = "grey_target_prism"
|
||||
stat |= NOPOWER
|
||||
|
||||
/obj/machinery/turret/proc/setState(var/enabled, var/lethal)
|
||||
src.enabled = enabled
|
||||
src.lasers = lethal
|
||||
src.power_change()
|
||||
|
||||
|
||||
/obj/machinery/turret/proc/get_protected_area()
|
||||
var/area/turret_protected/TP = get_area(src)
|
||||
if(istype(TP))
|
||||
return TP
|
||||
return
|
||||
|
||||
/obj/machinery/turret/proc/check_target(var/atom/movable/T as mob|obj)
|
||||
if( T && T in protected_area.turretTargets )
|
||||
var/area/area_T = get_area(T)
|
||||
if( !area_T || (area_T.type != protected_area.type) )
|
||||
protected_area.Exited(T)
|
||||
return 0 //If the guy is somehow not in the turret's area (teleportation), get them out the damn list. --NEO
|
||||
if( iscarbon(T) )
|
||||
var/mob/living/carbon/MC = T
|
||||
if( !MC.stat )
|
||||
if( !MC.lying || lasers )
|
||||
return 1
|
||||
else if( istype(T, /obj/mecha) )
|
||||
var/obj/mecha/ME = T
|
||||
if( ME.occupant )
|
||||
return 1
|
||||
else if(istype(T,/mob/living/simple_animal))
|
||||
var/mob/living/simple_animal/A = T
|
||||
if( !A.stat )
|
||||
if(lasers)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/machinery/turret/proc/get_new_target()
|
||||
var/list/new_targets = new
|
||||
var/new_target
|
||||
for(var/mob/living/carbon/M in protected_area.turretTargets)
|
||||
if(!M.stat)
|
||||
if(!M.lying || lasers)
|
||||
new_targets += M
|
||||
for(var/obj/mecha/M in protected_area.turretTargets)
|
||||
if(M.occupant)
|
||||
new_targets += M
|
||||
for(var/mob/living/simple_animal/M in protected_area.turretTargets)
|
||||
if(!M.stat)
|
||||
new_targets += M
|
||||
if(new_targets.len)
|
||||
new_target = pick(new_targets)
|
||||
return new_target
|
||||
|
||||
|
||||
/obj/machinery/turret/process()
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
if(src.cover==null)
|
||||
src.cover = new /obj/machinery/turretcover(src.loc)
|
||||
src.cover.host = src
|
||||
protected_area = get_protected_area()
|
||||
if(!enabled || !protected_area || protected_area.turretTargets.len<=0)
|
||||
if(!isDown() && !isPopping())
|
||||
popDown()
|
||||
return
|
||||
if(!check_target(cur_target)) //if current target fails target check
|
||||
cur_target = get_new_target() //get new target
|
||||
|
||||
if(cur_target) //if it's found, proceed
|
||||
// world << "[cur_target]"
|
||||
if(!isPopping())
|
||||
if(isDown())
|
||||
popUp()
|
||||
use_power = 2
|
||||
else
|
||||
spawn()
|
||||
if(!targeting_active)
|
||||
targeting_active = 1
|
||||
target()
|
||||
targeting_active = 0
|
||||
|
||||
if(prob(15))
|
||||
if(prob(50))
|
||||
playsound(src.loc, 'sound/effects/turret/move1.wav', 60, 1)
|
||||
else
|
||||
playsound(src.loc, 'sound/effects/turret/move2.wav', 60, 1)
|
||||
else if(!isPopping())//else, pop down
|
||||
if(!isDown())
|
||||
popDown()
|
||||
use_power = 1
|
||||
|
||||
// Auto repair requires massive amount of power, but slowly regenerates the turret's health.
|
||||
// Currently only used by malfunction hardware, but may be used as admin-settable option too.
|
||||
if(auto_repair)
|
||||
if(health < maxhealth)
|
||||
use_power(20000)
|
||||
health = min(health + 1, maxhealth)
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/turret/proc/target()
|
||||
while(src && enabled && !stat && check_target(cur_target))
|
||||
src.set_dir(get_dir(src, cur_target))
|
||||
shootAt(cur_target)
|
||||
sleep(shot_delay)
|
||||
return
|
||||
|
||||
/obj/machinery/turret/proc/shootAt(var/atom/movable/target)
|
||||
var/turf/T = get_turf(src)
|
||||
var/turf/U = get_turf(target)
|
||||
if (!T || !U)
|
||||
return
|
||||
var/obj/item/projectile/A
|
||||
if (src.lasers)
|
||||
switch(lasertype)
|
||||
if(1)
|
||||
A = new /obj/item/projectile/beam( loc )
|
||||
if(2)
|
||||
A = new /obj/item/projectile/beam/heavylaser( loc )
|
||||
if(3)
|
||||
A = new /obj/item/projectile/beam/pulse( loc )
|
||||
if(4)
|
||||
A = new /obj/item/projectile/change( loc )
|
||||
if(5)
|
||||
A = new /obj/item/projectile/beam/lastertag/blue( loc )
|
||||
if(6)
|
||||
A = new /obj/item/projectile/beam/lastertag/red( loc )
|
||||
use_power(500)
|
||||
else
|
||||
A = new /obj/item/projectile/energy/electrode( loc )
|
||||
use_power(200)
|
||||
|
||||
//Turrets aim for the center of mass by default.
|
||||
//If the target is grabbing someone then the turret smartly aims for extremities
|
||||
var/def_zone = get_exposed_defense_zone(target)
|
||||
|
||||
A.launch(target, def_zone)
|
||||
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/turret/proc/isDown()
|
||||
return (invisibility!=0)
|
||||
|
||||
/obj/machinery/turret/proc/popUp()
|
||||
if ((!isPopping()) || src.popping==-1)
|
||||
invisibility = 0
|
||||
popping = 1
|
||||
playsound(src.loc, 'sound/effects/turret/open.wav', 60, 1)
|
||||
if (src.cover!=null)
|
||||
flick("popup", src.cover)
|
||||
src.cover.icon_state = "openTurretCover"
|
||||
spawn(10)
|
||||
if (popping==1) popping = 0
|
||||
|
||||
/obj/machinery/turret/proc/popDown()
|
||||
if ((!isPopping()) || src.popping==1)
|
||||
popping = -1
|
||||
playsound(src.loc, 'sound/effects/turret/open.wav', 60, 1)
|
||||
if (src.cover!=null)
|
||||
flick("popdown", src.cover)
|
||||
src.cover.icon_state = "turretCover"
|
||||
spawn(10)
|
||||
if (popping==-1)
|
||||
invisibility = INVISIBILITY_LEVEL_TWO
|
||||
popping = 0
|
||||
|
||||
/obj/machinery/turret/bullet_act(var/obj/item/projectile/Proj)
|
||||
if(!(Proj.damage_type == BRUTE || Proj.damage_type == BURN))
|
||||
return
|
||||
src.health -= Proj.damage
|
||||
..()
|
||||
if(prob(45) && Proj.damage > 0) src.spark_system.start()
|
||||
qdel (Proj)
|
||||
if (src.health <= 0)
|
||||
src.die()
|
||||
return
|
||||
|
||||
/obj/machinery/turret/attackby(obj/item/weapon/W, mob/user)//I can't believe no one added this before/N
|
||||
..()
|
||||
playsound(src.loc, 'sound/weapons/smash.ogg', 60, 1)
|
||||
src.spark_system.start()
|
||||
src.health -= W.force * 0.5
|
||||
if (src.health <= 0)
|
||||
src.die()
|
||||
return
|
||||
|
||||
/obj/machinery/turret/emp_act(severity)
|
||||
switch(severity)
|
||||
if(1)
|
||||
enabled = 0
|
||||
lasers = 0
|
||||
power_change()
|
||||
..()
|
||||
|
||||
/obj/machinery/turret/ex_act(severity)
|
||||
if(severity < 3)
|
||||
src.die()
|
||||
|
||||
/obj/machinery/turret/proc/die()
|
||||
src.health = 0
|
||||
src.density = 0
|
||||
src.stat |= BROKEN
|
||||
src.icon_state = "destroyed_target_prism"
|
||||
if (cover!=null)
|
||||
qdel(cover)
|
||||
sleep(3)
|
||||
flick("explosion", src)
|
||||
spawn(13)
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/turret/attack_generic(var/mob/user, var/damage, var/attack_message)
|
||||
if(!damage)
|
||||
return 0
|
||||
if(stat & BROKEN)
|
||||
user << "That object is useless to you."
|
||||
return 0
|
||||
user.do_attack_animation(src)
|
||||
visible_message("<span class='danger'>[user] [attack_message] the [src]!</span>")
|
||||
user.attack_log += text("\[[time_stamp()]\] <font color='red'>attacked [src.name]</font>")
|
||||
src.health -= damage
|
||||
if (src.health <= 0)
|
||||
src.die()
|
||||
return 1
|
||||
|
||||
/obj/structure/turret/gun_turret
|
||||
name = "Gun Turret"
|
||||
density = 1
|
||||
anchored = 1
|
||||
var/cooldown = 20
|
||||
var/projectiles = 100
|
||||
var/projectiles_per_shot = 2
|
||||
var/deviation = 0.3
|
||||
var/list/exclude = list()
|
||||
var/atom/cur_target
|
||||
var/scan_range = 7
|
||||
var/health = 40
|
||||
var/list/scan_for = list("human"=0,"cyborg"=0,"mecha"=0,"alien"=1)
|
||||
var/on = 0
|
||||
icon = 'icons/obj/turrets.dmi'
|
||||
icon_state = "gun_turret"
|
||||
|
||||
proc/take_damage(damage)
|
||||
src.health -= damage
|
||||
if(src.health<=0)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
|
||||
bullet_act(var/obj/item/projectile/Proj)
|
||||
if(Proj.damage_type == HALLOSS)
|
||||
return
|
||||
take_damage(Proj.damage)
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
ex_act()
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
emp_act()
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
meteorhit()
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
user.set_machine(src)
|
||||
var/dat = {"<html>
|
||||
<head><title>[src] Control</title></head>
|
||||
<body>
|
||||
<b>Power: </b><a href='?src=\ref[src];power=1'>[on?"on":"off"]</a><br>
|
||||
<b>Scan Range: </b><a href='?src=\ref[src];scan_range=-1'>-</a> [scan_range] <a href='?src=\ref[src];scan_range=1'>+</a><br>
|
||||
<b>Scan for: </b>"}
|
||||
for(var/scan in scan_for)
|
||||
dat += "<div style=\"margin-left: 15px;\">[scan] (<a href='?src=\ref[src];scan_for=[scan]'>[scan_for[scan]?"Yes":"No"]</a>)</div>"
|
||||
|
||||
dat += {"<b>Ammo: </b>[max(0, projectiles)]<br>
|
||||
</body>
|
||||
</html>"}
|
||||
user << browse(dat, "window=turret")
|
||||
onclose(user, "turret")
|
||||
return
|
||||
|
||||
attack_ai(mob/user as mob)
|
||||
return attack_hand(user)
|
||||
|
||||
Topic(href, href_list)
|
||||
if(href_list["power"])
|
||||
src.on = !src.on
|
||||
if(src.on)
|
||||
spawn(50)
|
||||
if(src)
|
||||
src.process()
|
||||
if(href_list["scan_range"])
|
||||
src.scan_range = between(1,src.scan_range+text2num(href_list["scan_range"]),8)
|
||||
if(href_list["scan_for"])
|
||||
if(href_list["scan_for"] in scan_for)
|
||||
scan_for[href_list["scan_for"]] = !scan_for[href_list["scan_for"]]
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
|
||||
proc/validate_target(atom/target)
|
||||
if(get_dist(target, src)>scan_range)
|
||||
return 0
|
||||
if(istype(target, /mob))
|
||||
var/mob/M = target
|
||||
if(!M.stat && !M.lying)//ninjas can't catch you if you're lying
|
||||
return 1
|
||||
else if(istype(target, /obj/mecha))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
process()
|
||||
spawn while(on)
|
||||
if(projectiles<=0)
|
||||
on = 0
|
||||
return
|
||||
if(cur_target && !validate_target(cur_target))
|
||||
cur_target = null
|
||||
if(!cur_target)
|
||||
cur_target = get_target()
|
||||
fire(cur_target)
|
||||
sleep(cooldown)
|
||||
return
|
||||
|
||||
proc/get_target()
|
||||
var/list/pos_targets = list()
|
||||
var/target = null
|
||||
if(scan_for["human"])
|
||||
for(var/mob/living/carbon/human/M in oview(scan_range,src))
|
||||
if(M.stat || M.lying || M in exclude)
|
||||
continue
|
||||
pos_targets += M
|
||||
if(scan_for["cyborg"])
|
||||
for(var/mob/living/silicon/M in oview(scan_range,src))
|
||||
if(M.stat || M.lying || M in exclude)
|
||||
continue
|
||||
pos_targets += M
|
||||
if(scan_for["mecha"])
|
||||
for(var/obj/mecha/M in oview(scan_range, src))
|
||||
if(M in exclude)
|
||||
continue
|
||||
pos_targets += M
|
||||
if(scan_for["alien"])
|
||||
for(var/mob/living/carbon/alien/M in oview(scan_range,src))
|
||||
if(M.stat || M.lying || M in exclude)
|
||||
continue
|
||||
pos_targets += M
|
||||
if(pos_targets.len)
|
||||
target = pick(pos_targets)
|
||||
return target
|
||||
|
||||
|
||||
proc/fire(atom/target)
|
||||
if(!target)
|
||||
cur_target = null
|
||||
return
|
||||
src.set_dir(get_dir(src,target))
|
||||
spawn for(var/i=1 to min(projectiles, projectiles_per_shot))
|
||||
if(!src) break
|
||||
var/turf/curloc = get_turf(src)
|
||||
|
||||
playsound(src, 'sound/weapons/Gunshot.ogg', 50, 1)
|
||||
var/obj/item/projectile/A = new /obj/item/projectile(curloc)
|
||||
src.projectiles--
|
||||
|
||||
var/def_zone = get_exposed_defense_zone(target)
|
||||
|
||||
A.launch(target, def_zone)
|
||||
sleep(2)
|
||||
return
|
||||
@@ -1,182 +0,0 @@
|
||||
/mob/var/suiciding = 0
|
||||
|
||||
/mob/living/carbon/human/verb/suicide()
|
||||
set hidden = 1
|
||||
|
||||
if (stat == DEAD)
|
||||
src << "You're already dead!"
|
||||
return
|
||||
|
||||
if (!ticker)
|
||||
src << "You can't commit suicide before the game starts!"
|
||||
return
|
||||
|
||||
if(!player_is_antag(mind))
|
||||
message_admins("[ckey] has tried to suicide, but they were not permitted due to not being antagonist as human.", 1)
|
||||
src << "No. Adminhelp if there is a legitimate reason."
|
||||
return
|
||||
|
||||
if (suiciding)
|
||||
src << "You're already committing suicide! Be patient!"
|
||||
return
|
||||
|
||||
var/confirm = alert("Are you sure you want to commit suicide?", "Confirm Suicide", "Yes", "No")
|
||||
|
||||
if(confirm == "Yes")
|
||||
if(!canmove || restrained()) //just while I finish up the new 'fun' suiciding verb. This is to prevent metagaming via suicide
|
||||
src << "You can't commit suicide whilst restrained! ((You can type Ghost instead however.))"
|
||||
return
|
||||
suiciding = 1
|
||||
var/obj/item/held_item = get_active_hand()
|
||||
if(held_item)
|
||||
var/damagetype = held_item.suicide_act(src)
|
||||
if(damagetype)
|
||||
log_and_message_admins("[key_name(src)] commited suicide using \a [held_item]")
|
||||
var/damage_mod = 1
|
||||
switch(damagetype) //Sorry about the magic numbers.
|
||||
//brute = 1, burn = 2, tox = 4, oxy = 8
|
||||
if(15) //4 damage types
|
||||
damage_mod = 4
|
||||
|
||||
if(6, 11, 13, 14) //3 damage types
|
||||
damage_mod = 3
|
||||
|
||||
if(3, 5, 7, 9, 10, 12) //2 damage types
|
||||
damage_mod = 2
|
||||
|
||||
if(1, 2, 4, 8) //1 damage type
|
||||
damage_mod = 1
|
||||
|
||||
else //This should not happen, but if it does, everything should still work
|
||||
damage_mod = 1
|
||||
|
||||
//Do 175 damage divided by the number of damage types applied.
|
||||
if(damagetype & BRUTELOSS)
|
||||
adjustBruteLoss(30/damage_mod) //hack to prevent gibbing
|
||||
adjustOxyLoss(145/damage_mod)
|
||||
|
||||
if(damagetype & FIRELOSS)
|
||||
adjustFireLoss(175/damage_mod)
|
||||
|
||||
if(damagetype & TOXLOSS)
|
||||
adjustToxLoss(175/damage_mod)
|
||||
|
||||
if(damagetype & OXYLOSS)
|
||||
adjustOxyLoss(175/damage_mod)
|
||||
|
||||
//If something went wrong, just do normal oxyloss
|
||||
if(!(damagetype | BRUTELOSS) && !(damagetype | FIRELOSS) && !(damagetype | TOXLOSS) && !(damagetype | OXYLOSS))
|
||||
adjustOxyLoss(max(175 - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0))
|
||||
|
||||
updatehealth()
|
||||
return
|
||||
|
||||
log_and_message_admins("[key_name(src)] commited suicide")
|
||||
viewers(src) << pick("\red <b>[src] is attempting to bite \his tongue off! It looks like \he's trying to commit suicide.</b>", \
|
||||
"\red <b>[src] is jamming \his thumbs into \his eye sockets! It looks like \he's trying to commit suicide.</b>", \
|
||||
"\red <b>[src] is twisting \his own neck! It looks like \he's trying to commit suicide.</b>", \
|
||||
"\red <b>[src] is holding \his breath! It looks like \he's trying to commit suicide.</b>")
|
||||
adjustOxyLoss(max(175 - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0))
|
||||
updatehealth()
|
||||
|
||||
/mob/living/carbon/brain/verb/suicide()
|
||||
set hidden = 1
|
||||
|
||||
if (stat == 2)
|
||||
src << "You're already dead!"
|
||||
return
|
||||
|
||||
if (!ticker)
|
||||
src << "You can't commit suicide before the game starts!"
|
||||
return
|
||||
|
||||
if (suiciding)
|
||||
src << "You're already committing suicide! Be patient!"
|
||||
return
|
||||
|
||||
var/confirm = alert("Are you sure you want to commit suicide?", "Confirm Suicide", "Yes", "No")
|
||||
|
||||
if(confirm == "Yes")
|
||||
suiciding = 1
|
||||
viewers(loc) << "\red <b>[src]'s brain is growing dull and lifeless. It looks like it's lost the will to live.</b>"
|
||||
spawn(50)
|
||||
death(0)
|
||||
suiciding = 0
|
||||
|
||||
/mob/living/silicon/ai/verb/suicide()
|
||||
set hidden = 1
|
||||
|
||||
if (stat == 2)
|
||||
src << "You're already dead!"
|
||||
return
|
||||
|
||||
if (suiciding)
|
||||
src << "You're already committing suicide! Be patient!"
|
||||
return
|
||||
|
||||
var/confirm = alert("Are you sure you want to commit suicide?", "Confirm Suicide", "Yes", "No")
|
||||
|
||||
if(confirm == "Yes")
|
||||
suiciding = 1
|
||||
viewers(src) << "\red <b>[src] is powering down. It looks like \he's trying to commit suicide.</b>"
|
||||
//put em at -175
|
||||
adjustOxyLoss(max(maxHealth * 2 - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0))
|
||||
updatehealth()
|
||||
|
||||
/mob/living/silicon/robot/verb/suicide()
|
||||
set hidden = 1
|
||||
|
||||
if (stat == 2)
|
||||
src << "You're already dead!"
|
||||
return
|
||||
|
||||
if (suiciding)
|
||||
src << "You're already committing suicide! Be patient!"
|
||||
return
|
||||
|
||||
var/confirm = alert("Are you sure you want to commit suicide?", "Confirm Suicide", "Yes", "No")
|
||||
|
||||
if(confirm == "Yes")
|
||||
suiciding = 1
|
||||
viewers(src) << "\red <b>[src] is powering down. It looks like \he's trying to commit suicide.</b>"
|
||||
//put em at -175
|
||||
adjustOxyLoss(max(maxHealth * 2 - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0))
|
||||
updatehealth()
|
||||
|
||||
/mob/living/silicon/pai/verb/suicide()
|
||||
set category = "pAI Commands"
|
||||
set desc = "Kill yourself and become a ghost (You will receive a confirmation prompt)"
|
||||
set name = "pAI Suicide"
|
||||
var/answer = input("REALLY kill yourself? This action can't be undone.", "Suicide", "No") in list ("Yes", "No")
|
||||
if(answer == "Yes")
|
||||
// var/obj/item/device/paicard/card = loc //why? This was causing runtime errors..
|
||||
card.removePersonality()
|
||||
if(src.loc != card)
|
||||
close_up()
|
||||
var/turf/T = get_turf_or_move(card.loc)
|
||||
for (var/mob/M in viewers(T))
|
||||
M.show_message("\blue [src] flashes a message across its screen, \"Wiping core files. Please acquire a new personality to continue using pAI device functions.\"", 3, "\blue [src] bleeps electronically.", 2)
|
||||
death(0)
|
||||
else
|
||||
src << "Aborting suicide attempt."
|
||||
|
||||
/mob/living/carbon/slime/verb/suicide()
|
||||
set hidden = 1
|
||||
if (stat == 2)
|
||||
src << "You're already dead!"
|
||||
return
|
||||
|
||||
if (suiciding)
|
||||
src << "You're already committing suicide! Be patient!"
|
||||
return
|
||||
|
||||
var/confirm = alert("Are you sure you want to commit suicide?", "Confirm Suicide", "Yes", "No")
|
||||
|
||||
if(confirm == "Yes")
|
||||
suiciding = 1
|
||||
setOxyLoss(100)
|
||||
adjustBruteLoss(100 - getBruteLoss())
|
||||
setToxLoss(100)
|
||||
setCloneLoss(100)
|
||||
|
||||
updatehealth()
|
||||
Reference in New Issue
Block a user