Adds global var for the nukedisk and fixes the advanced pinpointer (#12128)

* Adds global var for the nukedisk and fixes the advanced pinpointer.

* Changelog

* Removes redundancy
This commit is contained in:
BarneyGumball
2016-10-12 07:19:44 +10:00
committed by clusterfack
parent ec76ea829a
commit ffbc6b018b
5 changed files with 33 additions and 36 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,5 @@
var/bomb_set
var/obj/item/weapon/disk/nuclear/nukedisk
/obj/machinery/nuclearbomb
name = "\improper Nuclear Fission Explosive"
@@ -347,15 +348,15 @@ var/bomb_set
item_state = "card-id"
w_class = W_CLASS_TINY
var/respawned = 0
var/watched_by = list()
/obj/item/weapon/disk/nuclear/New()
..()
if(!nukedisk)
nukedisk = src
/obj/item/weapon/disk/nuclear/Destroy()
..()
replace_disk()
for(var/obj/item/weapon/pinpointer/pinpointers in watched_by)
if(pinpointers.the_disk == src)
pinpointers.the_disk = null
watched_by = null
/**
* NOTE: Don't change it to Destroy().
@@ -365,11 +366,11 @@ var/bomb_set
..()
/obj/item/weapon/disk/nuclear/proc/replace_disk()
if(blobstart.len > 0 && !respawned)
if(blobstart.len > 0 && !respawned && (nukedisk == src))
var/picked_turf = get_turf(pick(blobstart))
var/picked_area = formatLocation(picked_turf)
var/log_message = "[type] has been destroyed. Creating one at"
log_game("[log_message] [picked_area]")
message_admins("[log_message] [formatJumpTo(picked_turf, picked_area)]")
new /obj/item/weapon/disk/nuclear(picked_turf)
nukedisk = new /obj/item/weapon/disk/nuclear(picked_turf)
respawned = 1

View File

@@ -12,7 +12,7 @@
starting_materials = list(MAT_IRON = 500)
w_type = RECYK_ELECTRONIC
melt_temperature = MELTPOINT_STEEL
var/obj/item/weapon/disk/nuclear/the_disk = null
var/obj/target = null // this can be used to override disk tracking on normal pinpointers (ie. for shunted malf ais)
var/active = 0
var/watches_nuke = 1
@@ -34,13 +34,13 @@
processing_objects -= src
/obj/item/weapon/pinpointer/proc/workdisk()
if(!the_disk)
the_disk = locate()
the_disk.watched_by += src
process()
/obj/item/weapon/pinpointer/process()
point_at(the_disk)
if(target)
point_at(target)
return
point_at(nukedisk)
/obj/item/weapon/pinpointer/proc/point_at(atom/target)
if(!active)
@@ -89,7 +89,6 @@
desc = "A larger version of the normal pinpointer, this unit features a helpful quantum entanglement detection system to locate various objects that do not broadcast a locator signal."
var/mode = 0 // Mode 0 locates disk, mode 1 locates coordinates.
var/turf/location = null
var/obj/target = null
watches_nuke = 0
/obj/item/weapon/pinpointer/advpinpointer/attack_self()
@@ -107,7 +106,7 @@
/obj/item/weapon/pinpointer/advpinpointer/process()
switch(mode)
if(0)
workdisk()
point_at(nukedisk)
if(1)
point_at(location)
if(2)
@@ -151,15 +150,14 @@
mode = 2
switch(alert("Search for item signature or DNA fragment?" , "Signature Mode Select" , "" , "Item" , "DNA"))
if("Item")
var/list/item_names[0]
var/list/item_paths[0]
for(var/typepath in potential_theft_objectives)
var/obj/item/tmp_object=new typepath
var/n="[tmp_object]"
item_names+=n
item_paths[n]=typepath
qdel(tmp_object)
var/targetitem = input("Select item to search for.", "Item Mode Select","") as null|anything in potential_theft_objectives
for(var/index in potential_theft_objectives)
var/list/datumlist = potential_theft_objectives[index]
for(var/D in datumlist)
var/datum/theft_objective/O = D
var/obj/Dtypepath = initial(O.typepath)
item_paths[initial(Dtypepath.name)] = Dtypepath
var/targetitem = input("Select item to search for.", "Item Mode Select","") as null|anything in item_paths
if(!targetitem)
return
target=locate(item_paths[targetitem])
@@ -220,14 +218,7 @@
playsound(loc, 'sound/machines/twobeep.ogg', 50, 1) //Plays a beep
visible_message("Shuttle Locator active.") //Lets the mob holding it know that the mode has changed
return //Get outta here
if(!the_disk)
the_disk = locate()
the_disk.watched_by += src
if(!the_disk)
icon_state = "pinonnull"
return
point_at(the_disk)
point_at(nukedisk)
/obj/item/weapon/pinpointer/nukeop/proc/worklocation()
if(!bomb_set)
@@ -246,7 +237,6 @@
/obj/item/weapon/pinpointer/pdapinpointer
name = "pda pinpointer"
desc = "A pinpointer that has been illegally modified to track the PDA of a crewmember for malicious reasons."
var/obj/target = null
var/used = 0
watches_nuke = 0

View File

@@ -971,7 +971,7 @@
src.occupant.cancel_camera()
if (seclevel2num(get_security_level()) == SEC_LEVEL_DELTA)
for(var/obj/item/weapon/pinpointer/point in world)
point.the_disk = src //the pinpointer will detect the shunted AI
point.target = src //the pinpointer will detect the shunted AI
stat_collection.malf.did_shunt = 1
@@ -990,7 +990,7 @@
for(var/datum/mind/AI_mind in ticker.mode.malf_ai)
var/mob/living/silicon/ai/A = AI_mind.current // the current mob the mind owns
if(A.stat != DEAD)
point.the_disk = A //The pinpointer tracks the AI back into its core.
point.target = A //The pinpointer tracks the AI back into its core.
else
to_chat(src.occupant, "<span class='warning'>Primary core damaged, unable to return core processes.</span>")
@@ -999,7 +999,7 @@
src.occupant.death()
src.occupant.gib()
for(var/obj/item/weapon/pinpointer/point in world)
point.the_disk = null //the pinpointer will go back to pointing at the nuke disc.
point.target = null //the pinpointer will go back to pointing at the nuke disc.
/obj/machinery/power/apc/proc/ion_act()

View File

@@ -1,2 +1,4 @@
author: BarneyGumball
changes: []
changes:
- bugfix: Pinpointers will now track the nuke disk properly when the disk is destroyed.
- bugfix: Advanced Pinpointers work now.