Replaces every check for a hardcoded material stack type with a check
for material of the stack.
This commit is contained in:
mwerezak
2015-08-02 00:01:10 -04:00
parent e3609bac94
commit 0ceb0e291d
37 changed files with 179 additions and 168 deletions
@@ -236,20 +236,20 @@
electronics = null
else if(istype(W, /obj/item/stack/material) && !glass)
var/obj/item/stack/material/S = W
var/obj/item/stack/S = W
var/material_name = S.get_material_name()
if (S)
if (S.get_amount() >= 1)
if(istype(S, /obj/item/stack/material/glass/reinforced))
if(material_name == "reinforced glass")
playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1)
user.visible_message("[user] adds [S.name] to the airlock assembly.", "You start to install [S.name] into the airlock assembly.")
if(do_after(user, 40) && !glass)
if (S.use(1))
user << "<span class='notice'>You installed reinforced glass windows into the airlock assembly.</span>"
glass = 1
else if(istype(S, /obj/item/stack/material) && S.default_type)
var/M = S.default_type
else if(material_name)
// Ugly hack, will suffice for now. Need to fix it upstream as well, may rewrite mineral walls. ~Z
if(M in list("mhydrogen","osmium","tritium","platinum","iron"))
if(!(material_name in list("gold", "silver", "diamond", "uranium", "phoron", "sandstone")))
user << "You cannot make an airlock out of that material."
return
if(S.get_amount() >= 2)
@@ -257,8 +257,8 @@
user.visible_message("[user] adds [S.name] to the airlock assembly.", "You start to install [S.name] into the airlock assembly.")
if(do_after(user, 40) && !glass)
if (S.use(2))
user << "<span class='notice'>You installed [M] plating into the airlock assembly.</span>"
glass = "[M]"
user << "<span class='notice'>You installed [material_display_name(material_name)] plating into the airlock assembly.</span>"
glass = material_name
else if(istype(W, /obj/item/weapon/screwdriver) && state == 2 )
playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1)
+3 -3
View File
@@ -108,11 +108,11 @@
else if(istype(W, /obj/item/stack/material))
var/obj/item/stack/material/S = W
var/obj/item/stack/S = W
if(S.get_amount() < 2)
return ..()
var/material/M = name_to_material[S.default_type]
var/material/M = S.get_material()
if(!istype(M))
return ..()
@@ -183,7 +183,7 @@
user << "There is not enough material here to reinforce the girder."
return
var/material/M = name_to_material[S.default_type]
var/material/M = S.get_material()
if(!istype(M) || M.integrity < 50)
user << "You cannot reinforce \the [src] with that; it is too soft."
return