Same fix, much better code

This commit is contained in:
Unknown
2019-09-12 01:13:10 -04:00
parent c0f75d7e7b
commit db45400201
4 changed files with 8 additions and 120 deletions
+2 -8
View File
@@ -15,14 +15,12 @@
w_class = ITEMSIZE_TINY
var/template_id = "shelter_alpha"
var/datum/map_template/shelter/template
var/datum/map_template/shelter/template_roof
var/used = FALSE
/obj/item/device/survivalcapsule/proc/get_template()
if(template)
return
template = SSmapping.shelter_templates[template_id]
template_roof = SSmapping.shelter_templates[template.roof]
if(!template)
throw EXCEPTION("Shelter template ([template_id]) not found!")
qdel(src)
@@ -49,10 +47,6 @@
var/turf/deploy_location = get_turf(src)
var/status = template.check_deploy(deploy_location)
var/turf/above_location = GetAbove(deploy_location)
if(!isopenspace(above_location))
above_location = null
if(above_location && status == SHELTER_DEPLOY_ALLOWED)
status = template.check_deploy(above_location)
switch(status)
//Not allowed due to /area technical reasons
@@ -79,8 +73,8 @@
playsound(get_turf(src), 'sound/effects/phasein.ogg', 100, 1)
log_and_message_admins("[key_name_admin(usr)] activated a bluespace capsule at [get_area(T)]!")
if(above_location && template_roof)
template_roof.load(above_location, centered = TRUE)
if(above_location)
template.add_roof(above_location)
template.load(deploy_location, centered = TRUE)
qdel(src)
+6 -4
View File
@@ -5,7 +5,6 @@
var/whitelisted_turfs
var/banned_areas
var/banned_objects
var/roof
/datum/map_template/shelter/New()
. = ..()
@@ -31,6 +30,12 @@
return SHELTER_DEPLOY_ANCHORED_OBJECTS
return SHELTER_DEPLOY_ALLOWED
/datum/map_template/shelter/proc/add_roof(turf/deploy_location)
var/affected = get_affected_turfs(deploy_location, centered=TRUE)
for(var/turf/T in affected)
if(isopenspace(T))
T.ChangeTurf(/turf/simulated/shuttle/floor/voidcraft)
/datum/map_template/shelter/alpha
name = "Shelter Alpha"
shelter_id = "shelter_alpha"
@@ -39,7 +44,6 @@
sleeping area! Order now, and we'll throw in a TINY FAN, \
absolutely free!"
mappath = "maps/submaps/shelters/shelter_1.dmm"
roof = "roof_alpha"
/datum/map_template/shelter/alpha_roof
shelter_id = "roof_alpha"
@@ -59,7 +63,6 @@
and a deluxe companion to keep you from getting lonely during \
an ash storm."
mappath = "maps/submaps/shelters/shelter_2.dmm"
roof = "roof_beta"
/datum/map_template/shelter/beta_roof
shelter_id = "roof_beta"
@@ -79,7 +82,6 @@
to no contact, the expense of these shelters have prevented them \
from seeing common use."
mappath = "maps/submaps/shelters/shelter_3.dmm"
roof = "roof_beta"
/datum/map_template/shelter/gamma/New()
. = ..()