Files
CHOMPStation2/code/game/objects/grille.dm
rastaf.zero@gmail.com 09e0bcf987 Stackable items redo. Many improvements, massive code clean up.
Metal and related materials now noticeable more user-friendly.
Added new canister color: yellow "CAUTION". Used for newly created from metal canisters. Can be relabeled once.
Some typos were fixed.
dsay verb now uses fakekey in stealth mode.
AI cannot remove the cell from the charger.
Added alientalk chat prefix: ":a" by Barhandar. Also added keyboard layout independent russian prefixes.
Binary translator done by more convenient may by Barhandar.
Is possible now to wash bloody hands in sink.
Probably fixed bug causes gibbed revheads be not counted as dead.
Some other fixes.


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@752 316c924e-a436-60f5-8080-3fe189b3f50e
2011-01-03 01:26:01 +00:00

161 lines
4.3 KiB
Plaintext

//returns the netnum of a stub cable at this grille loc, or 0 if none
/obj/grille/proc/get_connection()
var/turf/T = src.loc
if(!istype(T, /turf/simulated/floor))
return
for(var/obj/cable/C in T)
if(C.d1 == 0)
return C.netnum
return 0
/obj/grille/ex_act(severity)
switch(severity)
if(1.0)
del(src)
return
if(2.0)
if (prob(50))
//SN src = null
del(src)
return
if(3.0)
if (prob(25))
src.health -= 11
healthcheck()
else
return
/obj/grille/blob_act()
del(src)
/obj/grille/meteorhit(var/obj/M)
if (M.icon_state == "flaming")
src.health -= 2
healthcheck()
return
/obj/grille/attack_hand(var/obj/M)
if ((usr.mutations & 8))
usr << text("\blue You kick the grille.")
for(var/mob/O in oviewers())
if ((O.client && !( O.blinded )))
O << text("\red [] kicks the grille.", usr)
src.health -= 5
healthcheck()
return
else if(!shock(usr, 70))
usr << text("\blue You kick the grille.")
for(var/mob/O in oviewers())
if ((O.client && !( O.blinded )))
O << text("\red [] kicks the grille.", usr)
playsound(src.loc, 'grillehit.ogg', 80, 1)
src.health -= 3
/obj/grille/attack_paw(var/obj/M)
if ((usr.mutations & 8))
usr << text("\blue You kick the grille.")
for(var/mob/O in oviewers())
if ((O.client && !( O.blinded )))
O << text("\red [] kicks the grille.", usr)
src.health -= 5
healthcheck()
return
else if(!shock(usr, 70))
usr << text("\blue You kick the grille.")
for(var/mob/O in oviewers())
if ((O.client && !( O.blinded )))
O << text("\red [] kicks the grille.", usr)
playsound(src.loc, 'grillehit.ogg', 80, 1)
src.health -= 3
/obj/grille/attack_alien(var/obj/M)
if (istype(usr, /mob/living/carbon/alien/larva))//Safety check for larva, in case they get attack_alien in the future. /N
return
if (!shock(usr, 70))
usr << text("\green You mangle the grille.")
for(var/mob/O in oviewers())
if ((O.client && !( O.blinded )))
O << text("\red [] mangles the grille.", usr)
playsound(src.loc, 'grillehit.ogg', 80, 1)
src.health -= 3
healthcheck()
return
/obj/grille/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(air_group || (height==0)) return 1
if ((istype(mover, /obj/effects) || istype(mover, /obj/item/weapon/dummy) || istype(mover, /obj/beam) || istype(mover, /obj/meteor/small)))
return 1
else
if (istype(mover, /obj/bullet))
return prob(30)
else
return !src.density
/obj/grille/attackby(obj/item/weapon/W, mob/user)
if (istype(W, /obj/item/weapon/wirecutters))
if(!shock(user, 100))
playsound(src.loc, 'Wirecutter.ogg', 100, 1)
src.health = 0
else if ((istype(W, /obj/item/weapon/screwdriver) && (istype(src.loc, /turf/simulated) || src.anchored)))
if(!shock(user, 90))
playsound(src.loc, 'Screwdriver.ogg', 100, 1)
src.anchored = !( src.anchored )
user << (src.anchored ? "You have fastened the grille to the floor." : "You have unfastened the grill.")
for(var/mob/O in oviewers())
O << text("\red [user] [src.anchored ? "fastens" : "unfastens"] the grille.")
return
else if(istype(W, /obj/item/weapon/shard)) // can't get a shock by attacking with glass shard
src.health -= W.force * 0.1
else // anything else, chance of a shock
if(!shock(user, 70))
playsound(src.loc, 'grillehit.ogg', 80, 1)
switch(W.damtype)
if("fire")
src.health -= W.force
if("brute")
src.health -= W.force * 0.1
src.healthcheck()
..()
return
/obj/grille/proc/healthcheck()
if (src.health <= 0)
if (!( src.destroyed ))
src.icon_state = "brokengrille"
src.density = 0
src.destroyed = 1
new /obj/item/stack/rods( src.loc )
else
if (src.health <= -10.0)
new /obj/item/stack/rods( src.loc )
//SN src = null
del(src)
return
return
// shock user with probability prb (if all connections & power are working)
// returns 1 if shocked, 0 otherwise
/obj/grille/proc/shock(mob/user, prb)
if(!anchored || destroyed) // anchored/destroyed grilles are never connected
return 0
if(!prob(prb))
return 0
var/net = get_connection() // find the powernet of the connected cable
if(!net) // cable is unpowered
return 0
return src.electrocute(user, prb, net)