- Material comparisons done by name rather than reference equality
- get_material_by_name proc that ensures the material list is initialised, initialising it if neccessary
- holographic materials moved into main material list
- table frames are not a source of infinite metal, and can be deconstructed correctly
- gambling table icons are no longer E-W flipped
This commit is contained in:
GinjaNinja32
2015-05-14 22:26:19 +01:00
parent 428014c372
commit 63f28ee0e0
6 changed files with 35 additions and 33 deletions

View File

@@ -25,11 +25,9 @@ var/list/global/wall_cache = list()
/turf/simulated/wall/New(var/newloc, var/materialtype, var/rmaterialtype) /turf/simulated/wall/New(var/newloc, var/materialtype, var/rmaterialtype)
..(newloc) ..(newloc)
icon_state = "blank" icon_state = "blank"
if(!name_to_material)
populate_material_list()
if(!materialtype) if(!materialtype)
materialtype = DEFAULT_WALL_MATERIAL materialtype = DEFAULT_WALL_MATERIAL
material = name_to_material[materialtype] material = get_material_by_name(materialtype)
if(!isnull(rmaterialtype)) if(!isnull(rmaterialtype))
reinf_material = name_to_material[rmaterialtype] reinf_material = name_to_material[rmaterialtype]
update_material() update_material()

View File

