You can smuggle smuggler's satchels to a future shift (#19838)

* Hidden Smuggler Satchels hidden beneath the station now persist between rounds, though there's no assurances of WHEN they'll appear next and only one will ever appear in the round.

NOTE THAT THIS PULL INTRODUCES A CRITICAL BUG, DO NOT MERGE *JUST* THIS PR, AWAIT THE FOLLOWUP

* Finishes up satchel persistence.

Satchels require at least 20 saved bags before any will start spawning.

the var persistence_replacement can be set to a path to replace a very high risk item with a lower risk look alike. This is currently done with the nuke disk, the wizards spellbook, and the uplink implant

* DESIGNATED.
REMIE.
PULL.
This commit is contained in:
Incoming5643
2016-08-20 00:27:02 -04:00
committed by oranges
parent b3ba027969
commit f70ba63d3e
8 changed files with 91 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
var/datum/subsystem/persistence/SSpersistence
/datum/subsystem/persistence
name = "Persistence"
init_order = -100
flags = SS_NO_FIRE
var/savefile/secret_satchels
var/list/satchel_blacklist = list() //this is a typecache
var/list/new_secret_satchels = list() //these are objects
var/list/old_secret_satchels = list() //these are just vars
/datum/subsystem/persistence/New()
NEW_SS_GLOBAL(SSpersistence)
/datum/subsystem/persistence/Initialize()
PlaceSecretSatchel()
..()
/datum/subsystem/persistence/proc/CollectData()
CollectSecretSatchels()
/datum/subsystem/persistence/proc/PlaceSecretSatchel()
var/list/satchels = list()
secret_satchels = new /savefile("data/npc_saves/SecretSatchels_[MAP_NAME].sav")
satchel_blacklist = typecacheof(list(/obj/item/stack/tile/plasteel, /obj/item/weapon/crowbar))
secret_satchels >> satchels
if(!satchels.len || satchels.len < 20) //guards against low drop pools assuring that one player can reliably find his own gear.
return
var/list/chosen_satchel = pick_n_take(satchels)
old_secret_satchels = satchels
secret_satchels << old_secret_satchels
if(chosen_satchel.len != 3) //Malformed
return
var/path = text2path(chosen_satchel[3]) //If the item no longer exist, this returns null
if(!path)
return
var/obj/item/weapon/storage/backpack/satchel/flat/F = new()
F.x = chosen_satchel[1]
F.y = chosen_satchel[2]
F.z = ZLEVEL_STATION
if(istype(F.loc,/turf/open/floor) && !istype(F.loc,/turf/open/floor/plating/))
F.hide(1)
new path(F)
/datum/subsystem/persistence/proc/CollectSecretSatchels()
for(var/A in new_secret_satchels)
var/obj/item/weapon/storage/backpack/satchel/flat/F = A
if(qdeleted(F) || F.z != ZLEVEL_STATION || F.invisibility != INVISIBILITY_MAXIMUM)
continue
var/list/savable_obj = list()
for(var/obj/O in F)
if(is_type_in_typecache(O, satchel_blacklist) || O.admin_spawned)
continue
if(O.persistence_replacement)
savable_obj += O.persistence_replacement
else
savable_obj += O.type
if(savable_obj.len < 1)
continue
old_secret_satchels.len += 1
old_secret_satchels[old_secret_satchels.len] = list(F.x, F.y, "[pick(savable_obj)]")
secret_satchels << old_secret_satchels

View File

@@ -451,6 +451,8 @@ var/datum/subsystem/ticker/ticker
dellog += "Failures : [SSgarbage.didntgc[path]] \n" dellog += "Failures : [SSgarbage.didntgc[path]] \n"
world.log << dellog world.log << dellog
//Collects persistence features
SSpersistence.CollectData()
return 1 return 1
/datum/subsystem/ticker/proc/send_tip_of_the_round() /datum/subsystem/ticker/proc/send_tip_of_the_round()

View File

