mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
Replaces nuke disk search_contents_for with a global nuke disk registry
This commit is contained in:
@@ -212,7 +212,6 @@
|
||||
return src.master.attack_hand(a, b, c)
|
||||
return
|
||||
|
||||
//by default, transition randomly to another zlevel
|
||||
/atom/movable/proc/touch_map_edge()
|
||||
if(z in config.sealed_levels)
|
||||
return
|
||||
@@ -221,11 +220,6 @@
|
||||
overmap_spacetravel(get_turf(src), src)
|
||||
return
|
||||
|
||||
var/list/disk_search = search_contents_for(/obj/item/weapon/disk/nuclear)
|
||||
if(!isemptylist(disk_search))
|
||||
for(var/obj/item/weapon/disk/nuclear/N in disk_search)
|
||||
qdel(N)
|
||||
|
||||
var/move_to_z = src.get_transit_zlevel()
|
||||
if(move_to_z)
|
||||
z = move_to_z
|
||||
@@ -246,12 +240,17 @@
|
||||
y = TRANSITIONEDGE + 1
|
||||
x = rand(TRANSITIONEDGE + 2, world.maxx - TRANSITIONEDGE - 2)
|
||||
|
||||
if(ticker && istype(ticker.mode, /datum/game_mode/nuclear)) //only really care if the game mode is nuclear
|
||||
var/datum/game_mode/nuclear/G = ticker.mode
|
||||
G.check_nuke_disks()
|
||||
|
||||
spawn(0)
|
||||
if(loc) loc.Entered(src)
|
||||
|
||||
//This list contains the z-level numbers which can be accessed via space travel and the percentile chances to get there.
|
||||
var/list/accessible_z_levels = list("1" = 5, "3" = 10, "4" = 15, "5" = 10, "6" = 60)
|
||||
|
||||
//by default, transition randomly to another zlevel
|
||||
/atom/movable/proc/get_transit_zlevel()
|
||||
var/list/candidates = accessible_z_levels.Copy()
|
||||
candidates.Remove("[src.z]")
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
MERCENARY ROUNDTYPE
|
||||
*/
|
||||
|
||||
var/list/nuke_disks = list()
|
||||
|
||||
/datum/game_mode/nuclear
|
||||
name = "Mercenary"
|
||||
round_description = "A mercenary strike force is approaching the station!"
|
||||
@@ -17,6 +19,18 @@
|
||||
var/nuke_off_station = 0 //Used for tracking if the syndies actually haul the nuke to the station
|
||||
var/syndies_didnt_escape = 0 //Used for tracking if the syndies got the shuttle off of the z-level
|
||||
|
||||
//delete all nuke disks not on a station zlevel
|
||||
/datum/game_mode/nuclear/proc/check_nuke_disks()
|
||||
for(var/obj/item/weapon/disk/nuclear/N in nuke_disks)
|
||||
if(isNotStationLevel(N.z)) qdel(N)
|
||||
|
||||
//checks if L has a nuke disk on their person
|
||||
/datum/game_mode/nuclear/proc/check_mob(mob/living/L)
|
||||
for(var/obj/item/weapon/disk/nuclear/N in nuke_disks)
|
||||
if(N.storage_depth(L) >= 0)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/game_mode/nuclear/declare_completion()
|
||||
if(config.objectives_disabled)
|
||||
return
|
||||
|
||||
@@ -423,11 +423,15 @@ obj/machinery/nuclearbomb/proc/nukehack_win(mob/user as mob)
|
||||
return
|
||||
return
|
||||
|
||||
/obj/item/weapon/disk/nuclear/New()
|
||||
..()
|
||||
nuke_disks |= src
|
||||
|
||||
/obj/item/weapon/disk/nuclear/Destroy()
|
||||
if(blobstart.len > 0)
|
||||
if(!nuke_disks.len && blobstart.len > 0)
|
||||
var/obj/D = new /obj/item/weapon/disk/nuclear(pick(blobstart))
|
||||
message_admins("[src] has been destroyed. Spawning [D] at ([D.x], [D.y], [D.z]).")
|
||||
log_game("[src] has been destroyed. Spawning [D] at ([D.x], [D.y], [D.z]).")
|
||||
message_admins("[src], the last authentication disk, has been destroyed. Spawning [D] at ([D.x], [D.y], [D.z]).")
|
||||
log_game("[src], the last authentication disk, has been destroyed. Spawning [D] at ([D.x], [D.y], [D.z]).")
|
||||
..()
|
||||
|
||||
/obj/item/weapon/disk/nuclear/touch_map_edge()
|
||||
|
||||
@@ -796,17 +796,21 @@ default behaviour is:
|
||||
return
|
||||
|
||||
/mob/living/touch_map_edge()
|
||||
var/list/disk_search = search_contents_for(/obj/item/weapon/disk/nuclear)
|
||||
if(!isemptylist(disk_search) && client && stat != DEAD)
|
||||
if(x <= TRANSITIONEDGE)
|
||||
inertia_dir = 4
|
||||
else if(x >= world.maxx -TRANSITIONEDGE)
|
||||
inertia_dir = 8
|
||||
else if(y <= TRANSITIONEDGE)
|
||||
inertia_dir = 1
|
||||
else if(y >= world.maxy -TRANSITIONEDGE)
|
||||
inertia_dir = 2
|
||||
src << "<span class='warning>Something you are carrying is preventing you from leaving.</span>"
|
||||
return
|
||||
|
||||
//check for nuke disks
|
||||
if(client && stat != DEAD) //if they are clientless and dead don't bother, the parent will treat them as any other container
|
||||
if(ticker && istype(ticker.mode, /datum/game_mode/nuclear)) //only really care if the game mode is nuclear
|
||||
var/datum/game_mode/nuclear/G = ticker.mode
|
||||
if(G.check_mob(src))
|
||||
if(x <= TRANSITIONEDGE)
|
||||
inertia_dir = 4
|
||||
else if(x >= world.maxx -TRANSITIONEDGE)
|
||||
inertia_dir = 8
|
||||
else if(y <= TRANSITIONEDGE)
|
||||
inertia_dir = 1
|
||||
else if(y >= world.maxy -TRANSITIONEDGE)
|
||||
inertia_dir = 2
|
||||
src << "<span class='warning>Something you are carrying is preventing you from leaving.</span>"
|
||||
return
|
||||
|
||||
..() //Should make the disk respawn it is on a clientless mob or corpse
|
||||
..()
|
||||
|
||||
Reference in New Issue
Block a user