diff --git a/_maps/RandomRuins/SpaceRuins/originalcontent.dmm b/_maps/RandomRuins/SpaceRuins/originalcontent.dmm index 624aa03d7c..5f0dd0434a 100644 --- a/_maps/RandomRuins/SpaceRuins/originalcontent.dmm +++ b/_maps/RandomRuins/SpaceRuins/originalcontent.dmm @@ -742,6 +742,7 @@ /turf/open/indestructible/paper, /area/ruin/powered) "cc" = ( +/obj/item/book/granter/action/origami, /mob/living/simple_animal/hostile/boss/paper_wizard, /turf/open/indestructible/paper, /area/ruin/powered) diff --git a/code/game/objects/items/granters.dm b/code/game/objects/items/granters.dm index 8d0d8d020e..34ce6bc521 100644 --- a/code/game/objects/items/granters.dm +++ b/code/game/objects/items/granters.dm @@ -87,6 +87,33 @@ active = FALSE UpdateButtonIcon() +/obj/item/book/granter/action/origami + granted_action = /datum/action/innate/origami + name = "The Art of Origami" + desc = "A meticulously in-depth manual explaining the art of paper folding." + icon_state = "origamibook" + actionname = "origami" + oneuse = TRUE + remarks = list("Dead-stick stability...", "Symmetry seems to play a rather large factor...", "Accounting for crosswinds... really?", "Drag coefficients of various paper types...", "Thrust to weight ratios?", "Positive dihedral angle?", "Center of gravity forward of the center of lift...") + +/datum/action/innate/origami + name = "Origami Folding" + desc = "Toggles your ability to fold and catch robust paper airplanes." + button_icon_state = "origami_off" + check_flags = NONE + +/datum/action/innate/origami/Activate() + to_chat(owner, "You will now fold origami planes.") + button_icon_state = "origami_on" + active = TRUE + UpdateButtonIcon() + +/datum/action/innate/origami/Deactivate() + to_chat(owner, "You will no longer fold origami planes.") + button_icon_state = "origami_off" + active = FALSE + UpdateButtonIcon() + ///SPELLS/// /obj/item/book/granter/spell diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index e96bb7f121..57483f64e7 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -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("[src] catches [I]!") //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("[src] catches [I]!") //catch that sucker! + throw_mode_off() + return 1 ..() diff --git a/code/modules/paperwork/paperplane.dm b/code/modules/paperwork/paperplane.dm index e3ce30066a..2a298d39b1 100644 --- a/code/modules/paperwork/paperplane.dm +++ b/code/modules/paperwork/paperplane.dm @@ -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, "You unfold [src].") - 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("\The [src] hits [H] in the eye!") H.adjust_blurriness(6) @@ -107,5 +126,11 @@ return to_chat(user, "You fold [src] into the shape of a plane!") 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) diff --git a/icons/mob/actions.dmi b/icons/mob/actions.dmi index 0ef4996b07..65b5733ffe 100644 Binary files a/icons/mob/actions.dmi and b/icons/mob/actions.dmi differ diff --git a/icons/obj/library.dmi b/icons/obj/library.dmi index fbb55434d1..140f6a4d9e 100644 Binary files a/icons/obj/library.dmi and b/icons/obj/library.dmi differ