From e0170928f1d27b599523bab5f7a46aa82ed01015 Mon Sep 17 00:00:00 2001 From: Geeves Date: Fri, 28 May 2021 21:59:30 +0200 Subject: [PATCH] Googly Eyes (#11951) --- aurorastation.dme | 1 + code/__defines/_macros.dm | 2 + code/_onclick/click.dm | 5 +- code/_onclick/other_mobs.dm | 5 +- code/game/atoms_movable.dm | 3 + code/game/machinery/computer/computer.dm | 5 + code/game/machinery/vending.dm | 7 +- code/game/objects/items/sticker.dm | 88 ++++++++++++++++++ .../objects/items/weapons/storage/boxes.dm | 5 + .../objects/items/weapons/storage/storage.dm | 5 +- .../modules/cargo/random_stock/t2_uncommon.dm | 3 + html/changelogs/geeves-thanks_goon.yml | 6 ++ icons/obj/sticker.dmi | Bin 0 -> 467 bytes 13 files changed, 130 insertions(+), 5 deletions(-) create mode 100644 code/game/objects/items/sticker.dm create mode 100644 html/changelogs/geeves-thanks_goon.yml create mode 100644 icons/obj/sticker.dmi diff --git a/aurorastation.dme b/aurorastation.dme index 6f9bfe94771..b9a6d9d4518 100644 --- a/aurorastation.dme +++ b/aurorastation.dme @@ -883,6 +883,7 @@ #include "code\game\objects\items\shooting_range.dm" #include "code\game\objects\items\skrell.dm" #include "code\game\objects\items\spirit_board.dm" +#include "code\game\objects\items\sticker.dm" #include "code\game\objects\items\tajara.dm" #include "code\game\objects\items\toys.dm" #include "code\game\objects\items\trash.dm" diff --git a/code/__defines/_macros.dm b/code/__defines/_macros.dm index 7a35338a68d..9bc1b5ef92e 100644 --- a/code/__defines/_macros.dm +++ b/code/__defines/_macros.dm @@ -65,6 +65,8 @@ #define ispAI(A) istype(A, /mob/living/silicon/pai) +#define isbot(A) istype(A, /mob/living/bot) + #define isrobot(A) istype(A, /mob/living/silicon/robot) #define issilicon(A) istype(A, /mob/living/silicon) diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index 6c4b5b282cb..bf534e43b02 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -222,9 +222,10 @@ animals lunging, etc. */ /mob/proc/RangedAttack(var/atom/A, var/params) - if(!mutations.len) return - if((LASER_EYES in mutations) && a_intent == I_HURT) + if(length(mutations) && (LASER_EYES in mutations) && a_intent == I_HURT) LaserEyes(A, params) // moved into a proc below + return + A.attack_ranged(src, params) /* Restrained ClickOn diff --git a/code/_onclick/other_mobs.dm b/code/_onclick/other_mobs.dm index 4e3f7b801c6..2f27b4aeb76 100644 --- a/code/_onclick/other_mobs.dm +++ b/code/_onclick/other_mobs.dm @@ -30,7 +30,10 @@ A.attack_hand(src) -/atom/proc/attack_hand(mob/user as mob) +/atom/proc/attack_hand(mob/user) + return + +/atom/proc/attack_ranged(mob/user, params) return /mob/proc/attack_empty_hand(var/bp_hand) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index dda7e2de625..a6b1c94973d 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -426,3 +426,6 @@ /atom/movable/proc/get_floating_chat_x_offset() return 0 + +/atom/movable/proc/can_attach_sticker(var/mob/user, var/obj/item/sticker/S) + return TRUE \ No newline at end of file diff --git a/code/game/machinery/computer/computer.dm b/code/game/machinery/computer/computer.dm index d08487cebbe..22a9b943959 100644 --- a/code/game/machinery/computer/computer.dm +++ b/code/game/machinery/computer/computer.dm @@ -138,3 +138,8 @@ //Animals can run under them, lots of empty space return 1 return ..() + +// screens have a layer above, so we can't attach here +/obj/machinery/computer/can_attach_sticker(var/mob/user, var/obj/item/sticker/S) + to_chat(user, SPAN_WARNING("\The [src]'s non-stick surface prevents you from attaching a sticker to it!")) + return FALSE \ No newline at end of file diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm index 8816dc87a15..c01e2a014ed 100644 --- a/code/game/machinery/vending.dm +++ b/code/game/machinery/vending.dm @@ -833,4 +833,9 @@ throw_item.vendor_action(src) INVOKE_ASYNC(throw_item, /atom/movable.proc/throw_at, target, rand(3, 10), rand(1, 3), src) src.visible_message("[src] launches [throw_item.name] at [target.name]!") - return 1 \ No newline at end of file + return 1 + +// screens go over the lighting layer, so googly eyes go under them +/obj/machinery/vending/can_attach_sticker(var/mob/user, var/obj/item/sticker/S) + to_chat(user, SPAN_WARNING("\The [src]'s non-stick surface prevents you from attaching a sticker to it!")) + return FALSE \ No newline at end of file diff --git a/code/game/objects/items/sticker.dm b/code/game/objects/items/sticker.dm new file mode 100644 index 00000000000..355fa0fcf76 --- /dev/null +++ b/code/game/objects/items/sticker.dm @@ -0,0 +1,88 @@ +/obj/item/sticker + name = "sticker" + desc = "It's a sticker." + icon = 'icons/obj/sticker.dmi' + icon_state = "sticker" + flags = NOBLUDGEON + w_class = ITEMSIZE_TINY + vis_flags = VIS_INHERIT_LAYER | VIS_INHERIT_DIR + + var/datum/weakref/attached + var/list/rand_icons + +/obj/item/sticker/Initialize() + . = ..() + if(LAZYLEN(rand_icons)) + icon_state = pick(rand_icons) + +/obj/item/sticker/attack_hand(mob/user) + if(!attached) + return ..() + + if(user.a_intent == I_HELP) + remove_sticker(user) + return + + var/atom/movable/attached_atom = attached.resolve() + if(attached_atom) + attached_atom.attack_hand(user) // don't allow people to make sticker armor + +/obj/item/sticker/attack_ranged(mob/user) + if(!attached) + return + + var/atom/movable/attached_atom = attached.resolve() + if(attached_atom && user.Adjacent(attached_atom)) + attack_hand(user) + +/obj/item/sticker/attackby(obj/item/I, mob/user) + if(!attached) + return ..() + + var/atom/movable/attached_atom = attached.resolve() + if(attached_atom) + attached_atom.attackby(I, user) // don't allow people to make sticker armor + +/obj/item/sticker/afterattack(atom/movable/target, mob/user, proximity_flag, click_parameters) + if(!proximity_flag) + return + if(!istype(target) || (ismob(target) && !isbot(target))) + return + if(!target.can_attach_sticker(user, src)) + return + + var/list/mouse_control = mouse_safe_xy(click_parameters) + pixel_x = mouse_control["icon-x"] - 16 + pixel_y = mouse_control["icon-y"] - 16 + + attach_to(user, target) + +/obj/item/sticker/proc/attach_to(var/mob/user, var/atom/movable/A) + to_chat(user, SPAN_NOTICE("You attach \the [src] to \the [A].")) + user.drop_from_inventory(src, A) + attached = WEAKREF(A) + A.vis_contents += src + A.verbs += /atom/movable/proc/take_off_sticker + +/obj/item/sticker/proc/remove_sticker(var/mob/user) + user.put_in_hands(src) + var/atom/movable/attached_atom = attached.resolve() + if(attached_atom) + to_chat(user, SPAN_NOTICE("You remove \the [src] from \the [attached_atom].")) + attached_atom.vis_contents -= src + attached_atom.verbs -= /atom/movable/proc/take_off_sticker + attached = null + +/obj/item/sticker/googly_eye + name = "googly eye" + desc = "A large googly eye sticker." + rand_icons = list("googly", "googly1", "googly2") + + +/atom/movable/proc/take_off_sticker() + set name = "Remove Sticker" + set src in view(1) + + var/obj/item/sticker/S = locate() in src + if(S) + S.remove_sticker(usr) \ No newline at end of file diff --git a/code/game/objects/items/weapons/storage/boxes.dm b/code/game/objects/items/weapons/storage/boxes.dm index 90e451929a5..2233eaf5098 100644 --- a/code/game/objects/items/weapons/storage/boxes.dm +++ b/code/game/objects/items/weapons/storage/boxes.dm @@ -902,3 +902,8 @@ var/obj/item/closet_teleporter/CT_2 = new /obj/item/closet_teleporter(src) CT_1.linked_teleporter = CT_2 CT_2.linked_teleporter = CT_1 + +/obj/item/storage/box/googly + name = "googly eye box" + desc = "A box containing googly eyes." + starts_with = list(/obj/item/sticker/googly_eye = 8) \ No newline at end of file diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm index 2d2b0feb5a1..4c60bf196e6 100644 --- a/code/game/objects/items/weapons/storage/storage.dm +++ b/code/game/objects/items/weapons/storage/storage.dm @@ -704,6 +704,9 @@ remove_from_storage(O, T) O.tumble(2) +// putting a sticker on something puts it in its contents, storage items use their contents to store their items +/obj/item/storage/can_attach_sticker(var/mob/user, var/obj/item/sticker/S) + return FALSE //Returns the storage depth of an atom. This is the number of storage items the atom is contained in before reaching toplevel (the area). //Returns -1 if the atom was not found on container. @@ -770,4 +773,4 @@ //return 2**(w_class-1) //1,2,4,8,16,... -#undef STORAGE_SPACE_CAP +#undef STORAGE_SPACE_CAP \ No newline at end of file diff --git a/code/modules/cargo/random_stock/t2_uncommon.dm b/code/modules/cargo/random_stock/t2_uncommon.dm index 5026172e827..7bf5daada68 100644 --- a/code/modules/cargo/random_stock/t2_uncommon.dm +++ b/code/modules/cargo/random_stock/t2_uncommon.dm @@ -396,5 +396,8 @@ STOCK_ITEM_UNCOMMON(alt_glasses, 1) STOCK_ITEM_UNCOMMON(gumballs, 3) new /obj/item/glass_jar/gumball(L) +STOCK_ITEM_UNCOMMON(googly, 0.75) + new /obj/item/storage/box/googly(L) + STOCK_ITEM_UNCOMMON(nothing, 0) // no-op diff --git a/html/changelogs/geeves-thanks_goon.yml b/html/changelogs/geeves-thanks_goon.yml new file mode 100644 index 00000000000..f6691550353 --- /dev/null +++ b/html/changelogs/geeves-thanks_goon.yml @@ -0,0 +1,6 @@ +author: Geeves + +delete-after: True + +changes: + - rscadd: "Boxes of googly eyes can now spawn in cargo." \ No newline at end of file diff --git a/icons/obj/sticker.dmi b/icons/obj/sticker.dmi new file mode 100644 index 0000000000000000000000000000000000000000..d81ffc19248d9afa4a35cec7534722dd12c8cd20 GIT binary patch literal 467 zcmV;^0WAKBP)O0002Mz`(iyHq-zB00DGTPE!Ct=GbNc005tQR9JLGWpiV4X>fFDZ*Bkp zc$`yKaB_9`^iy#0_2eo`Eh^5;&r`5fFwryM;w;ZhDainGjE%TBGg33tGfE(w;*!LY zR3KBSxFj<$i=jW&AR8pkO7$};WlUNB7)&WB< z&fNU6)ZEm(5^Saz5@{O_b?DaNx6Fu0%W$Y8V41RltDg%vegG!*c4dYMVY>hT0K`c| zK~!jg?U_*y!XOYti(bGQ4`2xg@Cp*{eDC=f5(e}N+N!lr8NoNbw1h8r5*{7A1 z^U0$-&N(k0{Q-mHb#2h(2GyOx;pQ|b_ZNeIZ^))WxC-HQ00030jW-8Wr{+tdE}5+K zHRHXzpwzMczCrjEEG={9o^`ESd>sG)z_tkY2i|1r`UCkFwzBb3yKq&5wv6->1AXGy z;0O8xH3(OM{r~^~Rz$z^_D;2dd0wyw1KFW)lS++MfxHKZ@&Gd+Dw1$MO??0W002ov JPDHLkV1hbv${qj! literal 0 HcmV?d00001