@@ -1,7 +1,7 @@
var/list/name_to_material var/list/name_to_material
/proc/populate_material_list() /proc/populate_material_list(force_remake=0)
if(name_to_material) return // Already set up! if(name_to_material && !force_remake) return // Already set up!
name_to_material = list() name_to_material = list()
for(var/type in typesof(/material) - /material) for(var/type in typesof(/material) - /material)
var/material/new_mineral = new type var/material/new_mineral = new type
@@ -10,6 +10,12 @@ var/list/name_to_material
name_to_material[lowertext(new_mineral.name)] = new_mineral name_to_material[lowertext(new_mineral.name)] = new_mineral
return 1 return 1
/proc/get_material_by_name(name)
if(!name_to_material)
populate_material_list()
return name_to_material[name]
/* /*
Valid sprite masks: Valid sprite masks:
stone stone
@@ -102,6 +108,11 @@ var/list/name_to_material
icon_reinf = "reinf_over" icon_reinf = "reinf_over"
icon_colour = "#666666" icon_colour = "#666666"
/material/steel/holographic
name = "holographic [DEFAULT_WALL_MATERIAL]"
display_name = DEFAULT_WALL_MATERIAL
stack_type = null
/material/plasteel /material/plasteel
name = "plasteel" name = "plasteel"
stack_type = /obj/item/stack/sheet/plasteel stack_type = /obj/item/stack/sheet/plasteel
@@ -159,6 +170,11 @@ var/list/name_to_material
icon_base = "solid" icon_base = "solid"
explosion_resistance = 2 explosion_resistance = 2
/material/wood/holographic
name = "holographic wood"
display_name = "wood"
stack_type = null
/material/cult /material/cult
name = "cult" name = "cult"
display_name = "disturbing stone" display_name = "disturbing stone"

View File

@@ -5,7 +5,7 @@
var/obj/structure/table/T var/obj/structure/table/T
for(var/angle in list(-90,90)) for(var/angle in list(-90,90))
T = locate() in get_step(src.loc,turn(direction,angle)) T = locate() in get_step(src.loc,turn(direction,angle))
if(T && T.flipped == 0 && T.material == material) if(T && T.flipped == 0 && T.material.name == material.name)
return 0 return 0
T = locate() in get_step(src.loc,direction) T = locate() in get_step(src.loc,direction)
if (!T || T.flipped == 1 || T.material != material) if (!T || T.flipped == 1 || T.material != material)
@@ -50,7 +50,7 @@
L.Add(turn(src.dir,90)) L.Add(turn(src.dir,90))
for(var/new_dir in L) for(var/new_dir in L)
var/obj/structure/table/T = locate() in get_step(src.loc,new_dir) var/obj/structure/table/T = locate() in get_step(src.loc,new_dir)
if(T && T.material == material) if(T && T.material.name == material.name)
if(T.flipped == 1 && T.dir == src.dir && !T.unflipping_check(new_dir)) if(T.flipped == 1 && T.dir == src.dir && !T.unflipping_check(new_dir))
return 0 return 0
return 1 return 1
@@ -90,7 +90,7 @@
flags |= ON_BORDER flags |= ON_BORDER
for(var/D in list(turn(direction, 90), turn(direction, -90))) for(var/D in list(turn(direction, 90), turn(direction, -90)))
var/obj/structure/table/T = locate() in get_step(src,D) var/obj/structure/table/T = locate() in get_step(src,D)
if(T && T.flipped == 0 && T.material == material && material) if(T && T.flipped == 0 && material && T.material && T.material.name == material.name)
T.flip(direction) T.flip(direction)
take_damage(rand(5, 20)) take_damage(rand(5, 20))
update_connections(1) update_connections(1)
@@ -108,7 +108,7 @@
flags &= ~ON_BORDER flags &= ~ON_BORDER
for(var/D in list(turn(dir, 90), turn(dir, -90))) for(var/D in list(turn(dir, 90), turn(dir, -90)))
var/obj/structure/table/T = locate() in get_step(src.loc,D) var/obj/structure/table/T = locate() in get_step(src.loc,D)
if(T && T.flipped == 1 && T.dir == src.dir && T.material == material && material) if(T && T.flipped == 1 && T.dir == src.dir && material && T.material&& T.material.name == material.name)
T.unflip() T.unflip()
update_connections(1) update_connections(1)

View File

@@ -1,38 +1,31 @@
var/global/material/material_holographic_steel = null
var/global/material/material_holographic_wood = null
/obj/structure/table /obj/structure/table
standard standard
icon_state = "plain_preview" icon_state = "plain_preview"
color = "#666666" color = "#666666"
New() New()
if(!name_to_material) populate_material_list() material = get_material_by_name(DEFAULT_WALL_MATERIAL)
material = name_to_material[DEFAULT_WALL_MATERIAL]
..() ..()
reinforced reinforced
icon_state = "reinf_preview" icon_state = "reinf_preview"
color = "#666666" color = "#666666"
New() New()
if(!name_to_material) populate_material_list() material = get_material_by_name(DEFAULT_WALL_MATERIAL)
material = name_to_material[DEFAULT_WALL_MATERIAL] reinforced = get_material_by_name(DEFAULT_WALL_MATERIAL)
reinforced = name_to_material[DEFAULT_WALL_MATERIAL]
..() ..()
woodentable woodentable
icon_state = "plain_preview" icon_state = "plain_preview"
color = "#824B28" color = "#824B28"
New() New()
if(!name_to_material) populate_material_list() material = get_material_by_name("wood")
material = name_to_material["wood"]
..() ..()
gamblingtable gamblingtable
icon_state = "gamble_preview" icon_state = "gamble_preview"
New() New()
if(!name_to_material) populate_material_list() material = get_material_by_name("wood")
material = name_to_material["wood"]
carpeted = 1 carpeted = 1
..() ..()
@@ -41,25 +34,18 @@ var/global/material/material_holographic_wood = null
color = "#00E1FF" color = "#00E1FF"
alpha = 77 // 0.3 * 255 alpha = 77 // 0.3 * 255
New() New()
if(!name_to_material) populate_material_list() material = get_material_by_name("glass")
material = name_to_material["glass"]
..() ..()
holotable holotable
icon_state = "holo_preview" icon_state = "holo_preview"
color = "#666666" color = "#666666"
New() New()
if(!material_holographic_steel) material = get_material_by_name("holographic [DEFAULT_WALL_MATERIAL]")
material_holographic_steel = new /material/steel
material_holographic_steel.stack_type = null // Tables with null-stacktype materials cannot be deconstructed
material = material_holographic_steel
..() ..()
woodentable/holotable woodentable/holotable
icon_state = "holo_preview" icon_state = "holo_preview"
New() New()
if(!material_holographic_wood) material = get_material_by_name("holographic wood")
material_holographic_wood = new /material/wood
material_holographic_wood.stack_type = null // Tables with null-stacktype materials cannot be deconstructed
material = material_holographic_wood
..() ..()

View File

@@ -227,6 +227,8 @@
user.visible_message("<span class='notice'>\The [user] dismantles \the [src].</span>", user.visible_message("<span class='notice'>\The [user] dismantles \the [src].</span>",
"<span class='notice'>You dismantle \the [src].</span>") "<span class='notice'>You dismantle \the [src].</span>")
new /obj/item/stack/sheet/metal(src.loc) new /obj/item/stack/sheet/metal(src.loc)
qdel(src)
return
/obj/structure/table/proc/break_to_parts(full_return = 0) /obj/structure/table/proc/break_to_parts(full_return = 0)
if(reinforced && reinforced.stack_type && (full_return || prob(25))) if(reinforced && reinforced.stack_type && (full_return || prob(25)))
@@ -274,7 +276,7 @@
var/tabledirs = 0 var/tabledirs = 0
for(var/direction in list(turn(dir,90), turn(dir,-90)) ) for(var/direction in list(turn(dir,90), turn(dir,-90)) )
var/obj/structure/table/T = locate(/obj/structure/table ,get_step(src,direction)) var/obj/structure/table/T = locate(/obj/structure/table ,get_step(src,direction))
if (T && T.flipped == 1 && T.dir == src.dir && T.material == material) if (T && T.flipped == 1 && T.dir == src.dir && T.material.name == material.name)
type++ type++
tabledirs |= direction tabledirs |= direction
@@ -351,7 +353,7 @@
for(var/obj/structure/table/T in oview(src, 1)) for(var/obj/structure/table/T in oview(src, 1))
var/T_dir = get_dir(src, T) var/T_dir = get_dir(src, T)
if(T_dir in blocked_dirs) continue if(T_dir in blocked_dirs) continue
if(material == T.material && flipped == T.flipped) if(material.name == T.material.name && flipped == T.flipped)
connection_dirs |= T_dir connection_dirs |= T_dir
if(propagate) if(propagate)
spawn(0) spawn(0)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB