From cfe684a8a450cf3adf9db796e1d3a0c3158b2d78 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Fri, 5 Apr 2019 13:58:10 -0700 Subject: [PATCH] Animal traps fixes and improvement (#6152) Fixes #6150 Animal traps now visually display what prey is inside of them by adding mob's icon as underlay. Tesla no longer logs spawn of new miniballs Fixes main changelog where it is supposed to be addition. Fixes #6158 Examining animal trap with prey now also displays examine message of the prey itself too. --- code/game/objects/items/weapons/traps.dm | 32 +++++++++++++++++ code/modules/power/tesla/energy_ball.dm | 12 ++++--- html/changelogs/.all_changelog.yml | 2 +- html/changelogs/Sindorman-animaltrap.yml | 44 ++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 6 deletions(-) create mode 100644 html/changelogs/Sindorman-animaltrap.yml diff --git a/code/game/objects/items/weapons/traps.dm b/code/game/objects/items/weapons/traps.dm index dd15a13dfb9..fe0748e9a07 100644 --- a/code/game/objects/items/weapons/traps.dm +++ b/code/game/objects/items/weapons/traps.dm @@ -152,6 +152,27 @@ health = 100 var/datum/weakref/captured = null +/obj/item/weapon/trap/animal/process() + update_icon() + +/obj/item/weapon/trap/animal/update_icon() + icon = initial(icon) + icon_state = "[icon_base][deployed]" + var/datum/L = captured ? captured.resolve() : null + if (!L) + deployed = FALSE + captured = null + release_time = world.time + underlays.Cut() + STOP_PROCESSING(SSprocessing, src) + return + if(isliving(L)) + var/mutable_appearance/MA = new(L) + MA.layer = FLOAT_LAYER + MA.plane = FLOAT_PLANE + underlays.Cut() + underlays += MA + /obj/item/weapon/trap/animal/examine(mob/user) ..() if(captured) @@ -171,9 +192,11 @@ message += "wounded" message += "." to_chat(user, message) + ll.examine(user) else if (istype(L, /obj/effect/spider/spiderling)) var/obj/effect/spider/spiderling/S = L to_chat(user, "\The [src] has [S] and it is alive.") + else to_chat(user, "\The [src] is empty.") @@ -201,6 +224,7 @@ deployed = 1 update_icon() src.animate_shake() + START_PROCESSING(SSprocessing, src) else if(istype(AM, /obj/effect/spider/spiderling) && spider) // for spiderlings var/obj/effect/spider/spiderling/S = AM @@ -289,6 +313,11 @@ if(!can_use(usr)) to_chat(usr, "You cannot use \the [src].") return + + if(usr in contents) + to_chat(usr, "You cannot open lock \the [src] from the inside. You would have to forcefully open it.") + return + if(!contents.len) return @@ -349,6 +378,7 @@ captured = null release_time = world.time update_icon() + STOP_PROCESSING(SSprocessing, src) return var/msg @@ -356,6 +386,7 @@ var/mob/living/ll = L ll.forceMove(target) msg = "[ll] runs out of \the [src]." + STOP_PROCESSING(SSprocessing, src) else if (istype(L, /obj/effect/spider/spiderling)) var/obj/effect/spider/spiderling/S = L S.forceMove(target) @@ -386,6 +417,7 @@ new /obj/item/stack/rods(src.loc, resources["rods"]) if(resources.len == 2) new /obj/item/stack/material/steel(src.loc, resources["metal"]) + release() qdel(src) else if(W.isscrewdriver()) diff --git a/code/modules/power/tesla/energy_ball.dm b/code/modules/power/tesla/energy_ball.dm index 4b611b94284..350b2de9034 100644 --- a/code/modules/power/tesla/energy_ball.dm +++ b/code/modules/power/tesla/energy_ball.dm @@ -51,10 +51,6 @@ pixel_x = 0 pixel_y = 0 - // This now does just the animation of all balls shooting main ball - for (var/obj/singularity/energy_ball/ball in orbiting_balls) - ball.Beam(src, icon_state="lightning[rand(1,12)]", icon = 'icons/effects/effects.dmi', time=2) - // Instead of miniballs shooting stuff, decided to make it just count the power produced. dir = tesla_zap(src, 10, TESLA_DEFAULT_POWER + orbiting_balls.len * TESLA_MINI_POWER, TRUE) @@ -66,6 +62,12 @@ if(energy < 0) qdel(src) +/obj/singularity/energy_ball/admin_investigate_setup() + if(orbiting) + return + else + ..() + /obj/singularity/energy_ball/examine(mob/user) ..() if(orbiting_balls.len) @@ -338,7 +340,7 @@ var/obj/singularity/energy_ball/E = source if(E.energy && (E.orbiting_balls.len > rods_count * 4)) // so that miniballs don't fry stuff. melt = TRUE// 1 grounding rod can handle max 4 balls - E.visible_message(span("danger", "All [E.orbiting_balls.len] energize for a second, sending their energy to the main ball, which redirects it at the nearest object! Sacraficing one of its miniballs!")) + E.visible_message(span("danger", "All [E.orbiting_balls.len] energize for a second, sending their energy to the main ball, which redirects it at the nearest object! Sacrificing one of its miniballs!")) for(var/obj/singularity/energy_ball/mini in E.orbiting_balls) mini.Beam(source, icon_state="lightning[rand(1,12)]", icon = 'icons/effects/effects.dmi', time=2) playsound(source.loc, 'sound/magic/lightning_chargeup.ogg', 100, 1, extrarange = 30) diff --git a/html/changelogs/.all_changelog.yml b/html/changelogs/.all_changelog.yml index f8a9015734c..a9feb8b22c4 100644 --- a/html/changelogs/.all_changelog.yml +++ b/html/changelogs/.all_changelog.yml @@ -7464,7 +7464,7 @@ DO NOT EDIT THIS FILE BY HAND! AUTOMATICALLY GENERATED BY ss13_genchangelog.py. - rscadd: Added Kinetic accelerator to mechs. RND can now research and make these Kinetc accelerators. There is a regular and a burst(3 shots) version. It will be better than average-decent man-held KA. - - rscdel: Added flamethrower for mechs. RND can now research and make this flamethrower. + - rscadd: Added flamethrower for mechs. RND can now research and make this flamethrower. Works like man-held flamethrower. - soundadd: Added flamethrower sound. - tweak: The LBX AC 10 "Scattershot" now uses shotgun sound effect. diff --git a/html/changelogs/Sindorman-animaltrap.yml b/html/changelogs/Sindorman-animaltrap.yml new file mode 100644 index 00000000000..bf8e6677bf5 --- /dev/null +++ b/html/changelogs/Sindorman-animaltrap.yml @@ -0,0 +1,44 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: PoZe + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - tweak: "Disassembling trap with things inside of it will release whatever is inside." + - rscadd: "Animal traps now display visually what prey is inside of them. And updates their sprite regularly, meaning if they fall down, loose limb, etc it will all be displayed visually." + - tweak: "Examining animal trap with prey inside will also give user examine message of the mob too." + - backend: "Tesla no longer logs spawn of new miniballs."