Skip to content

Commit 2144a93

Browse files
Henri215warriorstar-orionBurzahContrabangDGamerL
authored
Mining charges, second try! (ParadiseSS13#24790)
* mining charges * Apply suggestions from code review Co-authored-by: warriorstar-orion <[email protected]> * span class * deconstruct comment update * Apply suggestions from code review Co-authored-by: Burzah <[email protected]> * Update code/game/objects/items/weapons/explosives.dm Co-authored-by: Contrabang <[email protected]> * ops * Update code/game/objects/items/weapons/explosives.dm Co-authored-by: Burzah <[email protected]> * Apply suggestions from code review Co-authored-by: DGamerL <[email protected]> Signed-off-by: Henri215 <[email protected]> * Update code/modules/mining/equipment/mining_charges.dm Co-authored-by: DGamerL <[email protected]> Signed-off-by: Henri215 <[email protected]> --------- Signed-off-by: Henri215 <[email protected]> Co-authored-by: warriorstar-orion <[email protected]> Co-authored-by: Burzah <[email protected]> Co-authored-by: Contrabang <[email protected]> Co-authored-by: DGamerL <[email protected]>
1 parent d587eff commit 2144a93

File tree

10 files changed

+246
-3
lines changed

10 files changed

+246
-3
lines changed

code/datums/uplink_items/uplink_traitor.dm

+10
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
cost = 25 //A chef can get a knife that sharp easily, though it won't block. While you can get endless boomerang, they are less deadly than a stech, and slower / more predictable.
7878
job = list("Mime", "Chef")
7979

80+
// Shaft miner
8081
/datum/uplink_item/jobspecific/pressure_mod
8182
name = "Kinetic Accelerator Pressure Mod"
8283
desc = "A modification kit which allows Kinetic Accelerators to do greatly increased damage while indoors. Occupies 35% mod capacity."
@@ -86,6 +87,15 @@
8687
job = list("Shaft Miner")
8788
surplus = 0 // Requires a KA to even be used.
8889

90+
/datum/uplink_item/jobspecific/mining_charge_hacker
91+
name = "Mining Charge Hacker"
92+
desc = "Looks and functions like an advanced mining scanner, but allows mining charges to be placed anywhere and destroy more than rocks. \
93+
Use it on a mining charge to override its safeties. Reduces explosive power of mining charges due to the modification of their internals."
94+
reference = "MCH"
95+
item = /obj/item/t_scanner/adv_mining_scanner/syndicate
96+
cost = 25
97+
job = list("Shaft Miner")
98+
8999
//Chef
90100
/datum/uplink_item/jobspecific/specialsauce
91101
name = "Chef Excellence's Special Sauce"

code/game/objects/items/weapons/explosives.dm

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
var/image_overlay = null
1313
var/obj/item/assembly/nadeassembly = null
1414
var/assemblyattacher
15+
var/notify_admins = TRUE
1516

1617
/obj/item/grenade/plastic/Initialize(mapload)
1718
. = ..()
@@ -79,8 +80,9 @@
7980
target = AM
8081
loc = null
8182

82-
message_admins("[key_name_admin(user)]([ADMIN_QUE(user,"?")]) ([ADMIN_FLW(user,"FLW")]) planted [src.name] on [target.name] at ([target.x],[target.y],[target.z] - <A href='byond://?_src_=holder;adminplayerobservecoodjump=1;X=[target.x];Y=[target.y];Z=[target.z]'>JMP</a>) with [det_time] second fuse",0,1)
83-
log_game("[key_name(user)] planted [name] on [target.name] at ([target.x],[target.y],[target.z]) with [det_time] second fuse")
83+
if(notify_admins)
84+
message_admins("[ADMIN_LOOKUPFLW(user)] planted [src.name] on [target.name] at ([target.x],[target.y],[target.z] - <a href='byond://?_src_=holder;adminplayerobservecoodjump=1;X=[target.x];Y=[target.y];Z=[target.z]'>JMP</a>) with [det_time] second fuse", 0, 1)
85+
log_game("[key_name(user)] planted [name] on [target.name] at ([target.x],[target.y],[target.z]) with [det_time] second fuse")
8486

8587
AddComponent(/datum/component/persistent_overlay, image_overlay, target)
8688
if(!nadeassembly)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
/obj/item/grenade/plastic/miningcharge
2+
name = "industrial mining charge"
3+
desc = "Used to make big holes in rocks. Only works on rocks!"
4+
icon = 'icons/obj/mining.dmi'
5+
icon_state = "mining-charge-2"
6+
item_state = "charge_indust"
7+
det_time = 5
8+
notify_admins = FALSE // no need to make adminlogs on lavaland, while they are "safe" to use
9+
/// When TRUE, charges won't detonate on it's own. Used for mining detonator
10+
var/timer_off = FALSE
11+
var/installed = FALSE
12+
var/smoke_amount = 3
13+
/// list of sizes for explosion. Third number is used for actual rock explosion size, second number is radius for Weaken() effects, first is used for hacked charges
14+
var/boom_sizes = list(2, 3, 5)
15+
var/hacked = FALSE
16+
17+
/obj/item/grenade/plastic/miningcharge/Initialize()
18+
. = ..()
19+
image_overlay = mutable_appearance(icon, "[icon_state]_active", ON_EDGED_TURF_LAYER)
20+
21+
/obj/item/grenade/plastic/miningcharge/examine(mob/user)
22+
. = ..()
23+
if(hacked)
24+
. += "<span class='warning'>Its wiring is haphazardly changed.</span>"
25+
if(timer_off)
26+
. += "<span class='notice'>The mining charge is connected to a detonator.</span>"
27+
28+
/obj/item/grenade/plastic/miningcharge/attack_self(mob/user)
29+
if(nadeassembly)
30+
nadeassembly.attack_self(user)
31+
32+
/obj/item/grenade/plastic/miningcharge/afterattack(atom/movable/AM, mob/user, flag)
33+
if(!ismineralturf(AM) && !hacked)
34+
return
35+
if(is_ancient_rock(AM) && !hacked)
36+
to_chat(user, "<span class='notice'>This rock appears to be resistant to all mining tools except pickaxes!</span>")
37+
return
38+
if(!timer_off) //override original proc for plastic explosions
39+
return ..()
40+
if(!flag)
41+
return
42+
if(iscarbon(AM))
43+
return
44+
to_chat(user, "<span class='notice'>You start planting [src].</span>")
45+
if(!do_after(user, (2.5 SECONDS) * toolspeed, target = AM))
46+
return
47+
if(!user.unEquip(src))
48+
return
49+
target = AM
50+
forceMove(AM)
51+
if(hacked)
52+
message_admins("[ADMIN_LOOKUPFLW(user)] planted [name] on [target.name] at [ADMIN_COORDJMP(target)]")
53+
log_game("planted [name] on [target.name] at [COORD(target)]", user)
54+
installed = TRUE
55+
target.overlays += image_overlay
56+
57+
/obj/item/grenade/plastic/miningcharge/attackby(obj/item/I, mob/user, params)
58+
if(!istype(I, /obj/item/detonator))
59+
return
60+
var/obj/item/detonator/detonator = I
61+
if((src in detonator.bombs) || timer_off)
62+
to_chat(user, "<span class='warning'>[src] was already synchronized to a existing detonator!</span>")
63+
return
64+
detonator.bombs += src
65+
timer_off = TRUE
66+
to_chat(user, "<span class='notice'>You synchronize [src] to [I].</span>")
67+
playsound(src, 'sound/machines/twobeep.ogg', 50)
68+
detonator.update_icon()
69+
70+
/obj/item/grenade/plastic/miningcharge/proc/detonate()
71+
addtimer(CALLBACK(src, PROC_REF(prime)), 3 SECONDS)
72+
73+
/obj/item/grenade/plastic/miningcharge/prime()
74+
if(hacked) //try not to blow your fingers off
75+
explode()
76+
return
77+
var/turf/simulated/mineral/location = get_turf(target)
78+
var/datum/effect_system/smoke_spread/S = new
79+
S.set_up(smoke_amount, 0, location, null)
80+
S.start()
81+
for(var/turf/simulated/mineral/rock in circlerangeturfs(location, boom_sizes[3]))
82+
var/distance = get_dist_euclidian(location, rock)
83+
if(distance <= boom_sizes[3])
84+
rock.mineralAmt += 3 // if rock is going to get drilled, add bonus mineral amount
85+
rock.gets_drilled()
86+
for(var/mob/living/carbon/C in circlerange(location, boom_sizes[3]))
87+
var/distance = get_dist_euclidian(location, C)
88+
C.flash_eyes()
89+
C.Weaken((boom_sizes[2] - distance) * 1 SECONDS) //1 second for how close you are to center if you're in range
90+
C.AdjustDeaf((boom_sizes[3] - distance) * 5 SECONDS) //guaranteed deafness
91+
var/obj/item/organ/internal/ears/ears = C.get_int_organ(/obj/item/organ/internal/ears)
92+
if(istype(ears) && C.check_ear_prot() < HEARING_PROTECTION_MINOR) //headsets should be enough to avoid taking damage
93+
ears.receive_damage((boom_sizes[3] - distance) * 2) //something like that i guess. Mega charge makes 12 damage to ears if nearby
94+
to_chat(C, "<span class='userdanger'>You are knocked down by the power of the mining charge!</span>")
95+
qdel(src)
96+
97+
/obj/item/grenade/plastic/miningcharge/proc/explode()
98+
var/turf/location
99+
if(target)
100+
if(!QDELETED(target))
101+
if(isturf(target))
102+
location = get_turf(target)
103+
else
104+
location = get_atom_on_turf(target)
105+
target.overlays -= image_overlay
106+
else
107+
location = get_atom_on_turf(src)
108+
if(location)
109+
explosion(location, boom_sizes[1], boom_sizes[2], boom_sizes[3], cause = src)
110+
location.ex_act(2, target)
111+
qdel(src)
112+
113+
/obj/item/grenade/plastic/miningcharge/proc/override_safety()
114+
hacked = TRUE
115+
notify_admins = TRUE
116+
boom_sizes[1] = round(boom_sizes[1] / 3) //lesser - 0, normal - 0, mega - 1; c4 - 0
117+
boom_sizes[2] = round(boom_sizes[2] / 3) //lesser - 0, normal - 1, mega - 2; c4 - 0
118+
boom_sizes[3] = round(boom_sizes[3] / 1.5) //lesser - 2, normal - 3, mega - 5; c4 - 3
119+
120+
/// Overriding to avoid the chargers from exploding because of received damage
121+
/obj/item/grenade/plastic/miningcharge/deconstruct(disassembled = TRUE)
122+
if(!QDELETED(src))
123+
qdel(src)
124+
125+
/obj/item/grenade/plastic/miningcharge/lesser
126+
name = "mining charge"
127+
desc = "A mining charge. This one seems less powerful than industrial. Only works on rocks!"
128+
icon_state = "mining-charge-1"
129+
item_state = "charge_lesser"
130+
smoke_amount = 1
131+
boom_sizes = list(1, 2, 3)
132+
133+
/obj/item/grenade/plastic/miningcharge/mega
134+
name = "experimental mining charge"
135+
desc = "A mining charge. This one seems much more powerful than normal!"
136+
icon_state = "mining-charge-3"
137+
item_state = "charge_mega"
138+
smoke_amount = 5
139+
boom_sizes = list(4, 6, 8)
140+
141+
/obj/item/storage/backpack/duffel/miningcharges/populate_contents()
142+
for(var/i in 1 to 5)
143+
new /obj/item/grenade/plastic/miningcharge/lesser(src)
144+
for(var/i in 1 to 3)
145+
new /obj/item/grenade/plastic/miningcharge(src)
146+
new /obj/item/detonator(src)
147+
148+
//MINING CHARGE HACKER
149+
150+
/obj/item/t_scanner/adv_mining_scanner/syndicate
151+
var/charges = 6
152+
153+
/obj/item/t_scanner/adv_mining_scanner/syndicate/examine(mob/user)
154+
. = ..()
155+
. += "<span class='notice'>This scanner has an extra port for overriding mining charge safeties.</span>"
156+
157+
/obj/item/t_scanner/adv_mining_scanner/syndicate/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
158+
if(!istype(target, /obj/item/grenade/plastic/miningcharge))
159+
return
160+
var/obj/item/grenade/plastic/miningcharge/charge = target
161+
if(charge.hacked)
162+
to_chat(user, "<span class='notice'>[src] is already overridden!</span>")
163+
return
164+
if(charges <= 0)
165+
to_chat(user, "<span class='notice'>Its overriding function is depleted.</span>")
166+
return
167+
charge.override_safety()
168+
visible_message("<span class='warning'>Sparks fly out of [src]!</span>")
169+
playsound(src, "sparks", 50, TRUE)
170+
charges--
171+
if(charges <= 0)
172+
to_chat(user, "<span class='warning'>[src]'s internal battery for overriding mining charges has run dry!</span>")
173+
174+
// MINING CHARGES DETONATOR
175+
176+
/obj/item/detonator
177+
name = "mining charge detonator"
178+
desc = "A specialized mining device designed for controlled demolition operations using mining explosives."
179+
w_class = WEIGHT_CLASS_SMALL
180+
icon = 'icons/obj/mining.dmi'
181+
icon_state = "Detonator-0"
182+
183+
/// list of all bombs connected to a detonator for a moment
184+
var/list/bombs = list()
185+
186+
/obj/item/detonator/examine(mob/user)
187+
. = ..()
188+
if(length(bombs))
189+
. += "<span class='notice'>List of synched bombs:</span>"
190+
for(var/obj/item/grenade/plastic/miningcharge/charge in bombs)
191+
. += "<span class='notice'>[bicon(charge)] [charge]. Current status: [charge.installed ? "ready to detonate" : "ready to deploy"].</span>"
192+
193+
/obj/item/detonator/update_icon()
194+
. = ..()
195+
if(length(bombs))
196+
icon_state = "Detonator-1"
197+
else
198+
icon_state = initial(icon_state)
199+
200+
/obj/item/detonator/attack_self(mob/user)
201+
playsound(src, 'sound/items/detonator.ogg', 40)
202+
if(length(bombs))
203+
to_chat(user, "<span class='notice'>Activating explosives...</span>")
204+
for(var/obj/item/grenade/plastic/miningcharge/charge in bombs)
205+
if(QDELETED(charge))
206+
bombs -= charge
207+
update_icon() //if the last bomb was qdeleted, detonator icon should change after activating
208+
continue
209+
if(charge.installed)
210+
bombs -= charge
211+
charge.detonate()
212+
update_icon()
213+
else
214+
to_chat(user, "<span class='warning'>There are no charges linked to a detonator!</span>")
215+
return ..()

code/modules/mining/machine_vending.dm

+6-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
EQUIPMENT("Mining MODsuit", /obj/item/mod/control/pre_equipped/mining/vendor, 3500),
4343
EQUIPMENT("Asteroid MODsuit Skin", /obj/item/mod/skin_applier/asteroid, 1000),
4444
EQUIPMENT("Tracking Bio-chip Kit", /obj/item/storage/box/minertracker, 600),
45+
EQUIPMENT("Mining Charge Detonator", /obj/item/detonator, 150)
4546
)
4647
prize_list["Consumables"] = list(
4748
EQUIPMENT("10 Marker Beacons", /obj/item/stack/marker_beacon/ten, 100),
@@ -50,6 +51,8 @@
5051
EQUIPMENT("Jaunter", /obj/item/wormhole_jaunter, 750),
5152
EQUIPMENT("Chasm Jaunter Recovery Grenade", /obj/item/grenade/jaunter_grenade, 1500),
5253
EQUIPMENT("Lazarus Injector", /obj/item/lazarus_injector, 1000),
54+
EQUIPMENT("Mining Charge", /obj/item/grenade/plastic/miningcharge/lesser, 150),
55+
EQUIPMENT("Industrial Mining Charge", /obj/item/grenade/plastic/miningcharge, 500),
5356
EQUIPMENT("Point Transfer Card", /obj/item/card/mining_point_card, 500),
5457
EQUIPMENT("Shelter Capsule", /obj/item/survivalcapsule, 400),
5558
EQUIPMENT("Stabilizing Serum", /obj/item/hivelordstabilizer, 400),
@@ -248,7 +251,7 @@
248251
* * redeemer - The person holding it
249252
*/
250253
/obj/machinery/mineral/equipment_vendor/proc/redeem_voucher(obj/item/mining_voucher/voucher, mob/redeemer)
251-
var/items = list("Survival Capsule and Explorer's Webbing", "Resonator Kit", "Minebot Kit", "Extraction and Rescue Kit", "Crusher Kit", "Plasma Cutter", "Jaunter Kit", "Mining Conscription Kit")
254+
var/items = list("Survival Capsule and Explorer's Webbing", "Resonator Kit", "Minebot Kit", "Extraction and Rescue Kit", "Crusher Kit", "Plasma Cutter", "Mining Explosives Kit", "Jaunter Kit", "Mining Conscription Kit")
252255

253256
var/selection = tgui_input_list(redeemer, "Pick your equipment", "Mining Voucher Redemption", items)
254257
if(!selection || !Adjacent(redeemer) || QDELETED(voucher) || voucher.loc != redeemer)
@@ -274,6 +277,8 @@
274277
new /obj/item/kinetic_crusher(drop_location)
275278
if("Plasma Cutter")
276279
new /obj/item/gun/energy/plasmacutter(drop_location)
280+
if("Mining Explosives Kit")
281+
new /obj/item/storage/backpack/duffel/miningcharges(drop_location)
277282
if("Jaunter Kit")
278283
new /obj/item/wormhole_jaunter(drop_location)
279284
new /obj/item/stack/medical/bruise_pack/advanced(drop_location)

code/modules/research/designs/mining_designs.dm

+10
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,16 @@
111111
build_path = /obj/item/borg/upgrade/modkit/aoe/turfs
112112
category = list("Mining", "Cyborg Upgrade Modules")
113113

114+
/datum/design/mining_charges
115+
name = "Experimental Mining Charge"
116+
desc = "An experimental mining charge used to make big holes in rocks."
117+
id = "megacharge"
118+
req_tech = list("materials" = 5, "engineering" = 5, "plasmatech" = 6)
119+
build_type = PROTOLATHE
120+
materials = list(MAT_METAL = 4000, MAT_PLASMA = 6000, MAT_URANIUM = 1000)
121+
build_path = /obj/item/grenade/plastic/miningcharge/mega
122+
category = list("Mining")
123+
114124
/datum/design/lavarods
115125
name = "Lava-Resistant Iron Rods"
116126
desc = "Treated, specialized iron rods. When exposed to the vacuum of space their coating breaks off, but they can hold up against the extreme heat of molten liquids."

icons/mob/inhands/items_lefthand.dmi

2.02 KB
Binary file not shown.

icons/mob/inhands/items_righthand.dmi

2.53 KB
Binary file not shown.

icons/obj/mining.dmi

2.14 KB
Binary file not shown.

paradise.dme

+1
Original file line numberDiff line numberDiff line change
@@ -2053,6 +2053,7 @@
20532053
#include "code\modules\mining\equipment\lazarus_injector.dm"
20542054
#include "code\modules\mining\equipment\marker_beacons.dm"
20552055
#include "code\modules\mining\equipment\mineral_scanner.dm"
2056+
#include "code\modules\mining\equipment\mining_charges.dm"
20562057
#include "code\modules\mining\equipment\mining_tools.dm"
20572058
#include "code\modules\mining\equipment\regenerative_core.dm"
20582059
#include "code\modules\mining\equipment\resonator.dm"

sound/items/detonator.ogg

21.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)