@@ -486,6 +486,7 @@ This is here to make the tiles around the station mininuke change when it's arme
name = "nuclear authentication disk" name = "nuclear authentication disk"
desc = "Better keep this safe." desc = "Better keep this safe."
icon_state = "nucleardisk" icon_state = "nucleardisk"
persistence_replacement = /obj/item/weapon/disk/fakenucleardisk
/obj/item/weapon/disk/nuclear/New() /obj/item/weapon/disk/nuclear/New()
..() ..()
@@ -556,3 +557,8 @@ This is here to make the tiles around the station mininuke change when it's arme
log_game("[src] has been destroyed in [COORD(diskturf)]. Moving it to \ log_game("[src] has been destroyed in [COORD(diskturf)]. Moving it to \
[COORD(targetturf)].") [COORD(targetturf)].")
return QDEL_HINT_LETMELIVE //Cancel destruction unless forced return QDEL_HINT_LETMELIVE //Cancel destruction unless forced
/obj/item/weapon/disk/fakenucleardisk
name = "cheap plastic imitation of the nuclear authentication disk"
desc = "Broken dreams and a faint oder of cheese."
icon_state = "nucleardisk"

View File

@@ -514,6 +514,7 @@
throw_speed = 2 throw_speed = 2
throw_range = 5 throw_range = 5
w_class = 1 w_class = 1
persistence_replacement = /obj/item/weapon/spellbook/oneuse/random
var/uses = 10 var/uses = 10
var/temp = null var/temp = null
var/tab = null var/tab = null
@@ -704,6 +705,7 @@
name = "spellbook of " name = "spellbook of "
uses = 1 uses = 1
desc = "This template spellbook was never meant for the eyes of man..." desc = "This template spellbook was never meant for the eyes of man..."
persistence_replacement = null
/obj/item/weapon/spellbook/oneuse/New() /obj/item/weapon/spellbook/oneuse/New()
..() ..()

View File

@@ -28,7 +28,18 @@
/obj/item/weapon/implanter/uplink /obj/item/weapon/implanter/uplink
name = "implanter (uplink)" name = "implanter (uplink)"
persistence_replacement = /obj/item/weapon/implanter/weakuplink
/obj/item/weapon/implanter/uplink/New() /obj/item/weapon/implanter/uplink/New()
imp = new /obj/item/weapon/implant/uplink(src) imp = new /obj/item/weapon/implant/uplink(src)
..() ..()
/obj/item/weapon/implanter/weakuplink
name = "implanter (uplink)"
/obj/item/weapon/implanter/weakuplink/New()
imp = new /obj/item/weapon/implant/uplink/weak(src)
..()
/obj/item/weapon/implant/uplink/weak/New()
..()
hidden_uplink.telecrystals = 5

View File

@@ -288,6 +288,7 @@
..() ..()
PoolOrNew(/obj/item/stack/tile/plasteel, src) PoolOrNew(/obj/item/stack/tile/plasteel, src)
new /obj/item/weapon/crowbar(src) new /obj/item/weapon/crowbar(src)
SSpersistence.new_secret_satchels += src
/obj/item/weapon/storage/backpack/satchel/flat/secret/ /obj/item/weapon/storage/backpack/satchel/flat/secret/
var/list/reward_one_of_these = list() //Intended for map editing var/list/reward_one_of_these = list() //Intended for map editing

View File

@@ -18,6 +18,8 @@
var/on_blueprints = FALSE //Are we visible on the station blueprints at roundstart? var/on_blueprints = FALSE //Are we visible on the station blueprints at roundstart?
var/force_blueprints = FALSE //forces the obj to be on the blueprints, regardless of when it was created. var/force_blueprints = FALSE //forces the obj to be on the blueprints, regardless of when it was created.
var/persistence_replacement = null //have something WAY too amazing to live to the next round? Set a new path here. Overuse of this var will make me upset.
/obj/New() /obj/New()
..() ..()

View File

@@ -152,6 +152,7 @@
#include "code\controllers\subsystem\npcpool.dm" #include "code\controllers\subsystem\npcpool.dm"
#include "code\controllers\subsystem\objects.dm" #include "code\controllers\subsystem\objects.dm"
#include "code\controllers\subsystem\pai.dm" #include "code\controllers\subsystem\pai.dm"
#include "code\controllers\subsystem\persistence.dm"
#include "code\controllers\subsystem\pool.dm" #include "code\controllers\subsystem\pool.dm"
#include "code\controllers\subsystem\radio.dm" #include "code\controllers\subsystem\radio.dm"
#include "code\controllers\subsystem\server_maintenance.dm" #include "code\controllers\subsystem\server_maintenance.dm"