Merge pull request #8570 from Trilbyspaceclone/patch-170
Ports origami skills for paper wiz loot
This commit is contained in:
@@ -48,18 +48,27 @@
|
||||
if(affecting && affecting.dismemberable && affecting.get_damage() >= (affecting.max_damage - P.dismemberment))
|
||||
affecting.dismember(P.damtype)
|
||||
|
||||
/mob/living/carbon/proc/can_catch_item(skip_throw_mode_check)
|
||||
. = FALSE
|
||||
if(!skip_throw_mode_check && !in_throw_mode)
|
||||
return
|
||||
if(get_active_held_item())
|
||||
return
|
||||
if(restrained())
|
||||
return
|
||||
return TRUE
|
||||
|
||||
/mob/living/carbon/hitby(atom/movable/AM, skipcatch, hitpush = TRUE, blocked = FALSE)
|
||||
if(!skipcatch) //ugly, but easy
|
||||
if(in_throw_mode && !get_active_held_item()) //empty active hand and we're in throw mode
|
||||
if(canmove && !restrained())
|
||||
if(istype(AM, /obj/item))
|
||||
var/obj/item/I = AM
|
||||
if(isturf(I.loc))
|
||||
I.attack_hand(src)
|
||||
if(get_active_held_item() == I) //if our attack_hand() picks up the item...
|
||||
visible_message("<span class='warning'>[src] catches [I]!</span>") //catch that sucker!
|
||||
throw_mode_off()
|
||||
return 1
|
||||
if(can_catch_item())
|
||||
if(istype(AM, /obj/item))
|
||||
var/obj/item/I = AM
|
||||
if(isturf(I.loc))
|
||||
I.attack_hand(src)
|
||||
if(get_active_held_item() == I) //if our attack_hand() picks up the item...
|
||||
visible_message("<span class='warning'>[src] catches [I]!</span>") //catch that sucker!
|
||||
throw_mode_off()
|
||||
return 1
|
||||
..()
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
/obj/item/paperplane
|
||||
name = "paper plane"
|
||||
desc = "Paper, folded in the shape of a plane."
|
||||
@@ -10,8 +11,14 @@
|
||||
resistance_flags = FLAMMABLE
|
||||
max_integrity = 50
|
||||
|
||||
var/hit_probability = 2//%
|
||||
var/obj/item/paper/internalPaper
|
||||
|
||||
/obj/item/paperplane/origami
|
||||
desc = "Paper, masterfully folded in the shape of a plane."
|
||||
throwforce = 20 //same as throwing stars, but no chance of embedding.
|
||||
hit_probability = 100 //guaranteed to cause eye damage when it hits a mob.
|
||||
|
||||
/obj/item/paperplane/Initialize(mapload, obj/item/paper/newPaper)
|
||||
. = ..()
|
||||
pixel_y = rand(-8, 8)
|
||||
@@ -22,13 +29,18 @@
|
||||
color = newPaper.color
|
||||
newPaper.forceMove(src)
|
||||
else
|
||||
internalPaper = new /obj/item/paper(src)
|
||||
internalPaper = new(src)
|
||||
update_icon()
|
||||
|
||||
/obj/item/paperplane/Destroy()
|
||||
if(internalPaper)
|
||||
qdel(internalPaper)
|
||||
/obj/item/paperplane/handle_atom_del(atom/A)
|
||||
if(A == internalPaper)
|
||||
internalPaper = null
|
||||
if(!QDELETED(src))
|
||||
qdel(src)
|
||||
return ..()
|
||||
|
||||
/obj/item/paperplane/Destroy()
|
||||
QDEL_NULL(internalPaper)
|
||||
return ..()
|
||||
|
||||
/obj/item/paperplane/suicide_act(mob/living/user)
|
||||
@@ -48,7 +60,7 @@
|
||||
|
||||
/obj/item/paperplane/attack_self(mob/user)
|
||||
to_chat(user, "<span class='notice'>You unfold [src].</span>")
|
||||
var/atom/movable/internal_paper_tmp = internalPaper
|
||||
var/obj/item/paper/internal_paper_tmp = internalPaper
|
||||
internal_paper_tmp.forceMove(loc)
|
||||
internalPaper = null
|
||||
qdel(src)
|
||||
@@ -86,11 +98,18 @@
|
||||
. = ..(target, range, speed, thrower, FALSE, diagonals_first, callback)
|
||||
|
||||
/obj/item/paperplane/throw_impact(atom/hit_atom)
|
||||
if(iscarbon(hit_atom))
|
||||
var/mob/living/carbon/C = hit_atom
|
||||
if(C.can_catch_item(TRUE))
|
||||
var/datum/action/innate/origami/origami_action = locate() in C.actions
|
||||
if(origami_action?.active) //if they're a master of origami and have the ability turned on, force throwmode on so they'll automatically catch the plane.
|
||||
C.throw_mode_on()
|
||||
|
||||
if(..() || !ishuman(hit_atom))//if the plane is caught or it hits a nonhuman
|
||||
return
|
||||
var/mob/living/carbon/human/H = hit_atom
|
||||
if(prob(2))
|
||||
if((H.head && H.head.flags_cover & HEADCOVERSEYES) || (H.wear_mask && H.wear_mask.flags_cover & MASKCOVERSEYES) || (H.glasses && H.glasses.flags_cover & GLASSESCOVERSEYES))
|
||||
if(prob(hit_probability))
|
||||
if(H.is_eyes_covered())
|
||||
return
|
||||
visible_message("<span class='danger'>\The [src] hits [H] in the eye!</span>")
|
||||
H.adjust_blurriness(6)
|
||||
@@ -107,5 +126,11 @@
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You fold [src] into the shape of a plane!</span>")
|
||||
user.temporarilyRemoveItemFromInventory(src)
|
||||
I = new /obj/item/paperplane(user, src)
|
||||
var/obj/item/paperplane/plane_type = /obj/item/paperplane
|
||||
//Origami Master
|
||||
var/datum/action/innate/origami/origami_action = locate() in user.actions
|
||||
if(origami_action?.active)
|
||||
plane_type = /obj/item/paperplane/origami
|
||||
|
||||
I = new plane_type(user, src)
|
||||
user.put_in_hands(I)
|
||||
|
||||
Reference in New Issue
Block a user