Skip to content

Commit

Permalink
Tidies up grenades. (#26083)
Browse files Browse the repository at this point in the history
* Clean up grenades

* Update clusterbuster.dm

* Update grenade.dm

* Update flashbang.dm

* Update grenade.dm

* Update frag.dm

* Update code/game/objects/items/weapons/grenades/frag.dm

Co-authored-by: DGamerL <[email protected]>
Signed-off-by: CRUNCH <[email protected]>

* Update code/game/objects/items/weapons/grenades/ghettobomb.dm

Co-authored-by: DGamerL <[email protected]>
Signed-off-by: CRUNCH <[email protected]>

* update

* Update code/game/objects/items/weapons/grenades/frag.dm

Co-authored-by: Contrabang <[email protected]>
Signed-off-by: CRUNCH <[email protected]>

* update

* update

* Apply suggestions from code review

Co-authored-by: DGamerL <[email protected]>
Signed-off-by: CRUNCH <[email protected]>

* Update grenade.dm

* Update code/game/objects/items/weapons/grenades/frag.dm

Co-authored-by: DGamerL <[email protected]>
Signed-off-by: CRUNCH <[email protected]>

* Apply suggestions from code review

Co-authored-by: Burzah <[email protected]>
Signed-off-by: CRUNCH <[email protected]>

* extra var

---------

Signed-off-by: CRUNCH <[email protected]>
Co-authored-by: DGamerL <[email protected]>
Co-authored-by: Contrabang <[email protected]>
Co-authored-by: Burzah <[email protected]>
  • Loading branch information
4 people authored Aug 9, 2024
1 parent 2d94ff1 commit 3fd9106
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 79 deletions.
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/grenades/chem_grenade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
return TRUE

else if(stage == READY && !nadeassembly)
det_time = det_time == 50 ? 30 : 50 //toggle between 30 and 50
det_time = det_time == 5 SECONDS ? 3 SECONDS : 5 SECONDS // Toggle between 3 and 5 seconds.
to_chat(user, "<span class='notice'>You modify the time delay. It's set for [det_time / 10] second\s.</span>")
return TRUE

Expand Down
12 changes: 9 additions & 3 deletions code/game/objects/items/weapons/grenades/clusterbuster.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
//Clusterbang
////////////////////
/obj/item/grenade/clusterbuster
desc = "Use of this weapon may constitute a war crime in your area, consult your local captain."
name = "clusterbang"
desc = "Use of this weapon may constitute a war crime in your area, consult your local captain."
icon = 'icons/obj/grenade.dmi'
icon_state = "clusterbang"
item_state = "flashbang"
var/payload = /obj/item/grenade/flashbang/cluster

/obj/item/grenade/clusterbuster/examine(mob/user)
. = ..()
. += "<span class='notice'>Upon detonating, this grenade will explode into a shower of bomblets that will all explode individually. Be ready to run away very fast.</span>"

/obj/item/grenade/clusterbuster/prime()
update_mob()
var/numspawned = rand(4,8)
Expand All @@ -33,8 +37,8 @@
//Clusterbang segment
//////////////////////
/obj/item/grenade/clusterbuster/segment
desc = "A smaller segment of a clusterbang. Better run."
name = "clusterbang segment"
name = "clusterbang bomblet"
desc = "A bomblet released by a clusterbang. Better run!"
icon = 'icons/obj/grenade.dmi'
icon_state = "clusterbang_segment"

Expand Down Expand Up @@ -242,9 +246,11 @@

/obj/item/grenade/clusterbuster/mega_bang
name = "For when stunlocking is just too short."
desc = "Simply owning one of these makes you an active war criminal in all Nian jurisdictions."
payload = /obj/item/grenade/clusterbuster

/obj/item/grenade/clusterbuster/mega_syndieminibomb
name = "Mega SyndiWrath."
desc = "Proving once and for all that the maximum bomb explosion radius is just a suggestion."
payload = /obj/item/grenade/clusterbuster/syndieminibomb

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
payload_name = "holy water"
desc = "Then shalt thou count to three, no more, no less."
stage = 2
det_time = 30
det_time = 3 SECONDS

/obj/item/grenade/chem_grenade/holywater/Initialize(mapload)
. = ..()
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/grenades/emgrenade.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/obj/item/grenade/empgrenade
name = "classic EMP grenade"
desc = "It is designed to wreak havoc on electronic systems."
desc = "Upon detonation, releases a powerful EMP that will wreak havoc on electronic systems."
icon_state = "emp"
item_state = "emp"
origin_tech = "magnets=3;combat=2"
Expand Down
7 changes: 5 additions & 2 deletions code/game/objects/items/weapons/grenades/flashbang.dm
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
/obj/item/grenade/flashbang
name = "flashbang"
desc = "A less-than-lethal grenade designed for crowd control. Blinds all unprotected targets in range and disrupts their balance, sending them falling to the floor."
icon_state = "flashbang"
item_state = "flashbang"
belt_icon = "flashbang"
origin_tech = "materials=2;combat=3"
light_power = 10
light_color = LIGHT_COLOR_WHITE

var/light_time = 0.2 SECONDS // The duration the area is illuminated
var/range = 7 // The range in tiles of the flashbang
/// The duration the area is illuminated.
var/light_time = 0.2 SECONDS
/// The range in tiles of the flashbang.
var/range = 7

/obj/item/grenade/flashbang/prime()
update_mob()
Expand Down
6 changes: 4 additions & 2 deletions code/game/objects/items/weapons/grenades/frag.dm
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#define DEFAULT_SHRAPNEL_RANGE 5

/obj/item/grenade/frag
name = "frag grenade"
desc = "Fire in the hole."
name = "fragmentation grenade"
desc = "A grenade with a specially designed casing that will launch lethal fragments in all directions upon detonation. Fire in the hole!"
icon_state = "frag"
item_state = "grenade"
origin_tech = "materials=3;magnets=4"
/// How much shrapnel the grenade will launch.
var/shrapnel_contained = 20
/// The type of projectile that will fired.
var/embedded_type = /obj/item/projectile/bullet/shrapnel

/obj/item/grenade/frag/prime()
Expand Down
11 changes: 6 additions & 5 deletions code/game/objects/items/weapons/grenades/ghettobomb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/obj/item/grenade/iedcasing
name = "improvised firebomb"
desc = "A weak, improvised incendiary device."
desc = "A sketchy improvised incendiary device."
w_class = WEIGHT_CLASS_SMALL
icon = 'icons/obj/grenade.dmi'
icon_state = "improvised_grenade"
Expand All @@ -14,8 +14,13 @@
active = FALSE
det_time = 5 SECONDS
display_timer = FALSE
modifiable_timer = FALSE
var/list/times

/obj/item/grenade/iedcasing/examine(mob/user)
. = ..()
. += "<span class='warning'>You have no idea how long the fuze will last for until it explodes!</span>"

/obj/item/grenade/iedcasing/Initialize(mapload)
. = ..()
overlays += "improvised_grenade_filled"
Expand Down Expand Up @@ -60,7 +65,3 @@
update_mob()
explosion(loc, -1, -1, 2, flame_range = 4) // small explosion, plus a very large fireball.
qdel(src)

/obj/item/grenade/iedcasing/examine(mob/user)
. = ..()
. += "You can't tell when it will explode!"
113 changes: 56 additions & 57 deletions code/game/objects/items/weapons/grenades/grenade.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/obj/item/grenade
name = "grenade"
desc = "A hand held grenade, with an adjustable timer."
desc = "A hand held grenade with an adjustable timer."
w_class = WEIGHT_CLASS_SMALL
icon = 'icons/obj/grenade.dmi'
icon_state = "grenade"
Expand All @@ -11,9 +11,29 @@
slot_flags = SLOT_FLAG_BELT
resistance_flags = FLAMMABLE
max_integrity = 40
/// Has the pin been pulled?
var/active = FALSE
var/det_time = 50
/// Time between the pin being pulled and detonation.
var/det_time = 5 SECONDS
/// Does the grenade show the fuze's time setting on examine?
var/display_timer = TRUE
/// Can the grenade's fuze time be changed?
var/modifiable_timer = TRUE

/obj/item/grenade/examine(mob/user)
. = ..()
if(!display_timer)
return

if(det_time > 1)
. += "<span class='notice'>The fuze is set to [det_time / 10] second\s.</span>"
else
. += "<span class='warning'>[src] is set for instant detonation.</span>"

if(modifiable_timer)
. += "<span class='notice'>Use a screwdriver to modify the time on the fuze.</span>"
else
. += "<span class='notice'>The fuze's time cannot be modified.</span>"

/obj/item/grenade/deconstruct(disassembled = TRUE)
if(!disassembled)
Expand All @@ -31,54 +51,30 @@
if(user)
user.drop_item()
prime()
return 0
return 1


/*/obj/item/grenade/afterattack(atom/target as mob|obj|turf|area, mob/user as mob)
if(istype(target, /obj/item/storage)) return ..() // Trying to put it in a full container
if(istype(target, /obj/item/gun/grenadelauncher)) return ..()
if((user.is_in_active_hand(src)) && (!active) && (clown_check(user)) && target.loc != src.loc)
to_chat(user, "<span class='warning'>You prime the [name]! [det_time/10] seconds!</span>")
active = TRUE
icon_state = initial(icon_state) + "_active"
playsound(loc, 'sound/weapons/armbomb.ogg', 75, TRUE, -3)
spawn(det_time)
prime()
return
user.dir = get_dir(user, target)
user.drop_item()
var/t = (isturf(target) ? target : target.loc)
walk_towards(src, t, 3)
return*/


/obj/item/grenade/examine(mob/user)
. = ..()
if(display_timer)
if(det_time > 1)
. += "The timer is set to [det_time/10] second\s."
else
. += "[src] is set for instant detonation."
return FALSE
return TRUE

/obj/item/grenade/attack_self(mob/user as mob)
if(!active)
if(clown_check(user))
to_chat(user, "<span class='warning'>You prime [src]! [det_time/10] seconds!</span>")
active = TRUE
icon_state = initial(icon_state) + "_active"
add_fingerprint(user)
var/turf/bombturf = get_turf(src)
var/area/A = get_area(bombturf)
message_admins("[key_name_admin(usr)] has primed a [name] for detonation at <A href='byond://?_src_=holder;adminplayerobservecoodjump=1;X=[bombturf.x];Y=[bombturf.y];Z=[bombturf.z]'>[A.name] (JMP)</a>")
log_game("[key_name(usr)] has primed a [name] for detonation at [A.name] ([bombturf.x],[bombturf.y],[bombturf.z])")
investigate_log("[key_name(usr)] has primed a [name] for detonation at [A.name] ([bombturf.x],[bombturf.y],[bombturf.z])", INVESTIGATE_BOMB)
add_attack_logs(user, src, "has primed for detonation", ATKLOG_FEW)
if(iscarbon(user))
var/mob/living/carbon/C = user
C.throw_mode_on()
spawn(det_time)
prime()
if(active)
return
if(!clown_check(user))
return

to_chat(user, "<span class='danger'>You prime [src]! [det_time / 10] seconds!</span>")
active = TRUE
icon_state = initial(icon_state) + "_active"
add_fingerprint(user)
var/turf/bombturf = get_turf(src)
var/area/A = get_area(bombturf)
message_admins("[key_name_admin(user)] has primed a [name] for detonation at <a href='byond://?_src_=holder;adminplayerobservecoodjump=1;X=[bombturf.x];Y=[bombturf.y];Z=[bombturf.z]'>[A.name] (JMP)</a>")
log_game("[key_name(user)] has primed a [name] for detonation at [A.name] ([bombturf.x],[bombturf.y],[bombturf.z])")
investigate_log("[key_name(user)] has primed a [name] for detonation at [A.name] ([bombturf.x],[bombturf.y],[bombturf.z])", INVESTIGATE_BOMB)
add_attack_logs(user, src, "has primed for detonation", ATKLOG_FEW)
if(iscarbon(user))
var/mob/living/carbon/C = user
C.throw_mode_on()
spawn(det_time)
prime()

/obj/item/grenade/proc/prime()
return
Expand All @@ -89,19 +85,22 @@
M.unEquip(src)

/obj/item/grenade/screwdriver_act(mob/living/user, obj/item/I)
if(!modifiable_timer)
return

switch(det_time)
if(1)
det_time = 10
if(1 DECISECONDS)
det_time = 1 SECONDS
to_chat(user, "<span class='notice'>You set [src] for 1 second detonation time.</span>")
if(10)
det_time = 30
if(1 SECONDS)
det_time = 3 SECONDS
to_chat(user, "<span class='notice'>You set [src] for 3 second detonation time.</span>")
if(30)
det_time = 50
if(3 SECONDS)
det_time = 5 SECONDS
to_chat(user, "<span class='notice'>You set [src] for 5 second detonation time.</span>")
if(50)
det_time = 1
to_chat(user, "<span class='notice'>You set [src] for instant detonation.</span>")
if(5 SECONDS)
det_time = 1 DECISECONDS
to_chat(user, "<span class='warning'>You set [src] for instant detonation.</span>")
add_fingerprint(user)
return TRUE

Expand Down
5 changes: 3 additions & 2 deletions code/game/objects/items/weapons/grenades/smokebomb.dm
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/obj/item/grenade/smokebomb
desc = "It is set to detonate in 2 seconds."
name = "smoke bomb"
desc = "A grenade filled with chemical agents that will turn into a dense smoke when detonated, making it impossible to see through without specialised optics."
icon = 'icons/obj/grenade.dmi'
icon_state = "smoke"
det_time = 20
det_time = 2 SECONDS
modifiable_timer = FALSE
item_state = "smoke"
slot_flags = SLOT_FLAG_BELT
var/datum/effect_system/smoke_spread/bad/smoke
Expand Down
10 changes: 7 additions & 3 deletions code/game/objects/items/weapons/grenades/spawnergrenade.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/obj/item/grenade/spawnergrenade
desc = "It is set to detonate in 5 seconds. It will unleash unleash an unspecified anomaly into the vicinity."
name = "delivery grenade"
desc = "Upon detonation, this will unleash an unspecified anomaly into the vicinity."
icon = 'icons/obj/grenade.dmi'
icon_state = "delivery"
item_state = "grenade"
Expand Down Expand Up @@ -33,20 +33,24 @@
return

/obj/item/grenade/spawnergrenade/manhacks
name = "manhack delivery grenade"
name = "viscerator delivery grenade"
desc = "This grenade contains 5 viscerators, tiny flying drones with lethally sharp blades. Upon detonation, they will be deployed and begin searching the area for targets."
spawner_type = /mob/living/simple_animal/hostile/viscerator
deliveryamt = 5
origin_tech = "materials=3;magnets=4;syndicate=3"

/obj/item/grenade/spawnergrenade/spesscarp
name = "carp delivery grenade"
desc = "This grenade contains 5 dehydrated space carp in a similar manner to dehydrated monkeys, which, upon detonation, \
will be rehydrated by a small reservoir of water contained within the grenade. These space carp will then attack anything in sight."
spawner_type = /mob/living/simple_animal/hostile/carp
deliveryamt = 5
origin_tech = "materials=3;magnets=4;syndicate=3"

/obj/item/grenade/spawnergrenade/feral_cats
name = "feral cat delivery grenade"
desc = "This grenade contains 5 dehydrated feral cats in a similar manner to dehydrated monkeys, which, upon detonation, will be rehydrated by a small reservoir of water contained within the grenade. These cats will then attack anything in sight."
desc = "This grenade contains 5 dehydrated feral cats in a similar manner to dehydrated monkeys, which, upon detonation, \
will be rehydrated by a small reservoir of water contained within the grenade. These cats will then attack anything in sight."
spawner_type = /mob/living/simple_animal/hostile/feral_cat
deliveryamt = 5
origin_tech = "materials=3;magnets=4;syndicate=3"
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/weapons/grenades/syndieminibomb.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/obj/item/grenade/syndieminibomb
name = "syndicate minibomb"
desc = "A syndicate manufactured explosive used to sow destruction and chaos."
name = "\improper Syndicate minibomb"
desc = "A Syndicate-manufactured high-explosive grenade used to sow destruction and chaos."
icon = 'icons/obj/grenade.dmi'
icon_state = "syndicate"
item_state = "grenade"
Expand Down

0 comments on commit 3fd9106

Please sign in to comment.