mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
shrapnel for improvised explosives: 3rd times the charm (#13080)
* 3rd times the charm * manual unfuck * Fixed bug caused by new procs that caused empty casing to do jack shit * fixed the thing pjb asked me to fix * snake_case * current shrapnel = 0 once
This commit is contained in:
@@ -49,6 +49,9 @@
|
|||||||
|
|
||||||
var/list/attack_verb // used in attack() to say how something was attacked "[x] [z.attack_verb] [y] with [z]". Present tense.
|
var/list/attack_verb // used in attack() to say how something was attacked "[x] [z.attack_verb] [y] with [z]". Present tense.
|
||||||
|
|
||||||
|
var/shrapnel_amount = 0 // How many pieces of shrapnel it disintegrates into.
|
||||||
|
var/shrapnel_type = null
|
||||||
|
var/shrapnel_size = 1
|
||||||
|
|
||||||
|
|
||||||
var/vending_cat = null// subcategory for vending machines.
|
var/vending_cat = null// subcategory for vending machines.
|
||||||
@@ -1080,3 +1083,8 @@ var/global/list/image/blood_overlays = list()
|
|||||||
if(bit & slot_flags)
|
if(bit & slot_flags)
|
||||||
if(M.get_item_by_flag(bit) == src)
|
if(M.get_item_by_flag(bit) == src)
|
||||||
return TRUE
|
return TRUE
|
||||||
|
/obj/item/proc/get_shrapnel_projectile()
|
||||||
|
if(shrapnel_type)
|
||||||
|
return new shrapnel_type(src)
|
||||||
|
else
|
||||||
|
return 0
|
||||||
@@ -30,7 +30,9 @@
|
|||||||
var/assembled = 0
|
var/assembled = 0
|
||||||
active = 1
|
active = 1
|
||||||
det_time = 50
|
det_time = 50
|
||||||
|
var/list/shrapnel_list = new()
|
||||||
|
var/max_shrapnel = 8
|
||||||
|
var/current_shrapnel = 0
|
||||||
|
|
||||||
|
|
||||||
/obj/item/weapon/grenade/iedcasing/afterattack(atom/target, mob/user , flag) //Filling up the can
|
/obj/item/weapon/grenade/iedcasing/afterattack(atom/target, mob/user , flag) //Filling up the can
|
||||||
@@ -61,6 +63,26 @@
|
|||||||
name = "improvised explosive"
|
name = "improvised explosive"
|
||||||
active = 0
|
active = 0
|
||||||
det_time = rand(30,80)
|
det_time = rand(30,80)
|
||||||
|
else
|
||||||
|
|
||||||
|
add_shrapnel(I,user)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/obj/item/weapon/grenade/iedcasing/verb/remove_shrapnel()
|
||||||
|
|
||||||
|
set name = "Remove shrapnel"
|
||||||
|
set category = "Object"
|
||||||
|
|
||||||
|
if(assembled == 2 && shrapnel_list.len > 0)
|
||||||
|
|
||||||
|
|
||||||
|
to_chat(usr, "<span class='notice'>You remove all the shrapnel from the improvised explosive.</span>")
|
||||||
|
for(var/obj/item/shrapnel in shrapnel_list)
|
||||||
|
|
||||||
|
shrapnel.forceMove(get_turf(src))
|
||||||
|
shrapnel_list.Remove(shrapnel)
|
||||||
|
current_shrapnel = 0
|
||||||
|
|
||||||
/obj/item/weapon/grenade/iedcasing/attack_self(mob/user as mob) //Activating the IED
|
/obj/item/weapon/grenade/iedcasing/attack_self(mob/user as mob) //Activating the IED
|
||||||
if(!active)
|
if(!active)
|
||||||
@@ -82,9 +104,28 @@
|
|||||||
spawn(det_time)
|
spawn(det_time)
|
||||||
prime()
|
prime()
|
||||||
|
|
||||||
|
|
||||||
|
/obj/item/weapon/grenade/iedcasing/proc/add_shrapnel(var/obj/item/I, mob/user as mob)
|
||||||
|
|
||||||
|
if(assembled == 2)
|
||||||
|
if((current_shrapnel + I.shrapnel_size)<= max_shrapnel )
|
||||||
|
if(I.shrapnel_amount > 0|| I.w_class == W_CLASS_TINY)
|
||||||
|
shrapnel_list.Add(I)
|
||||||
|
current_shrapnel += I.shrapnel_size
|
||||||
|
if(user && user.drop_item(I, src))
|
||||||
|
to_chat(user, "<span class='notice'>You add \the [I] to the improvised explosive.</span>")
|
||||||
|
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 25, 1)
|
||||||
|
else
|
||||||
|
I.forceMove(src)
|
||||||
|
|
||||||
|
else if(user)
|
||||||
|
to_chat(user, "<span class='notice'>There is no room for \the [I] in the improvised explosive!.</span>")
|
||||||
|
|
||||||
|
|
||||||
/obj/item/weapon/grenade/iedcasing/prime() //Blowing that can up
|
/obj/item/weapon/grenade/iedcasing/prime() //Blowing that can up
|
||||||
update_mob()
|
update_mob()
|
||||||
explosion(get_turf(src.loc),-1,0,2)
|
explosion(get_turf(src.loc),-1,0,2)
|
||||||
|
process_shrapnel()
|
||||||
|
|
||||||
if(istype(loc, /obj/item/weapon/legcuffs/beartrap))
|
if(istype(loc, /obj/item/weapon/legcuffs/beartrap))
|
||||||
var/obj/item/weapon/legcuffs/beartrap/boomtrap = loc
|
var/obj/item/weapon/legcuffs/beartrap/boomtrap = loc
|
||||||
@@ -99,6 +140,29 @@
|
|||||||
H.legcuffed = null
|
H.legcuffed = null
|
||||||
qdel(src)
|
qdel(src)
|
||||||
|
|
||||||
|
|
||||||
|
/obj/item/weapon/grenade/iedcasing/proc/process_shrapnel()
|
||||||
|
|
||||||
|
if(shrapnel_list.len > 0)
|
||||||
|
var/atom/target
|
||||||
|
var/atom/curloc = get_turf(src)
|
||||||
|
var/list/possible_targets= trange(7, curloc)
|
||||||
|
var/list/bodyparts = list("head","chest","groin","l_arm","r_arm","l_hand","r_hand","l_leg","r_leg","l_foot","r_foot")
|
||||||
|
for(var/obj/item/shrapnel in shrapnel_list)
|
||||||
|
var/amount = shrapnel.shrapnel_amount
|
||||||
|
if(amount)
|
||||||
|
while(amount > 0)
|
||||||
|
amount--
|
||||||
|
var/obj/item/projectile/shrapnel_projectile = shrapnel.get_shrapnel_projectile()
|
||||||
|
target=pick(possible_targets)
|
||||||
|
shrapnel_projectile.forceMove(curloc)
|
||||||
|
shrapnel_projectile.launch_at(target,bodyparts[rand(1,bodyparts.len)],curloc,src)
|
||||||
|
qdel(shrapnel)
|
||||||
|
else
|
||||||
|
target =pick(possible_targets)
|
||||||
|
shrapnel.forceMove(curloc)
|
||||||
|
shrapnel.throw_at(target,9,10)
|
||||||
|
|
||||||
/obj/item/weapon/grenade/iedcasing/examine(mob/user)
|
/obj/item/weapon/grenade/iedcasing/examine(mob/user)
|
||||||
..()
|
..()
|
||||||
if(assembled == 3)
|
if(assembled == 3)
|
||||||
@@ -110,6 +174,15 @@
|
|||||||
assembled = 2
|
assembled = 2
|
||||||
active = 0
|
active = 0
|
||||||
|
|
||||||
|
/obj/item/weapon/grenade/iedcasing/preassembled/withshrapnel
|
||||||
|
name = "shrapnel loaded improvised explosive"
|
||||||
|
|
||||||
|
/obj/item/weapon/grenade/iedcasing/preassembled/withshrapnel/New()
|
||||||
|
..()
|
||||||
|
for(var/i = 1, i<=4,i++)
|
||||||
|
add_shrapnel(new /obj/item/weapon/shard(src), null)
|
||||||
|
|
||||||
|
|
||||||
/obj/item/weapon/grenade/iedcasing/preassembled/New()
|
/obj/item/weapon/grenade/iedcasing/preassembled/New()
|
||||||
..()
|
..()
|
||||||
det_time = rand(30,80)
|
det_time = rand(30,80)
|
||||||
|
|||||||
@@ -26,6 +26,9 @@
|
|||||||
siemens_coefficient = 1
|
siemens_coefficient = 1
|
||||||
origin_tech = Tc_MATERIALS + "=1"
|
origin_tech = Tc_MATERIALS + "=1"
|
||||||
attack_verb = list("attacks", "stabs", "pokes")
|
attack_verb = list("attacks", "stabs", "pokes")
|
||||||
|
shrapnel_amount = 1
|
||||||
|
shrapnel_size = 2
|
||||||
|
shrapnel_type = "/obj/item/projectile/bullet/shrapnel"
|
||||||
|
|
||||||
/obj/item/weapon/kitchen/utensil/New()
|
/obj/item/weapon/kitchen/utensil/New()
|
||||||
. = ..()
|
. = ..()
|
||||||
@@ -56,8 +59,8 @@
|
|||||||
name = "fork"
|
name = "fork"
|
||||||
desc = "Pointy."
|
desc = "Pointy."
|
||||||
icon_state = "fork"
|
icon_state = "fork"
|
||||||
sharpness = 0.6
|
|
||||||
sharpness_flags = SHARP_TIP
|
sharpness_flags = SHARP_TIP
|
||||||
|
sharpness = 0.6
|
||||||
var/loaded_food_name
|
var/loaded_food_name
|
||||||
var/image/loaded_food
|
var/image/loaded_food
|
||||||
melt_temperature = MELTPOINT_STEEL
|
melt_temperature = MELTPOINT_STEEL
|
||||||
@@ -204,6 +207,7 @@
|
|||||||
melt_temperature = MELTPOINT_STEEL
|
melt_temperature = MELTPOINT_STEEL
|
||||||
origin_tech = Tc_MATERIALS + "=1"
|
origin_tech = Tc_MATERIALS + "=1"
|
||||||
attack_verb = list("slashes", "stabs", "slices", "tears", "rips", "dices", "cuts")
|
attack_verb = list("slashes", "stabs", "slices", "tears", "rips", "dices", "cuts")
|
||||||
|
shrapnel_amount = 0
|
||||||
|
|
||||||
/obj/item/weapon/kitchen/utensil/knife/large/attackby(obj/item/weapon/W, mob/user)
|
/obj/item/weapon/kitchen/utensil/knife/large/attackby(obj/item/weapon/W, mob/user)
|
||||||
..()
|
..()
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
hitsound = 'sound/weapons/bladeslice.ogg'
|
hitsound = 'sound/weapons/bladeslice.ogg'
|
||||||
force = 5.0
|
force = 5.0
|
||||||
throwforce = 15.0
|
throwforce = 15.0
|
||||||
|
|
||||||
item_state = "shard-glassnew"
|
item_state = "shard-glassnew"
|
||||||
starting_materials = list(MAT_GLASS = 3750)
|
starting_materials = list(MAT_GLASS = 3750)
|
||||||
w_type = RECYK_GLASS
|
w_type = RECYK_GLASS
|
||||||
@@ -20,6 +21,9 @@
|
|||||||
siemens_coefficient = 0 //no conduct
|
siemens_coefficient = 0 //no conduct
|
||||||
attack_verb = list("stabs", "slashes", "slices", "cuts")
|
attack_verb = list("stabs", "slashes", "slices", "cuts")
|
||||||
var/glass = /obj/item/stack/sheet/glass/glass
|
var/glass = /obj/item/stack/sheet/glass/glass
|
||||||
|
shrapnel_amount = 3
|
||||||
|
shrapnel_type = "/obj/item/projectile/bullet/shrapnel/small"
|
||||||
|
shrapnel_size = 2
|
||||||
|
|
||||||
/obj/item/weapon/shard/New()
|
/obj/item/weapon/shard/New()
|
||||||
|
|
||||||
@@ -46,6 +50,7 @@
|
|||||||
icon_state = "plasmalarge"
|
icon_state = "plasmalarge"
|
||||||
item_state = "shard-plasglass"
|
item_state = "shard-plasglass"
|
||||||
glass = /obj/item/stack/sheet/glass/plasmaglass
|
glass = /obj/item/stack/sheet/glass/plasmaglass
|
||||||
|
shrapnel_type = "/obj/item/projectile/bullet/shrapnel/small/plasma"
|
||||||
|
|
||||||
/obj/item/weapon/shard/plasma/New()
|
/obj/item/weapon/shard/plasma/New()
|
||||||
..()
|
..()
|
||||||
|
|||||||
@@ -11,6 +11,9 @@
|
|||||||
var/caliber = "" //Which kind of guns it can be loaded into
|
var/caliber = "" //Which kind of guns it can be loaded into
|
||||||
var/projectile_type = ""//The bullet type to create when New() is called
|
var/projectile_type = ""//The bullet type to create when New() is called
|
||||||
var/obj/item/projectile/BB = null //The loaded bullet
|
var/obj/item/projectile/BB = null //The loaded bullet
|
||||||
|
shrapnel_amount = 1
|
||||||
|
shrapnel_type = "/obj/item/projectile/bullet/shrapnel/small"
|
||||||
|
shrapnel_size = 1
|
||||||
|
|
||||||
|
|
||||||
/obj/item/ammo_casing/New()
|
/obj/item/ammo_casing/New()
|
||||||
@@ -27,6 +30,15 @@
|
|||||||
icon_state = "[initial(icon_state)][BB ? "-live" : ""]"
|
icon_state = "[initial(icon_state)][BB ? "-live" : ""]"
|
||||||
desc = "[initial(desc)][BB ? "" : " This one is spent."]"
|
desc = "[initial(desc)][BB ? "" : " This one is spent."]"
|
||||||
|
|
||||||
|
/obj/item/ammo_casing/get_shrapnel_projectile()
|
||||||
|
if(BB)
|
||||||
|
|
||||||
|
var/obj/item/projectile/bullet_bill = BB
|
||||||
|
BB = null
|
||||||
|
return bullet_bill
|
||||||
|
else
|
||||||
|
return new shrapnel_type(src)
|
||||||
|
|
||||||
|
|
||||||
//Boxes of ammo
|
//Boxes of ammo
|
||||||
/obj/item/ammo_storage
|
/obj/item/ammo_storage
|
||||||
|
|||||||
@@ -709,4 +709,16 @@ var/list/impact_master = list()
|
|||||||
impact = get_hit_atom(A)
|
impact = get_hit_atom(A)
|
||||||
|
|
||||||
/obj/item/projectile/acidable()
|
/obj/item/projectile/acidable()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
/obj/item/projectile/proc/launch_at(var/atom/target,var/tar_zone = "chest",var/atom/curloc = get_turf(src),var/from = null) // doot doot shitcode alert
|
||||||
|
original = target
|
||||||
|
starting = curloc
|
||||||
|
shot_from = from
|
||||||
|
current = curloc
|
||||||
|
OnFired()
|
||||||
|
yo = target.loc.y - curloc.y
|
||||||
|
xo = target.loc.x - curloc.x
|
||||||
|
def_zone = tar_zone
|
||||||
|
spawn()
|
||||||
|
process()
|
||||||
@@ -23,6 +23,33 @@
|
|||||||
damage_type = TOX
|
damage_type = TOX
|
||||||
weaken = 5
|
weaken = 5
|
||||||
|
|
||||||
|
/obj/item/projectile/bullet/shrapnel
|
||||||
|
|
||||||
|
name = "shrapnel"
|
||||||
|
damage = 45
|
||||||
|
damage_type = BRUTE
|
||||||
|
weaken = 1
|
||||||
|
stun = 3
|
||||||
|
|
||||||
|
/obj/item/projectile/bullet/shrapnel/New()
|
||||||
|
..()
|
||||||
|
kill_count = rand(6,10)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/obj/item/projectile/bullet/shrapnel/small
|
||||||
|
|
||||||
|
name = "small shrapnel"
|
||||||
|
damage = 25
|
||||||
|
|
||||||
|
/obj/item/projectile/bullet/shrapnel/small/plasma
|
||||||
|
|
||||||
|
name = "small plasma shrapnel"
|
||||||
|
damage_type = TOX
|
||||||
|
color = "#BF5FFF"
|
||||||
|
damage = 35
|
||||||
|
|
||||||
|
|
||||||
/obj/item/projectile/bullet/weakbullet
|
/obj/item/projectile/bullet/weakbullet
|
||||||
name = "weak bullet"
|
name = "weak bullet"
|
||||||
icon_state = "bbshell"
|
icon_state = "bbshell"
|
||||||
|
|||||||
Reference in New Issue
Block a user