- 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

@@ -5,7 +5,7 @@
var/obj/structure/table/T
for(var/angle in list(-90,90))
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
T = locate() in get_step(src.loc,direction)
if (!T || T.flipped == 1 || T.material != material)
@@ -50,7 +50,7 @@
L.Add(turn(src.dir,90))
for(var/new_dir in L)
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))
return 0
return 1
@@ -90,7 +90,7 @@
flags |= ON_BORDER
for(var/D in list(turn(direction, 90), turn(direction, -90)))
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)
take_damage(rand(5, 20))
update_connections(1)
@@ -108,7 +108,7 @@
flags &= ~ON_BORDER
for(var/D in list(turn(dir, 90), turn(dir, -90)))
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()
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
standard
icon_state = "plain_preview"
color = "#666666"
New()
if(!name_to_material) populate_material_list()
material = name_to_material[DEFAULT_WALL_MATERIAL]
material = get_material_by_name(DEFAULT_WALL_MATERIAL)
..()
reinforced
icon_state = "reinf_preview"
color = "#666666"
New()
if(!name_to_material) populate_material_list()
material = name_to_material[DEFAULT_WALL_MATERIAL]
reinforced = name_to_material[DEFAULT_WALL_MATERIAL]
material = get_material_by_name(DEFAULT_WALL_MATERIAL)
reinforced = get_material_by_name(DEFAULT_WALL_MATERIAL)
..()
woodentable
icon_state = "plain_preview"
color = "#824B28"
New()
if(!name_to_material) populate_material_list()
material = name_to_material["wood"]
material = get_material_by_name("wood")
..()
gamblingtable
icon_state = "gamble_preview"
New()
if(!name_to_material) populate_material_list()
material = name_to_material["wood"]
material = get_material_by_name("wood")
carpeted = 1
..()
@@ -41,25 +34,18 @@ var/global/material/material_holographic_wood = null
color = "#00E1FF"
alpha = 77 // 0.3 * 255
New()
if(!name_to_material) populate_material_list()
material = name_to_material["glass"]
material = get_material_by_name("glass")
..()
holotable
icon_state = "holo_preview"
color = "#666666"
New()
if(!material_holographic_steel)
material_holographic_steel = new /material/steel
material_holographic_steel.stack_type = null // Tables with null-stacktype materials cannot be deconstructed
material = material_holographic_steel
material = get_material_by_name("holographic [DEFAULT_WALL_MATERIAL]")
..()
woodentable/holotable
icon_state = "holo_preview"
New()
if(!material_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
material = get_material_by_name("holographic wood")
..()

View File

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