Merge pull request #5509 from Fox-McCloud/mining-shelter

Ports Mining Shelters
This commit is contained in:
TheDZD
2016-08-23 14:03:54 -04:00
committed by GitHub
26 changed files with 467 additions and 37 deletions
+225 -1
View File
@@ -263,6 +263,198 @@
icon_state = "mobcap[colorindex]"
update_icon()
/*****************************Survival Pod********************************/
/area/survivalpod
name = "\improper Emergency Shelter"
icon_state = "away"
requires_power = 0
has_gravity = 1
/obj/item/weapon/survivalcapsule
name = "bluespace shelter capsule"
desc = "An emergency shelter stored within a pocket of bluespace."
icon_state = "capsule"
icon = 'icons/obj/mining.dmi'
w_class = 1
origin_tech = "engineering=3;bluespace=3"
var/template_id = "shelter_alpha"
var/datum/map_template/shelter/template
var/used = FALSE
/obj/item/weapon/survivalcapsule/proc/get_template()
if(template)
return
template = shelter_templates[template_id]
if(!template)
log_runtime("Shelter template ([template_id]) not found!", src)
qdel(src)
/obj/item/weapon/survivalcapsule/examine(mob/user)
. = ..()
get_template()
to_chat(user, "This capsule has the [template.name] stored.")
to_chat(user, template.description)
/obj/item/weapon/survivalcapsule/attack_self()
// Can't grab when capsule is New() because templates aren't loaded then
get_template()
if(used == FALSE)
loc.visible_message("<span class='warning'>[src] begins to shake. Stand back!</span>")
used = TRUE
sleep(50)
var/turf/deploy_location = get_turf(src)
var/status = template.check_deploy(deploy_location)
switch(status)
if(SHELTER_DEPLOY_BAD_AREA)
loc.visible_message("<span class='warning'>[src] will not function in this area.</span>")
if(SHELTER_DEPLOY_BAD_TURFS, SHELTER_DEPLOY_ANCHORED_OBJECTS)
var/width = template.width
var/height = template.height
loc.visible_message("<span class='warning'>[src] doesn't have room to deploy! You need to clear a [width]x[height] area!</span>")
if(status != SHELTER_DEPLOY_ALLOWED)
used = FALSE
return
playsound(get_turf(src), 'sound/effects/phasein.ogg', 100, 1)
var/turf/T = deploy_location
if(!is_mining_level(T.z))//only report capsules away from the mining/lavaland level
message_admins("[key_name_admin(usr)] (<A HREF='?_src_=holder;adminmoreinfo=\ref[usr]'>?</A>) (<A HREF='?_src_=holder;adminplayerobservefollow=\ref[usr]'>FLW</A>) activated a bluespace capsule away from the mining level! (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[T.x];Y=[T.y];Z=[T.z]'>JMP</a>)")
log_admin("[key_name(usr)] activated a bluespace capsule away from the mining level at [T.x], [T.y], [T.z]")
template.load(deploy_location, centered = TRUE)
new /obj/effect/effect/harmless_smoke(get_turf(src))
qdel(src)
//Pod turfs and objects
//Floors
/turf/simulated/floor/pod
name = "pod floor"
icon_state = "podfloor"
icon_regular_floor = "podfloor"
floor_tile = /obj/item/stack/tile/pod
//Walls
/turf/simulated/wall/survival
name = "pod wall"
desc = "An easily-compressable wall used for temporary shelter."
icon = 'icons/turf/walls/survival_pod_walls.dmi'
icon_state = "smooth"
walltype = "shuttle"
smooth = SMOOTH_MORE // To Do: Add in Diagnaol Smooth Support
canSmoothWith = list(/turf/simulated/wall/survival, /obj/machinery/door/airlock/survival_pod)
//Door
/obj/machinery/door/airlock/survival_pod
name = "Airlock"
icon = 'icons/obj/doors/survival.dmi'
assembly_type = /obj/structure/door_assembly/door_assembly_pod
opacity = 0
glass = 1
/obj/structure/door_assembly/door_assembly_pod
base_icon_state = "survival_pod"
glass_type = "/survival_pod"
//Table
/obj/structure/table/survival_pod
icon = 'icons/obj/lavaland/survival_pod.dmi'
icon_state = "table"
smooth = SMOOTH_FALSE
//Sleeper
/obj/machinery/sleeper/survival_pod
icon = 'icons/obj/lavaland/survival_pod.dmi'
icon_state = "sleeper-open"
density = 0
/obj/machinery/sleeper/survival_pod/New()
..()
component_parts = list()
component_parts += new /obj/item/weapon/circuitboard/sleeper/survival(null)
var/obj/item/weapon/stock_parts/matter_bin/B = new(null)
B.rating = initial_bin_rating
component_parts += B
component_parts += new /obj/item/weapon/stock_parts/manipulator(null)
component_parts += new /obj/item/weapon/stock_parts/console_screen(null)
component_parts += new /obj/item/weapon/stock_parts/console_screen(null)
component_parts += new /obj/item/stack/cable_coil(null, 1)
RefreshParts()
//Computer
/obj/item/device/gps/computer
name = "pod computer"
icon_state = "pod_computer"
icon = 'icons/obj/lavaland/pod_computer.dmi'
anchored = 1
density = 1
pixel_y = -32
/obj/item/device/gps/computer/attackby(obj/item/weapon/W, mob/user, params)
if(istype(W, /obj/item/weapon/wrench))
playsound(loc, 'sound/items/Ratchet.ogg', 50, 1)
user.visible_message("<span class='warning'>[user] disassembles the gps.</span>", \
"<span class='notice'>You start to disassemble the gps...</span>", "You hear clanking and banging noises.")
if(do_after(user, 20, target = src))
new /obj/item/device/gps(loc)
qdel(src)
return ..()
/obj/item/device/gps/computer/attack_hand(mob/user)
attack_self(user)
//Bed
/obj/structure/stool/bed/pod
icon = 'icons/obj/lavaland/survival_pod.dmi'
icon_state = "bed"
//Survival Storage Unit
/obj/machinery/smartfridge/survival_pod
name = "survival pod storage"
desc = "A heated storage unit."
icon_state = "donkvendor"
icon = 'icons/obj/lavaland/donkvendor.dmi'
icon_on = "donkvendor"
icon_off = "donkvendor"
light_range = 8
max_n_of_items = 10
pixel_y = -4
/obj/item/weapon/circuitboard/smartfridge/survival
name = "circuit board (Smartfridge Survival)"
build_path = /obj/machinery/smartfridge/survival_pod
/obj/item/weapon/circuitboard/smartfridge/attackby(obj/item/I, mob/user, params)
return
/obj/machinery/smartfridge/survival_pod/accept_check(obj/item/O)
if(istype(O, /obj/item))
return 1
return 0
/obj/machinery/smartfridge/survival_pod/New()
..()
component_parts = list()
component_parts += new /obj/item/weapon/circuitboard/smartfridge/survival(null)
component_parts += new /obj/item/weapon/stock_parts/matter_bin(null)
RefreshParts()
/obj/machinery/smartfridge/survival_pod/loaded/New()
..()
for(var/i in 1 to 5)
var/obj/item/weapon/reagent_containers/food/snacks/warmdonkpocket_weak/W = new(src)
load(W)
if(prob(50))
var/obj/item/weapon/storage/pill_bottle/dice/D = new(src)
load(D)
else
var/obj/item/device/guitar/G = new(src)
load(G)
//Fans
/obj/structure/fans
icon = 'icons/obj/lavaland/survival_pod.dmi'
@@ -307,4 +499,36 @@
return ..()
/obj/structure/fans/CanAtmosPass(turf/T)
return !arbitraryatmosblockingvar
return !arbitraryatmosblockingvar
//Signs
/obj/structure/sign/mining
name = "nanotrasen mining corps sign"
desc = "A sign of relief for weary miners, and a warning for would-be competitors to Nanotrasen's mining claims."
icon = 'icons/turf/walls/survival_pod_walls.dmi'
icon_state = "ntpod"
/obj/structure/sign/mining/survival
name = "shelter sign"
desc = "A high visibility sign designating a safe shelter."
icon = 'icons/turf/walls/survival_pod_walls.dmi'
icon_state = "survival"
//Fluff
/obj/structure/tubes
icon_state = "tubes"
icon = 'icons/obj/lavaland/survival_pod.dmi'
name = "tubes"
anchored = 1
layer = MOB_LAYER - 0.2
density = 0
/obj/structure/tubes/attackby(obj/item/weapon/W, mob/user, params)
if(istype(W, /obj/item/weapon/wrench))
playsound(loc, 'sound/items/Ratchet.ogg', 50, 1)
user.visible_message("<span class='warning'>[user] disassembles [src].</span>", \
"<span class='notice'>You start to disassemble [src]...</span>", "You hear clanking and banging noises.")
if(do_after(user, 20, target = src))
new /obj/item/stack/rods(loc)
qdel(src)
return ..()
+42
View File
@@ -0,0 +1,42 @@
/datum/map_template/shelter
var/shelter_id
var/description
var/blacklisted_turfs
var/whitelisted_turfs
var/banned_areas
/datum/map_template/shelter/New()
. = ..()
blacklisted_turfs = typecacheof(list(/turf/simulated/wall, /turf/simulated/mineral, /turf/simulated/shuttle/wall))
whitelisted_turfs = list()
banned_areas = typecacheof(/area/shuttle)
/datum/map_template/shelter/proc/check_deploy(turf/deploy_location)
var/affected = get_affected_turfs(deploy_location, centered=TRUE)
for(var/turf/T in affected)
var/area/A = get_area(T)
if(is_type_in_typecache(A, banned_areas))
return SHELTER_DEPLOY_BAD_AREA
var/banned = is_type_in_typecache(T, blacklisted_turfs)
var/permitted = is_type_in_typecache(T, whitelisted_turfs)
if(banned && !permitted)
return SHELTER_DEPLOY_BAD_TURFS
for(var/obj/O in T)
if(O.density && O.anchored)
return SHELTER_DEPLOY_ANCHORED_OBJECTS
return SHELTER_DEPLOY_ALLOWED
/datum/map_template/shelter/alpha
name = "Shelter Alpha"
shelter_id = "shelter_alpha"
description = "A cosy self-contained pressurized shelter, with \
built-in navigation, entertainment, medical facilities and a \
sleeping area! Order now, and we'll throw in a TINY FAN, \
absolutely free!"
mappath = "_maps/map_files/templates/shelter_1.dmm"
/datum/map_template/shelter/alpha/New()
. = ..()
whitelisted_turfs = typecacheof(/turf/simulated/mineral)