[MIRROR] Mining tools now use tool system (#5462)
* Mining tools now use tool system * Update hydroponics.dm
This commit is contained in:
committed by
Poojawa
parent
5d18ffef44
commit
9b4770f855
@@ -5,6 +5,8 @@
|
||||
#define TOOL_WIRECUTTER "wirecutter"
|
||||
#define TOOL_WRENCH "wrench"
|
||||
#define TOOL_WELDER "welder"
|
||||
#define TOOL_MINING "mining"
|
||||
#define TOOL_SHOVEL "shovel"
|
||||
|
||||
|
||||
// If delay between the start and the end of tool operation is less than MIN_TOOL_SOUND_DELAY,
|
||||
|
||||
@@ -19,28 +19,22 @@
|
||||
for(var/I in other_archdrops)
|
||||
_archdrops[I] += other_archdrops[I]
|
||||
|
||||
/datum/component/archaeology/proc/Dig(obj/item/W, mob/living/user)
|
||||
/datum/component/archaeology/proc/Dig(obj/item/I, mob/living/user)
|
||||
if(dug)
|
||||
to_chat(user, "<span class='notice'>Looks like someone has dug here already.</span>")
|
||||
return
|
||||
|
||||
var/digging_speed
|
||||
if (istype(W, /obj/item/shovel))
|
||||
var/obj/item/shovel/S = W
|
||||
digging_speed = S.digspeed
|
||||
else if (istype(W, /obj/item/pickaxe))
|
||||
var/obj/item/pickaxe/P = W
|
||||
digging_speed = P.digspeed
|
||||
|
||||
if (digging_speed && isturf(user.loc))
|
||||
to_chat(user, "<span class='notice'>You start digging...</span>")
|
||||
playsound(parent, 'sound/effects/shovel_dig.ogg', 50, 1)
|
||||
|
||||
if(do_after(user, digging_speed, target = parent))
|
||||
if(!isturf(user.loc))
|
||||
return
|
||||
|
||||
if(I.tool_behaviour == TOOL_SHOVEL || I.tool_behaviour == TOOL_MINING)
|
||||
to_chat(user, "<span class='notice'>You start digging...</span>")
|
||||
|
||||
if(I.use_tool(parent, user, 40, volume=50))
|
||||
to_chat(user, "<span class='notice'>You dig a hole.</span>")
|
||||
gets_dug()
|
||||
dug = TRUE
|
||||
SSblackbox.record_feedback("tally", "pick_used_mining", 1, W.type)
|
||||
SSblackbox.record_feedback("tally", "pick_used_mining", 1, I.type)
|
||||
return COMPONENT_NO_AFTERATTACK
|
||||
|
||||
/datum/component/archaeology/proc/gets_dug()
|
||||
|
||||
@@ -173,8 +173,8 @@ GLOBAL_LIST_INIT(meteorsC, list(/obj/effect/meteor/dust)) //for space dust event
|
||||
|
||||
#undef METEOR_MEDAL
|
||||
|
||||
/obj/effect/meteor/attackby(obj/item/W, mob/user, params)
|
||||
if(istype(W, /obj/item/pickaxe))
|
||||
/obj/effect/meteor/attackby(obj/item/I, mob/user, params)
|
||||
if(I.tool_behaviour == TOOL_MINING)
|
||||
make_debris()
|
||||
qdel(src)
|
||||
else
|
||||
|
||||
@@ -124,11 +124,10 @@
|
||||
else
|
||||
icon_state = initial_state
|
||||
|
||||
/obj/structure/mineral_door/attackby(obj/item/W, mob/user, params)
|
||||
if(istype(W, /obj/item/pickaxe))
|
||||
var/obj/item/pickaxe/digTool = W
|
||||
/obj/structure/mineral_door/attackby(obj/item/I, mob/user, params)
|
||||
if(I.tool_behaviour == TOOL_MINING)
|
||||
to_chat(user, "<span class='notice'>You start digging the [name]...</span>")
|
||||
if(do_after(user,digTool.digspeed*(1+round(max_integrity*0.01)), target = src) && src)
|
||||
if(I.use_tool(src, user, 40, volume=50))
|
||||
to_chat(user, "<span class='notice'>You finish digging.</span>")
|
||||
deconstruct(TRUE)
|
||||
else if(user.a_intent != INTENT_HARM)
|
||||
|
||||
@@ -46,26 +46,26 @@
|
||||
return ..()
|
||||
|
||||
|
||||
/turf/closed/mineral/attackby(obj/item/pickaxe/P, mob/user, params)
|
||||
/turf/closed/mineral/attackby(obj/item/I, mob/user, params)
|
||||
if (!user.IsAdvancedToolUser())
|
||||
to_chat(usr, "<span class='warning'>You don't have the dexterity to do this!</span>")
|
||||
return
|
||||
|
||||
if (istype(P, /obj/item/pickaxe))
|
||||
if(I.tool_behaviour == TOOL_MINING)
|
||||
var/turf/T = user.loc
|
||||
if (!isturf(T))
|
||||
return
|
||||
|
||||
if(last_act+P.digspeed > world.time)//prevents message spam
|
||||
if(last_act + (40 * I.toolspeed) > world.time)//prevents message spam
|
||||
return
|
||||
last_act = world.time
|
||||
to_chat(user, "<span class='notice'>You start picking...</span>")
|
||||
|
||||
if(do_after(user,P.digspeed, target = src))
|
||||
if(I.use_tool(src, user, 40, volume=50))
|
||||
if(ismineralturf(src))
|
||||
to_chat(user, "<span class='notice'>You finish cutting into the rock.</span>")
|
||||
gets_drilled(user)
|
||||
SSblackbox.record_feedback("tally", "pick_used_mining", 1, P.type)
|
||||
SSblackbox.record_feedback("tally", "pick_used_mining", 1, I.type)
|
||||
else
|
||||
return attack_hand(user)
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
/turf/closed/mineral/attack_alien(mob/living/carbon/alien/M)
|
||||
to_chat(M, "<span class='notice'>You start digging into the rock...</span>")
|
||||
playsound(src, 'sound/effects/break_stone.ogg', 50, 1)
|
||||
if(do_after(M,40, target = src))
|
||||
if(do_after(M, 40, target = src))
|
||||
to_chat(M, "<span class='notice'>You tunnel into the rock.</span>")
|
||||
gets_drilled(M)
|
||||
|
||||
@@ -98,14 +98,14 @@
|
||||
..()
|
||||
if(ishuman(AM))
|
||||
var/mob/living/carbon/human/H = AM
|
||||
var/obj/item/I = H.is_holding_item_of_type(/obj/item/pickaxe)
|
||||
var/obj/item/I = H.is_holding_tool_quality(TOOL_MINING)
|
||||
if(I)
|
||||
attackby(I,H)
|
||||
attackby(I, H)
|
||||
return
|
||||
else if(iscyborg(AM))
|
||||
var/mob/living/silicon/robot/R = AM
|
||||
if(istype(R.module_active, /obj/item/pickaxe))
|
||||
attackby(R.module_active,R)
|
||||
if(R.module_active && R.module_active.tool_behaviour == TOOL_MINING)
|
||||
attackby(R.module_active, R)
|
||||
return
|
||||
else
|
||||
return
|
||||
|
||||
@@ -829,21 +829,19 @@
|
||||
if(!myseed && !weedlevel)
|
||||
to_chat(user, "<span class='warning'>[src] doesn't have any plants or weeds!</span>")
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] starts digging out [src]'s plants...</span>", "<span class='notice'>You start digging out [src]'s plants...</span>")
|
||||
O.play_tool_sound(src)
|
||||
if(!do_after(user, 50, target = src) || (!myseed && !weedlevel))
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] digs out the plants in [src]!</span>", "<span class='notice'>You dig out all of [src]'s plants!</span>")
|
||||
O.play_tool_sound(src)
|
||||
if(myseed) //Could be that they're just using it as a de-weeder
|
||||
age = 0
|
||||
plant_health = 0
|
||||
if(harvest)
|
||||
harvest = FALSE //To make sure they can't just put in another seed and insta-harvest it
|
||||
qdel(myseed)
|
||||
myseed = null
|
||||
weedlevel = 0 //Has a side effect of cleaning up those nasty weeds
|
||||
update_icon()
|
||||
user.visible_message("<span class='notice'>[user] starts digging out [src]'s plants...</span>",
|
||||
"<span class='notice'>You start digging out [src]'s plants...</span>")
|
||||
if(O.use_tool(src, user, 50, volume=50) || (!myseed && !weedlevel))
|
||||
user.visible_message("<span class='notice'>[user] digs out the plants in [src]!</span>", "<span class='notice'>You dig out all of [src]'s plants!</span>")
|
||||
if(myseed) //Could be that they're just using it as a de-weeder
|
||||
age = 0
|
||||
plant_health = 0
|
||||
if(harvest)
|
||||
harvest = FALSE //To make sure they can't just put in another seed and insta-harvest it
|
||||
qdel(myseed)
|
||||
myseed = null
|
||||
weedlevel = 0 //Has a side effect of cleaning up those nasty weeds
|
||||
update_icon()
|
||||
|
||||
else
|
||||
return ..()
|
||||
|
||||
@@ -12,16 +12,16 @@
|
||||
righthand_file = 'icons/mob/inhands/equipment/mining_righthand.dmi'
|
||||
w_class = WEIGHT_CLASS_BULKY
|
||||
materials = list(MAT_METAL=2000) //one sheet, but where can you make them?
|
||||
var/digspeed = 40
|
||||
tool_behaviour = TOOL_MINING
|
||||
toolspeed = 1
|
||||
usesound = list('sound/effects/picaxe1.ogg', 'sound/effects/picaxe2.ogg', 'sound/effects/picaxe3.ogg')
|
||||
attack_verb = list("hit", "pierced", "sliced", "attacked")
|
||||
|
||||
/obj/item/pickaxe/suicide_act(mob/living/user)
|
||||
user.visible_message("<span class='suicide'>[user] begins digging into their chest! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
if(do_after(user,30, target = user))
|
||||
play_tool_sound(user)
|
||||
if(use_tool(user, user, 30, volume=50))
|
||||
return BRUTELOSS
|
||||
user.visible_message("<span class='suicide'>[user] couldn't do it!</span>")
|
||||
user.visible_message("<span class='suicide'>[user] couldn't do it!</span>")
|
||||
return SHAME
|
||||
|
||||
/obj/item/pickaxe/mini
|
||||
@@ -38,7 +38,7 @@
|
||||
name = "silver-plated pickaxe"
|
||||
icon_state = "spickaxe"
|
||||
item_state = "spickaxe"
|
||||
digspeed = 20 //mines faster than a normal pickaxe, bought from mining vendor
|
||||
toolspeed = 0.5 //mines faster than a normal pickaxe, bought from mining vendor
|
||||
desc = "A silver-plated pickaxe that mines slightly faster than standard-issue."
|
||||
force = 17
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
name = "diamond-tipped pickaxe"
|
||||
icon_state = "dpickaxe"
|
||||
item_state = "dpickaxe"
|
||||
digspeed = 14
|
||||
toolspeed = 0.3
|
||||
desc = "A pickaxe with a diamond pick head. Extremely robust at cracking rock walls and digging up dirt."
|
||||
force = 19
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
icon_state = "handdrill"
|
||||
item_state = "jackhammer"
|
||||
slot_flags = SLOT_BELT
|
||||
digspeed = 25 //available from roundstart, faster than a pickaxe.
|
||||
toolspeed = 0.6 //available from roundstart, faster than a pickaxe.
|
||||
usesound = 'sound/weapons/drill.ogg'
|
||||
hitsound = 'sound/weapons/drill.ogg'
|
||||
desc = "An electric mining drill for the especially scrawny."
|
||||
@@ -68,19 +68,19 @@
|
||||
/obj/item/pickaxe/drill/diamonddrill
|
||||
name = "diamond-tipped mining drill"
|
||||
icon_state = "diamonddrill"
|
||||
digspeed = 7
|
||||
toolspeed = 0.2
|
||||
desc = "Yours is the drill that will pierce the heavens!"
|
||||
|
||||
/obj/item/pickaxe/drill/cyborg/diamond //This is the BORG version!
|
||||
name = "diamond-tipped cyborg mining drill" //To inherit the NODROP_1 flag, and easier to change borg specific drill mechanics.
|
||||
icon_state = "diamonddrill"
|
||||
digspeed = 7
|
||||
toolspeed = 0.2
|
||||
|
||||
/obj/item/pickaxe/drill/jackhammer
|
||||
name = "sonic jackhammer"
|
||||
icon_state = "jackhammer"
|
||||
item_state = "jackhammer"
|
||||
digspeed = 5 //the epitome of powertools. extremely fast mining, laughs at puny walls
|
||||
toolspeed = 0.1 //the epitome of powertools. extremely fast mining, laughs at puny walls
|
||||
usesound = 'sound/weapons/sonic_jackhammer.ogg'
|
||||
hitsound = 'sound/weapons/sonic_jackhammer.ogg'
|
||||
desc = "Cracks rocks with sonic blasts, and doubles as a demolition power tool for smashing walls."
|
||||
@@ -95,7 +95,8 @@
|
||||
flags_1 = CONDUCT_1
|
||||
slot_flags = SLOT_BELT
|
||||
force = 8
|
||||
var/digspeed = 20
|
||||
tool_behaviour = TOOL_SHOVEL
|
||||
toolspeed = 1
|
||||
usesound = 'sound/effects/shovel_dig.ogg'
|
||||
throwforce = 4
|
||||
item_state = "shovel"
|
||||
@@ -103,13 +104,12 @@
|
||||
materials = list(MAT_METAL=50)
|
||||
attack_verb = list("bashed", "bludgeoned", "thrashed", "whacked")
|
||||
sharpness = IS_SHARP
|
||||
|
||||
|
||||
/obj/item/shovel/suicide_act(mob/living/user)
|
||||
user.visible_message("<span class='suicide'>[user] begins digging their own grave! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
if(do_after(user,30, target = user))
|
||||
play_tool_sound(user)
|
||||
if(use_tool(user, user, 30, volume=50))
|
||||
return BRUTELOSS
|
||||
user.visible_message("<span class='suicide'>[user] couldn't do it!</span>")
|
||||
user.visible_message("<span class='suicide'>[user] couldn't do it!</span>")
|
||||
return SHAME
|
||||
|
||||
/obj/item/shovel/spade
|
||||
@@ -121,4 +121,4 @@
|
||||
righthand_file = 'icons/mob/inhands/equipment/hydroponics_righthand.dmi'
|
||||
force = 5
|
||||
throwforce = 7
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
@@ -198,7 +198,7 @@ GLOBAL_LIST_INIT(sand_recipes, list(\
|
||||
wires.interact(user)
|
||||
return
|
||||
|
||||
if(istype(I, /obj/item/pickaxe) || istype(I, /obj/item/resonator) || I.force >= 10)
|
||||
if(I.tool_behaviour == TOOL_MINING || istype(I, /obj/item/resonator) || I.force >= 10)
|
||||
GibtoniteReaction(user)
|
||||
return
|
||||
if(primed)
|
||||
|
||||
Reference in New Issue
Block a user