Files
CHOMPStation2/code/game/objects/structures/girders.dm
Hubblenaut 044a677ab0 Construction Tweaks and Fixes (#2253)
* Fixes reinforced Walls construction

when having one sheet left in the stack

* Amends Windoors

 - Assemblies are now made with two sheets of either normal or reinforced
   glass sheets, for normal and secure windoors respecting.
 - Assemblies can now be named with a pen, just like airlocks.
 - Windoor assemblies now get placed like windows, and windows take
   windoor assemblies into account when placed.
 - Decapitalises windoor assembly names.
 - Shattering windoors will make them drop exactly what they were made of
   now.
 - Prying emagged windoors will no longer make them shatter on top of
   returning to an assembly.
 - Cleans up a lot of code and gets its own update_icon() proc.

* Amends airlocks

 - Fixes airlocks occasionally not updating their icon correctly.
 - Fixes airlocks causing sparks on spawn as if they were damaged.
 - Fixes airlock not being anchored after being turned into an assembly.
 - Decapitalises airlock names.

* Windows that get unanchored by force will now correctly have the rotate verb.

* Adds changelog entry
2016-08-02 18:39:22 +01:00

252 lines
7.7 KiB
Plaintext

/obj/structure/girder
icon_state = "girder"
anchored = 1
density = 1
layer = 2
w_class = 5
var/state = 0
var/health = 200
var/cover = 50 //how much cover the girder provides against projectiles.
var/material/reinf_material
var/reinforcing = 0
/obj/structure/girder/displaced
icon_state = "displaced"
anchored = 0
health = 50
cover = 25
/obj/structure/girder/attack_generic(var/mob/user, var/damage, var/attack_message = "smashes apart", var/wallbreaker)
if(!damage || !wallbreaker)
return 0
user.do_attack_animation(src)
visible_message("<span class='danger'>[user] [attack_message] the [src]!</span>")
spawn(1) dismantle()
return 1
/obj/structure/girder/bullet_act(var/obj/item/projectile/Proj)
//Girders only provide partial cover. There's a chance that the projectiles will just pass through. (unless you are trying to shoot the girder)
if(Proj.original != src && !prob(cover))
return PROJECTILE_CONTINUE //pass through
var/damage = Proj.get_structure_damage()
if(!damage)
return
if(!istype(Proj, /obj/item/projectile/beam))
damage *= 0.4 //non beams do reduced damage
health -= damage
..()
if(health <= 0)
dismantle()
return
/obj/structure/girder/proc/reset_girder()
anchored = 1
cover = initial(cover)
health = min(health,initial(health))
state = 0
icon_state = initial(icon_state)
reinforcing = 0
if(reinf_material)
reinforce_girder()
/obj/structure/girder/attackby(obj/item/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/wrench) && state == 0)
if(anchored && !reinf_material)
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
user << "<span class='notice'>Now disassembling the girder...</span>"
if(do_after(user,40))
if(!src) return
user << "<span class='notice'>You dissasembled the girder!</span>"
dismantle()
else if(!anchored)
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
user << "<span class='notice'>Now securing the girder...</span>"
if(do_after(user, 40,src))
user << "<span class='notice'>You secured the girder!</span>"
reset_girder()
else if(istype(W, /obj/item/weapon/pickaxe/plasmacutter))
user << "<span class='notice'>Now slicing apart the girder...</span>"
if(do_after(user,30))
if(!src) return
user << "<span class='notice'>You slice apart the girder!</span>"
dismantle()
else if(istype(W, /obj/item/weapon/pickaxe/diamonddrill))
user << "<span class='notice'>You drill through the girder!</span>"
dismantle()
else if(istype(W, /obj/item/weapon/screwdriver))
if(state == 2)
playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1)
user << "<span class='notice'>Now unsecuring support struts...</span>"
if(do_after(user,40))
if(!src) return
user << "<span class='notice'>You unsecured the support struts!</span>"
state = 1
else if(anchored && !reinf_material)
playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1)
reinforcing = !reinforcing
user << "<span class='notice'>\The [src] can now be [reinforcing? "reinforced" : "constructed"]!</span>"
else if(istype(W, /obj/item/weapon/wirecutters) && state == 1)
playsound(src.loc, 'sound/items/Wirecutter.ogg', 100, 1)
user << "<span class='notice'>Now removing support struts...</span>"
if(do_after(user,40))
if(!src) return
user << "<span class='notice'>You removed the support struts!</span>"
reinf_material.place_dismantled_product(get_turf(src))
reinf_material = null
reset_girder()
else if(istype(W, /obj/item/weapon/crowbar) && state == 0 && anchored)
playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1)
user << "<span class='notice'>Now dislodging the girder...</span>"
if(do_after(user, 40))
if(!src) return
user << "<span class='notice'>You dislodged the girder!</span>"
icon_state = "displaced"
anchored = 0
health = 50
cover = 25
else if(istype(W, /obj/item/stack/material))
if(reinforcing && !reinf_material)
if(!reinforce_with_material(W, user))
return ..()
else
if(!construct_wall(W, user))
return ..()
else
return ..()
/obj/structure/girder/proc/construct_wall(obj/item/stack/material/S, mob/user)
var/amount_to_use = reinf_material ? 1 : 2
if(S.get_amount() < amount_to_use)
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]
if(!istype(M))
return 0
var/wall_fake
add_hiddenprint(usr)
if(M.integrity < 50)
user << "<span class='notice'>This material is too soft for use in wall construction.</span>"
return 0
user << "<span class='notice'>You begin adding the plating...</span>"
if(!do_after(user,40) || !S.use(amount_to_use))
return 1 //once we've gotten this far don't call parent attackby()
if(anchored)
user << "<span class='notice'>You added the plating!</span>"
else
user << "<span class='notice'>You create a false wall! Push on it to open or close the passage.</span>"
wall_fake = 1
var/turf/Tsrc = get_turf(src)
Tsrc.ChangeTurf(/turf/simulated/wall)
var/turf/simulated/wall/T = get_turf(src)
T.set_material(M, reinf_material)
if(wall_fake)
T.can_open = 1
T.add_hiddenprint(usr)
qdel(src)
return 1
/obj/structure/girder/proc/reinforce_with_material(obj/item/stack/material/S, mob/user) //if the verb is removed this can be renamed.
if(reinf_material)
user << "<span class='notice'>\The [src] is already reinforced.</span>"
return 0
if(S.get_amount() < 1)
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]
if(!istype(M) || M.integrity < 50)
user << "You cannot reinforce \the [src] with that; it is too soft."
return 0
user << "<span class='notice'>Now reinforcing...</span>"
if (!do_after(user,40) || !S.use(1))
return 1 //don't call parent attackby() past this point
user << "<span class='notice'>You added reinforcement!</span>"
reinf_material = M
reinforce_girder()
return 1
/obj/structure/girder/proc/reinforce_girder()
cover = reinf_material.hardness
health = 500
state = 2
icon_state = "reinforced"
reinforcing = 0
/obj/structure/girder/proc/dismantle()
new /obj/item/stack/material/steel(get_turf(src))
qdel(src)
/obj/structure/girder/attack_hand(mob/user as mob)
if (HULK in user.mutations)
visible_message("<span class='danger'>[user] smashes [src] apart!</span>")
dismantle()
return
return ..()
/obj/structure/girder/ex_act(severity)
switch(severity)
if(1.0)
qdel(src)
return
if(2.0)
if (prob(30))
dismantle()
return
if(3.0)
if (prob(5))
dismantle()
return
else
return
/obj/structure/girder/cult
icon= 'icons/obj/cult.dmi'
icon_state= "cultgirder"
health = 250
cover = 70
/obj/structure/girder/cult/dismantle()
new /obj/effect/decal/remains/human(get_turf(src))
qdel(src)
/obj/structure/girder/cult/attackby(obj/item/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/wrench))
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
user << "<span class='notice'>Now disassembling the girder...</span>"
if(do_after(user,40))
user << "<span class='notice'>You dissasembled the girder!</span>"
dismantle()
else if(istype(W, /obj/item/weapon/pickaxe/plasmacutter))
user << "<span class='notice'>Now slicing apart the girder...</span>"
if(do_after(user,30))
user << "<span class='notice'>You slice apart the girder!</span>"
dismantle()
else if(istype(W, /obj/item/weapon/pickaxe/diamonddrill))
user << "<span class='notice'>You drill through the girder!</span>"
new /obj/effect/decal/remains/human(get_turf(src))
dismantle()