Materials subsystem, material defines instead of strings, structure materials. (#8447)

The shitcode crusade begins.
This commit is contained in:
Matt Atlas
2020-03-18 20:19:11 +01:00
committed by GitHub
parent d952493ca0
commit 82437acd43
127 changed files with 687 additions and 646 deletions
@@ -292,7 +292,7 @@
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))
to_chat(user, "<span class='notice'>You installed [material_display_name(material_name)] plating into the airlock assembly.</span>")
to_chat(user, "<span class='notice'>You installed [SSmaterials.material_display_name(material_name)] plating into the airlock assembly.</span>")
glass = material_name
else if(W.isscrewdriver() && state == 2 )
+5 -3
View File
@@ -136,13 +136,15 @@
playsound(src.loc, W.usesound, 100, 1)
to_chat(user, "<span class='notice'>Now unsecuring support struts...</span>")
if(do_after(user,40/W.toolspeed))
if(!src) return
if(!src)
return
to_chat(user, "<span class='notice'>You unsecured the support struts!</span>")
state = 1
else if(anchored && !reinf_material)
playsound(src.loc, W.usesound, 100, 1)
reinforcing = !reinforcing
to_chat(user, "<span class='notice'>\The [src] can now be [reinforcing? "reinforced" : "constructed"]!</span>")
return
else if(W.iswirecutter() && state == 1)
playsound(src.loc, 'sound/items/Wirecutter.ogg', 100, 1)
@@ -198,7 +200,7 @@
to_chat(user, "<span class='notice'>There isn't enough material here to construct a wall.</span>")
return 0
var/material/M = name_to_material[S.default_type]
var/material/M = SSmaterials.get_material_by_name(S.default_type)
if(!istype(M))
return 0
@@ -239,7 +241,7 @@
to_chat(user, "<span class='notice'>There isn't enough material here to reinforce the girder.</span>")
return 0
var/material/M = name_to_material[S.default_type]
var/material/M = SSmaterials.get_material_by_name(S.default_type)
if(!istype(M) || M.integrity < 50)
to_chat(user, "You cannot reinforce \the [src] with that; it is too soft.")
return 0
+11 -15
View File
@@ -6,7 +6,6 @@
icon = 'icons/obj/doors/material_doors.dmi'
icon_state = "metal"
var/material/material
var/state = 0 //closed, 1 == open
var/isSwitchingStates = 0
var/oreAmount = 7
@@ -26,7 +25,7 @@
..()
if(!material_name)
material_name = DEFAULT_WALL_MATERIAL
material = get_material_by_name(material_name)
material = SSmaterials.get_material_by_name(material_name)
if(!material)
qdel(src)
return
@@ -63,9 +62,6 @@
if(lock)
to_chat(user, "<span class='notice'>It appears to have a lock.</span>")
/obj/structure/simple_door/get_material()
return material
/obj/structure/simple_door/CollidedWith(atom/user)
..()
if(!state)
@@ -222,32 +218,32 @@
L.apply_effect(round(material.radioactivity/3),IRRADIATE,0)
/obj/structure/simple_door/iron/New(var/newloc,var/material_name, var/complexity)
..(newloc, "iron", complexity)
..(newloc, MATERIAL_IRON, complexity)
/obj/structure/simple_door/silver/New(var/newloc,var/material_name, var/complexity)
..(newloc, "silver", complexity)
..(newloc, MATERIAL_SILVER, complexity)
/obj/structure/simple_door/gold/New(var/newloc,var/material_name, var/complexity)
..(newloc, "gold", complexity)
..(newloc, MATERIAL_GOLD, complexity)
/obj/structure/simple_door/uranium/New(var/newloc,var/material_name, var/complexity)
..(newloc, "uranium", complexity)
..(newloc, MATERIAL_URANIUM, complexity)
/obj/structure/simple_door/sandstone/New(var/newloc,var/material_name, var/complexity)
..(newloc, "sandstone", complexity)
..(newloc, MATERIAL_SANDSTONE, complexity)
/obj/structure/simple_door/phoron/New(var/newloc,var/material_name, var/complexity)
..(newloc, "phoron", complexity)
..(newloc, MATERIAL_PHORON, complexity)
/obj/structure/simple_door/diamond/New(var/newloc,var/material_name, var/complexity)
..(newloc, "diamond", complexity)
..(newloc, MATERIAL_DIAMOND, complexity)
/obj/structure/simple_door/wood/New(var/newloc,var/material_name)
..(newloc, "wood")
..(newloc, MATERIAL_WOOD)
/obj/structure/simple_door/resin/New(var/newloc,var/material_name)
..(newloc, "resin")
..(newloc, MATERIAL_RESIN)
/obj/structure/simple_door/cult/New(var/newloc, var/material_name)
..(newloc, "cult")
..(newloc, MATERIAL_CULT)
color = COLOR_CULT_DOOR // looks better than the standard cult colours
@@ -16,7 +16,6 @@
can_buckle = 1
buckle_dir = SOUTH
buckle_lying = 1
var/material/material
var/material/padding_material
var/base_icon = "bed"
var/can_dismantle = 1
@@ -30,17 +29,14 @@
color = null
if(!new_material)
new_material = DEFAULT_WALL_MATERIAL
material = get_material_by_name(new_material)
material = SSmaterials.get_material_by_name(new_material)
if(!istype(material))
qdel(src)
return
if(new_padding_material)
padding_material = get_material_by_name(new_padding_material)
padding_material = SSmaterials.get_material_by_name(new_padding_material)
update_icon()
/obj/structure/bed/get_material()
return material
/obj/structure/bed/buckle_mob(mob/living/M)
. = ..()
if(. && buckle_sound)
@@ -163,7 +159,7 @@
update_icon()
/obj/structure/bed/proc/add_padding(var/padding_type)
padding_material = get_material_by_name(padding_type)
padding_material = SSmaterials.get_material_by_name(padding_type)
update_icon()
/obj/structure/bed/proc/dismantle()
@@ -178,10 +174,10 @@
base_icon = "psychbed"
/obj/structure/bed/psych/New(var/newloc)
..(newloc,"wood","leather")
..(newloc, MATERIAL_WOOD, MATERIAL_LEATHER)
/obj/structure/bed/padded/New(var/newloc)
..(newloc,"plastic","cotton")
..(newloc, MATERIAL_PLASTIC, MATERIAL_COTTON)
/obj/structure/bed/aqua
name = "aquabed"
@@ -77,31 +77,31 @@
icon_state = "comfychair_preview"
/obj/structure/bed/chair/comfy/brown/Initialize(mapload,var/newmaterial)
. = ..(mapload,"steel","leather")
. = ..(mapload, MATERIAL_STEEL, MATERIAL_LEATHER)
/obj/structure/bed/chair/comfy/red/Initialize(var/mapload,var/newmaterial)
. = ..(mapload,"steel","carpet")
. = ..(mapload, MATERIAL_STEEL, MATERIAL_CARPET)
/obj/structure/bed/chair/comfy/teal/Initialize(var/mapload,var/newmaterial)
. = ..(mapload,"steel","teal")
. = ..(mapload, MATERIAL_STEEL, MATERIAL_CLOTH_TEAL)
/obj/structure/bed/chair/comfy/black/Initialize(var/mapload,var/newmaterial)
. = ..(mapload,"steel","black")
. = ..(mapload, MATERIAL_STEEL, MATERIAL_CLOTH_BLACK)
/obj/structure/bed/chair/comfy/green/Initialize(var/mapload,var/newmaterial)
. = ..(mapload,"steel","green")
. = ..(mapload, MATERIAL_STEEL, MATERIAL_CLOTH_GREEN)
/obj/structure/bed/chair/comfy/purp/Initialize(var/mapload,var/newmaterial)
. = ..(mapload,"steel","purple")
. = ..(mapload, MATERIAL_STEEL, MATERIAL_CLOTH_PURPLE)
/obj/structure/bed/chair/comfy/blue/Initialize(var/mapload,var/newmaterial)
. = ..(mapload,"steel","blue")
. = ..(mapload, MATERIAL_STEEL, MATERIAL_CLOTH_BLUE)
/obj/structure/bed/chair/comfy/beige/Initialize(var/mapload,var/newmaterial)
. = ..(mapload,"steel","beige")
. = ..(mapload, MATERIAL_STEEL, MATERIAL_CLOTH_BEIGE)
/obj/structure/bed/chair/comfy/lime/Initialize(var/mapload,var/newmaterial)
. = ..(mapload,"steel","lime")
. = ..(mapload, MATERIAL_STEEL, MATERIAL_CLOTH_LIME)
/obj/structure/bed/chair/office
anchored = 0
@@ -25,9 +25,9 @@
..(newloc)
if(!new_material)
new_material = DEFAULT_WALL_MATERIAL
material = get_material_by_name(new_material)
material = SSmaterials.get_material_by_name(new_material)
if(new_padding_material)
padding_material = get_material_by_name(new_padding_material)
padding_material = SSmaterials.get_material_by_name(new_padding_material)
if(!istype(material))
qdel(src)
return
@@ -35,10 +35,10 @@
update_icon()
/obj/item/stool/padded/New(var/newloc, var/new_material)
..(newloc, "steel", "carpet")
..(newloc, MATERIAL_STEEL, MATERIAL_CARPET)
/obj/item/stool/wood/New(var/newloc, var/new_material)
..(newloc, "wood")
..(newloc, MATERIAL_WOOD)
/obj/item/stool/hover
name = "hoverstool"
@@ -47,7 +47,7 @@
item_state_slots = null
/obj/item/stool/hover/New(var/newloc, var/new_material)
..(newloc, "skrell")
..(newloc, MATERIAL_SHUTTLE_SKRELL)
/obj/item/stool/hover/Initialize()
.=..()
@@ -85,7 +85,7 @@
desc = "A stool. Apply butt with care. It's made of [material.use_name]."
/obj/item/stool/proc/add_padding(var/padding_type)
padding_material = get_material_by_name(padding_type)
padding_material = SSmaterials.get_material_by_name(padding_type)
update_icon()
/obj/item/stool/proc/remove_padding()
+2 -2
View File
@@ -79,7 +79,7 @@
icon = 'icons/obj/items.dmi'
icon_state = "pocketwatch"
drop_sound = 'sound/items/drop/accessory.ogg'
matter = list("glass" = 150, "gold" = 50)
matter = list(MATERIAL_GLASS = 150, MATERIAL_GOLD = 50)
w_class = 1
var/closed = FALSE
@@ -125,7 +125,7 @@
icon = 'icons/obj/items.dmi'
icon_state = "pocketwatch"
drop_sound = 'sound/items/drop/accessory.ogg'
matter = list("glass" = 150, "gold" = 50)
matter = list(MATERIAL_GLASS = 150, MATERIAL_GOLD = 50)
w_class = 1
var/datum/weakref/thrall = null
var/time_counter = 0