Merge pull request #8162 from Jordie0608/thisdrillwillnotpiercetheheavensbecauseithasbroken

Fixes #8148, Improves drill's handling of power
This commit is contained in:
Cheridan
2015-03-08 23:41:50 -05:00
7 changed files with 32 additions and 59 deletions
+2 -3
View File
@@ -124,10 +124,9 @@
if(istype(W, /obj/item/weapon/pickaxe/drill/jackhammer))
var/obj/item/weapon/pickaxe/drill/jackhammer/D = W
if(!D.bcell.use(300))
user << "<span class='notice'>Your jackhammer doesn't have enough power to break through that wall.</span>"
D.update_charge()
user << "<span class='notice'>Your [D.name] doesn't have enough power to break through the [name].</span>"
return
D.update_charge()
D.update_icon()
D.playDigSound()
dismantle(user)
+3 -4
View File
@@ -45,9 +45,9 @@
else if(istype(W, /obj/item/weapon/pickaxe/drill/jackhammer))
var/obj/item/weapon/pickaxe/drill/jackhammer/D = W
if(!D.bcell.use(D.drillcost))
D.update_charge()
user << "<span class='notice'>Your [D.name] doesn't have enough power to break through the [name].</span>"
return
D.update_charge()
D.update_icon()
user << "<span class='notice'>You smash through the girder!</span>"
new /obj/item/stack/sheet/metal(get_turf(src))
D.playDigSound()
@@ -292,9 +292,8 @@
else if(istype(W, /obj/item/weapon/pickaxe/drill/jackhammer))
var/obj/item/weapon/pickaxe/drill/jackhammer/D = W
if(!D.bcell.use(D.drillcost))
D.update_charge()
return
D.update_charge()
D.update_icon()
user << "<span class='notice'>Your jackhammer smashes through the girder!</span>"
var/obj/effect/decal/remains/human/R = new (get_turf(src))
transfer_fingerprints_to(R)
+2 -2
View File
@@ -57,9 +57,9 @@
else if(istype(W, /obj/item/weapon/pickaxe/drill/jackhammer))
var/obj/item/weapon/pickaxe/drill/jackhammer/D = W
if(!D.bcell.use(D.drillcost))
D.update_charge()
user << "<span class='notice'>Your [D.name] doesn't have enough power to break through the [name].</span>"
return
D.update_charge()
D.update_icon()
if(!src.loc)
return
user.visible_message("<span class='notice'>[user] destroys the [name]!</span>", \
+3 -4
View File
@@ -215,16 +215,15 @@
if(istype(W, /obj/item/weapon/pickaxe/drill/jackhammer))
var/obj/item/weapon/pickaxe/drill/jackhammer/D = W
if(!D.bcell.use(400))
D.update_charge()
user << "<span class='notice'>Your jackhammer doesn't have enough power to break through that wall.</span>"
user << "<span class='notice'>Your [D.name] doesn't have enough power to break through the [name].</span>"
return
D.update_charge()
D.update_icon()
if( !istype(src, /turf/simulated/wall) || !user || !W || !T )
return 1
if( user.loc == T && user.get_active_hand() == W )
D.playDigSound()
dismantle_wall()
visible_message("<span class='warning'>[user] smashes through the wall with [W]!</span>", "<span class='warning'>You hear the grinding of metal.</span>")
visible_message("<span class='warning'>[user] smashes through the [name] with the [W.name]!</span>", "<span class='warning'>You hear the grinding of metal.</span>")
return 1
else if( istype(W, /obj/item/weapon/melee/energy/blade) )
var/obj/item/weapon/melee/energy/blade/EB = W
@@ -34,20 +34,17 @@
return 1
else if(istype(W, /obj/item/weapon/pickaxe/drill/jackhammer))
var/obj/item/weapon/pickaxe/drill/jackhammer/D = W
if(!D.powered)
if(!D.bcell.use(800))
user << "<span class='notice'>Your [D.name] doesn't have enough power to break through the [name].</span>"
return 1
user << "<span class='notice'>You begin to smash though the reinforced wall.</span>"
user << "<span class='notice'>You begin to smash though the [name].</span>"
if(do_after(user, 50))
if( !istype(src, /turf/simulated/wall/r_wall) || !user || !W || !T )
return 1
if( user.loc == T && user.get_active_hand() == W )
if(!D.bcell.use(800))
user << "<span class='notice'>Your jackhammer doesn't have enough power to break through that wall.</span>"
D.update_charge()
return 1
D.update_charge()
D.update_icon()
D.playDigSound()
user << "<span class='notice'>Your jackhammer smashes though the last of the reinforced plating.</span>"
visible_message("<span class='warning'>[user] smashes through the [name] with the [D.name]!</span>", "<span class='warning'>You hear the grinding of metal.</span>")
dismantle_wall()
return 1
else if(istype(W, /obj/item/stack/sheet/metal) && d_state)
+2 -12
View File
@@ -63,7 +63,6 @@
var/list/digsound = list('sound/effects/picaxe1.ogg','sound/effects/picaxe2.ogg','sound/effects/picaxe3.ogg')
origin_tech = "materials=1;engineering=1"
attack_verb = list("hit", "pierced", "sliced", "attacked")
var/powered = 1 //used to check for drill charge when mining
/obj/item/weapon/pickaxe/proc/playDigSound()
playsound(src, pick(digsound),50,1)
@@ -87,21 +86,12 @@
desc = "An electric mining drill for the especially scrawny."
var/drillcost = 125 //80 mineral walls by default
var/obj/item/weapon/stock_parts/cell/high/bcell = null
powered = 0
/obj/item/weapon/pickaxe/drill/New() //this one starts with a cell pre-installed.
..()
bcell = new(src)
update_charge()
return
/obj/item/weapon/pickaxe/drill/proc/update_charge()
if(bcell && bcell.charge >= drillcost)
powered = 1
else
powered = 0
update_icon()
/obj/item/weapon/pickaxe/drill/update_icon()
if(!bcell)
icon_state = "[initial(icon_state)]-nocell"
@@ -119,14 +109,14 @@
W.loc = src
bcell = W
user << "<span class='notice'>You install a cell in [src].</span>"
update_charge()
update_icon()
else if(istype(W, /obj/item/weapon/screwdriver))
if(bcell)
bcell.updateicon()
bcell.loc = get_turf(src.loc)
bcell = null
user << "<span class='notice'>You remove the cell from [src].</span>"
update_charge()
update_icon()
return
..()
return
+15 -26
View File
@@ -392,39 +392,28 @@
if (!( istype(T, /turf) ))
return
if(!P.powered)
return
/*
if (istype(W, /obj/item/weapon/pickaxe/radius))
var/turf/T = user.loc
if (!( istype(T, /turf) ))
return
*/
//Watch your tabbing, microwave. --NEO
if(istype(P, /obj/item/weapon/pickaxe/drill))
var/obj/item/weapon/pickaxe/drill/D = P
if(isrobot(user))
var/mob/living/silicon/robot/R = user
if(!R.cell.use(D.drillcost))
R << "<span class='notice'>Your [D.name] doesn't have enough charge.</span>"
return
if(!D.bcell.use(D.drillcost))
user << "<span class='notice'>Your [D.name] doesn't have enough charge.</span>"
return
if(last_act+P.digspeed > world.time)//prevents message spam
return
last_act = world.time
user << "<span class='danger'>You start picking.</span>"
//playsound(user, 'sound/weapons/Genhit.ogg', 20, 1)
P.playDigSound()
if(do_after(user,P.digspeed))
if(istype(P, /obj/item/weapon/pickaxe/drill))
var/obj/item/weapon/pickaxe/drill/D = P
if(isrobot(user))
var/mob/living/silicon/robot/R = user
if(R && R.cell)
if(!R.cell.use(D.drillcost))
D.update_charge()
return
else
if(!D.bcell.use(D.drillcost))
user << "<span class='warning'>Your drill ran out of power.</span>"
D.update_charge()
return
D.update_charge()
user << "<span class='notice'>You finish cutting into the rock.</span>"
gets_drilled(user)
if(istype(src, /turf/simulated/mineral)) //sanity check against turf being deleted during digspeed delay
user << "<span class='notice'>You finish cutting into the rock.</span>"
P.update_icon()
gets_drilled(user)
else
return attack_hand(user)
return