Merge pull request #3692 from Citadel-Station-13/upstream-merge-31986

[MIRROR] You can now hide grenades in plushies
This commit is contained in:
LetterJay
2017-10-30 23:33:16 -04:00
committed by GitHub
2 changed files with 149 additions and 96 deletions
+96 -95
View File
@@ -1,50 +1,50 @@
/obj/item/grenade
name = "grenade"
desc = "It has an adjustable timer."
w_class = WEIGHT_CLASS_SMALL
icon = 'icons/obj/grenade.dmi'
icon_state = "grenade"
item_state = "flashbang"
lefthand_file = 'icons/mob/inhands/equipment/security_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/security_righthand.dmi'
throw_speed = 3
throw_range = 7
flags_1 = CONDUCT_1
slot_flags = SLOT_BELT
resistance_flags = FLAMMABLE
max_integrity = 40
var/active = 0
var/det_time = 50
var/display_timer = 1
/obj/item/grenade/deconstruct(disassembled = TRUE)
if(!disassembled)
prime()
if(!QDELETED(src))
qdel(src)
/obj/item/grenade/proc/clown_check(mob/living/carbon/human/user)
if(user.disabilities & CLUMSY && prob(50))
to_chat(user, "<span class='warning'>Huh? How does this thing work?</span>")
/obj/item/grenade
name = "grenade"
desc = "It has an adjustable timer."
w_class = WEIGHT_CLASS_SMALL
icon = 'icons/obj/grenade.dmi'
icon_state = "grenade"
item_state = "flashbang"
lefthand_file = 'icons/mob/inhands/equipment/security_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/security_righthand.dmi'
throw_speed = 3
throw_range = 7
flags_1 = CONDUCT_1
slot_flags = SLOT_BELT
resistance_flags = FLAMMABLE
max_integrity = 40
var/active = 0
var/det_time = 50
var/display_timer = 1
/obj/item/grenade/deconstruct(disassembled = TRUE)
if(!disassembled)
prime()
if(!QDELETED(src))
qdel(src)
/obj/item/grenade/proc/clown_check(mob/living/carbon/human/user)
if(user.disabilities & CLUMSY && prob(50))
to_chat(user, "<span class='warning'>Huh? How does this thing work?</span>")
preprime(user, 5, FALSE)
return FALSE
return TRUE
/obj/item/grenade/examine(mob/user)
..()
if(display_timer)
if(det_time > 1)
to_chat(user, "The timer is set to [det_time/10] second\s.")
else
to_chat(user, "\The [src] is set for instant detonation.")
/obj/item/grenade/attack_self(mob/user)
if(!active)
if(clown_check(user))
preprime(user)
/obj/item/grenade/examine(mob/user)
..()
if(display_timer)
if(det_time > 1)
to_chat(user, "The timer is set to [det_time/10] second\s.")
else
to_chat(user, "\The [src] is set for instant detonation.")
/obj/item/grenade/attack_self(mob/user)
if(!active)
if(clown_check(user))
preprime(user)
/obj/item/grenade/proc/log_grenade(mob/user, turf/T)
var/area/A = get_area(T)
var/message = "[ADMIN_LOOKUPFLW(user)]) has primed \a [src] for detonation at [ADMIN_COORDJMP(T)]"
@@ -52,57 +52,58 @@
message_admins(message)
log_game("[key_name(user)] has primed \a [src] for detonation at [A.name] [COORD(T)].")
/obj/item/grenade/proc/preprime(mob/user, delayoverride, msg = TRUE)
/obj/item/grenade/proc/preprime(mob/user, delayoverride, msg = TRUE, volume = 60)
var/turf/T = get_turf(src)
log_grenade(user, T)
if(iscarbon(user))
var/mob/living/carbon/C = user
C.throw_mode_on()
if(msg)
to_chat(user, "<span class='warning'>You prime \the [src]! [det_time/10] seconds!</span>")
playsound(loc, 'sound/weapons/armbomb.ogg', 60, 1)
active = TRUE
icon_state = initial(icon_state) + "_active"
add_fingerprint(user)
log_grenade(user, T) //Inbuilt admin procs already handle null users
if(user)
add_fingerprint(user)
if(iscarbon(user))
var/mob/living/carbon/C = user
C.throw_mode_on()
if(msg)
to_chat(user, "<span class='warning'>You prime \the [src]! [det_time/10] seconds!</span>")
playsound(src, 'sound/weapons/armbomb.ogg', volume, 1)
active = TRUE
icon_state = initial(icon_state) + "_active"
addtimer(CALLBACK(src, .proc/prime), isnull(delayoverride)? det_time : delayoverride)
/obj/item/grenade/proc/prime()
/obj/item/grenade/proc/update_mob()
if(ismob(loc))
var/mob/M = loc
M.dropItemToGround(src)
/obj/item/grenade/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/screwdriver))
switch(det_time)
if ("1")
det_time = 10
to_chat(user, "<span class='notice'>You set the [name] for 1 second detonation time.</span>")
if ("10")
det_time = 30
to_chat(user, "<span class='notice'>You set the [name] for 3 second detonation time.</span>")
if ("30")
det_time = 50
to_chat(user, "<span class='notice'>You set the [name] for 5 second detonation time.</span>")
if ("50")
det_time = 1
to_chat(user, "<span class='notice'>You set the [name] for instant detonation.</span>")
add_fingerprint(user)
else
return ..()
/obj/item/grenade/attack_hand()
walk(src, null, null)
..()
/obj/item/grenade/attack_paw(mob/user)
return attack_hand(user)
/obj/item/grenade/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
var/obj/item/projectile/P = hitby
if(damage && attack_type == PROJECTILE_ATTACK && P.damage_type != STAMINA && prob(15))
owner.visible_message("<span class='danger'>[attack_text] hits [owner]'s [src], setting it off! What a shot!</span>")
prime()
/obj/item/grenade/proc/prime()
/obj/item/grenade/proc/update_mob()
if(ismob(loc))
var/mob/M = loc
M.dropItemToGround(src)
/obj/item/grenade/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/screwdriver))
switch(det_time)
if ("1")
det_time = 10
to_chat(user, "<span class='notice'>You set the [name] for 1 second detonation time.</span>")
if ("10")
det_time = 30
to_chat(user, "<span class='notice'>You set the [name] for 3 second detonation time.</span>")
if ("30")
det_time = 50
to_chat(user, "<span class='notice'>You set the [name] for 5 second detonation time.</span>")
if ("50")
det_time = 1
to_chat(user, "<span class='notice'>You set the [name] for instant detonation.</span>")
add_fingerprint(user)
else
return ..()
/obj/item/grenade/attack_hand()
walk(src, null, null)
..()
/obj/item/grenade/attack_paw(mob/user)
return attack_hand(user)
/obj/item/grenade/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
var/obj/item/projectile/P = hitby
if(damage && attack_type == PROJECTILE_ATTACK && P.damage_type != STAMINA && prob(15))
owner.visible_message("<span class='danger'>[attack_text] hits [owner]'s [src], setting it off! What a shot!</span>")
prime()
return TRUE //It hit the grenade, not them
+53 -1
View File
@@ -7,14 +7,66 @@
w_class = WEIGHT_CLASS_SMALL
resistance_flags = FLAMMABLE
var/list/squeak_override //Weighted list; If you want your plush to have different squeak sounds use this
var/stuffed = TRUE //If the plushie has stuffing in it
var/obj/item/grenade/grenade //You can remove the stuffing from a plushie and add a grenade to it for *nefarious uses*
/obj/item/toy/plush/Initialize()
. = ..()
AddComponent(/datum/component/squeak, squeak_override)
/obj/item/toy/plush/Destroy()
QDEL_NULL(grenade)
return ..()
/obj/item/toy/plush/handle_atom_del(atom/A)
if(A == grenade)
grenade = null
..()
/obj/item/toy/plush/attack_self(mob/user)
. = ..()
to_chat(user, "<span class='notice'>You pet [src]. D'awww.</span>")
if(stuffed || grenade)
to_chat(user, "<span class='notice'>You pet [src]. D'awww.</span>")
if(grenade && !grenade.active)
if(istype(grenade, /obj/item/grenade/chem_grenade))
var/obj/item/grenade/chem_grenade/G = grenade
if(G.nadeassembly) //We're activated through different methods
return
log_game("[key_name(user)] activated a hidden grenade in [src].")
grenade.preprime(user, msg = FALSE, volume = 10)
else
to_chat(user, "<span class='notice'>You try to pet [src], but it has no stuffing. Aww...</span>")
/obj/item/toy/plush/attackby(obj/item/I, mob/living/user, params)
if(I.is_sharp())
if(!grenade)
if(!stuffed)
to_chat(user, "<span class='warning'>You already murdered it!</span>")
return
user.visible_message("<span class='notice'>[user] tears out the stuffing from [src]!</span>", "<span class='notice'>You rip a bunch of the stuffing from [src]. Murderer.</span>")
playsound(I, I.usesound, 50, TRUE)
stuffed = FALSE
else
to_chat(user, "<span class='notice'>You remove the grenade from [src].</span>")
user.put_in_hands(grenade)
grenade = null
return
if(istype(I, /obj/item/grenade))
if(stuffed)
to_chat(user, "<span class='warning'>You need to remove some stuffing first!</span>")
return
if(grenade)
to_chat(user, "<span class='warning'>[src] already has a grenade!</span>")
return
if(!user.transferItemToLoc(I, src))
return
user.visible_message("<span class='warning'>[user] slides [grenade] into [src].</span>", \
"<span class='danger'>You slide [I] into [src].</span>")
grenade = I
var/turf/T = get_turf(user)
log_game("[key_name(user)] added a grenade ([I.name]) to [src] at [COORD(T)].")
return
return ..()
/obj/item/toy/plush/carpplushie
name = "space carp plushie"