Files
Aurora.3/code/game/objects/stacks/glass.dm
johnsonmt88@gmail.com da5bfd3b0f Setting people's criminal status via SecHUDs now require the user to be alive, and to actually be wearing the HUD.
Set the solar control computers to 'off' by default since you have to set them off then back on again to get them working properly anyway.

Fixed a typo in glass/attackby() causing lit-glass tiles to not be created. Fixes issue 593

Moved certain procs in human/life.dm() into an if(stat != DEAD). This means that certain procs will update only if the mob is alive.
Affected procs:
- handle_virus_updates()
- handle_changeling()
- handle_mutations_and_radiation()
- handle_chemicals_in_body()
- handle_disabilities()
- handle_random_events() 
- update_canmove() 
- - If dead, it forces mob.canmove to 0, meaning you don't get to be the walking dead.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3925 316c924e-a436-60f5-8080-3fe189b3f50e
2012-06-27 06:16:31 +00:00

272 lines
7.6 KiB
Plaintext

/*
CONTAINS:
GLASS SHEET
REINFORCED GLASS SHEET
SHARDS
*/
// GLASS
/obj/item/stack/sheet/glass/attack_self(mob/user as mob)
construct_window(user)
/obj/item/stack/sheet/glass/attackby(obj/item/W, mob/user)
..()
if(istype(W,/obj/item/weapon/cable_coil))
var/obj/item/weapon/cable_coil/CC = W
if(CC.amount < 5)
user << "\b There is not enough wire in this coil. You need 5 lengths."
CC.use(5)
src.use(1)
user << "\blue You attach wire to the [name]."
new /obj/item/stack/light_w(user.loc)
if(CC.amount <= 0)
user.u_equip(CC)
del(CC)
if(src.amount <= 0)
user.u_equip(src)
del(src)
else if( istype(W, /obj/item/stack/rods) )
var/obj/item/stack/rods/V = W
var/obj/item/stack/sheet/rglass/RG = new (user.loc)
RG.add_fingerprint(user)
RG.add_to_stacks(user)
V.use(1)
var/obj/item/stack/sheet/glass/G = src
src = null
var/replace = (user.get_inactive_hand()==G)
G.use(1)
if (!G && !RG && replace)
user.put_in_hands(RG)
else
return ..()
/obj/item/stack/sheet/glass/proc/construct_window(mob/user as mob)
if(!user || !src) return 0
if(!istype(user.loc,/turf)) return 0
if(!user.IsAdvancedToolUser())
user << "\red You don't have the dexterity to do this!"
return 0
var/title = "Sheet-Glass"
title += " ([src.amount] sheet\s left)"
switch(alert(title, "Would you like full tile glass or one direction?", "One Direction", "Full Window", "Cancel", null))
if("One Direction")
if(!src) return 1
if(src.loc != user) return 1
var/list/directions = new/list(cardinal)
var/i = 0
for (var/obj/structure/window/win in user.loc)
i++
if(i >= 4)
user << "\red There are too many windows in this location."
return 1
directions-=win.dir
if(!(win.ini_dir in cardinal))
user << "\red Can't let you do that."
return 1
//Determine the direction. It will first check in the direction the person making the window is facing, if it finds an already made window it will try looking at the next cardinal direction, etc.
var/dir_to_set = 2
for(var/direction in list( user.dir, turn(user.dir,90), turn(user.dir,180), turn(user.dir,270) ))
var/found = 0
for(var/obj/structure/window/WT in user.loc)
if(WT.dir == direction)
found = 1
if(!found)
dir_to_set = direction
break
var/obj/structure/window/W
W = new /obj/structure/window/basic( user.loc, 0 )
W.dir = dir_to_set
W.ini_dir = W.dir
W.anchored = 0
src.use(1)
if("Full Window")
if(!src) return 1
if(src.loc != user) return 1
if(src.amount < 2)
user << "\red You need more glass to do that."
return 1
if(locate(/obj/structure/window) in user.loc)
user << "\red There is a window in the way."
return 1
var/obj/structure/window/W
W = new /obj/structure/window/basic( user.loc, 0 )
W.dir = SOUTHWEST
W.ini_dir = SOUTHWEST
W.anchored = 0
src.use(2)
return 0
// REINFORCED GLASS
/obj/item/stack/sheet/rglass/attack_self(mob/user as mob)
construct_window(user)
/obj/item/stack/sheet/rglass/proc/construct_window(mob/user as mob)
if(!user || !src) return 0
if(!istype(user.loc,/turf)) return 0
if(!user.IsAdvancedToolUser())
user << "\red You don't have the dexterity to do this!"
return 0
var/title = "Sheet Reinf. Glass"
title += " ([src.amount] sheet\s left)"
switch(input(title, "Would you like full tile glass a one direction glass pane or a windoor?") in list("One Direction", "Full Window", "Windoor", "Cancel"))
if("One Direction")
if(!src) return 1
if(src.loc != user) return 1
var/list/directions = new/list(cardinal)
var/i = 0
for (var/obj/structure/window/win in user.loc)
i++
if(i >= 4)
user << "\red There are too many windows in this location."
return 1
directions-=win.dir
if(!(win.ini_dir in cardinal))
user << "\red Can't let you do that."
return 1
//Determine the direction. It will first check in the direction the person making the window is facing, if it finds an already made window it will try looking at the next cardinal direction, etc.
var/dir_to_set = 2
for(var/direction in list( user.dir, turn(user.dir,90), turn(user.dir,180), turn(user.dir,270) ))
var/found = 0
for(var/obj/structure/window/WT in user.loc)
if(WT.dir == direction)
found = 1
if(!found)
dir_to_set = direction
break
var/obj/structure/window/W
W = new /obj/structure/window/reinforced( user.loc, 1 )
W.state = 0
W.dir = dir_to_set
W.ini_dir = W.dir
W.anchored = 0
src.use(1)
if("Full Window")
if(!src) return 1
if(src.loc != user) return 1
if(src.amount < 2)
user << "\red You need more glass to do that."
return 1
if(locate(/obj/structure/window) in user.loc)
user << "\red There is a window in the way."
return 1
var/obj/structure/window/W
W = new /obj/structure/window/reinforced( user.loc, 1 )
W.state = 0
W.dir = SOUTHWEST
W.ini_dir = SOUTHWEST
W.anchored = 0
src.use(2)
if("Windoor")
if(!src || src.loc != user) return 1
if(isturf(user.loc) && locate(/obj/structure/windoor_assembly/, user.loc))
user << "\red There is already a windoor assembly in that location."
return 1
if(isturf(user.loc) && locate(/obj/machinery/door/window/, user.loc))
user << "\red There is already a windoor in that location."
return 1
if(src.amount < 5)
user << "\red You need more glass to do that."
return 1
var/obj/structure/windoor_assembly/WD
WD = new /obj/structure/windoor_assembly(user.loc)
WD.state = "01"
WD.anchored = 0
src.use(5)
switch(user.dir)
if(SOUTH)
WD.dir = SOUTH
WD.ini_dir = SOUTH
if(EAST)
WD.dir = EAST
WD.ini_dir = EAST
if(WEST)
WD.dir = WEST
WD.ini_dir = WEST
else//If the user is facing northeast. northwest, southeast, southwest or north, default to north
WD.dir = NORTH
WD.ini_dir = NORTH
else
return 1
return 0
// SHARDS
/obj/item/weapon/shard/Bump()
spawn( 0 )
if (prob(20))
src.force = 15
else
src.force = 4
..()
return
return
/obj/item/weapon/shard/New()
//****RM
//world<<"New shard at [x],[y],[z]"
src.icon_state = pick("large", "medium", "small")
switch(src.icon_state)
if("small")
src.pixel_x = rand(-12, 12)
src.pixel_y = rand(-12, 12)
if("medium")
src.pixel_x = rand(-8, 8)
src.pixel_y = rand(-8, 8)
if("large")
src.pixel_x = rand(-5, 5)
src.pixel_y = rand(-5, 5)
else
return
/obj/item/weapon/shard/attackby(obj/item/weapon/W as obj, mob/user as mob)
..()
if ( istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if(WT.remove_fuel(0, user))
var/obj/item/stack/sheet/glass/NG = new (user.loc)
for (var/obj/item/stack/sheet/glass/G in user.loc)
if(G==NG)
continue
if(G.amount>=G.max_amount)
continue
G.attackby(NG, user)
usr << "You add the newly-formed glass to the stack. It now contains [NG.amount] sheets."
//SN src = null
del(src)
return
return ..()
/obj/item/weapon/shard/HasEntered(AM as mob|obj)
if(ismob(AM))
var/mob/M = AM
M << "\red <B>You step in the broken glass!</B>"
playsound(src.loc, 'glass_step.ogg', 50, 1)
if(ishuman(M))
var/mob/living/carbon/human/H = M
if(!H.shoes)
var/datum/organ/external/affecting = H.get_organ(pick("l_leg", "r_leg"))
H.Weaken(3)
if(affecting.take_damage(5, 0))
H.UpdateDamageIcon()
H.updatehealth()
..()