From 1319ae8a2eeb2c13c7b13c600ff7ce186ea26139 Mon Sep 17 00:00:00 2001 From: Alberyk Date: Tue, 1 Aug 2017 02:17:29 -0300 Subject: [PATCH 1/6] Probably fixes most of the issue related with dropping/throwing off hand items. (#3199) Fixes #3172 Fixes #1110 --- code/modules/mob/living/carbon/carbon.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 94f0ffe5a27..7f8334a9145 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -133,7 +133,7 @@ /mob/living/carbon/swap_hand() var/obj/item/item_in_hand = src.get_active_hand() if(item_in_hand) //this segment checks if the item in your hand is twohanded. - if(istype(item_in_hand,/obj/item/weapon/material/twohanded)) + if(istype(item_in_hand,/obj/item/weapon/material/twohanded) || istype(item_in_hand,/obj/item/weapon/gun) || istype(item_in_hand,/obj/item/weapon/pickaxe)) if(item_in_hand:wielded == 1) usr << "Your other hand is too busy holding the [item_in_hand.name]" return From 1ee2203b019e7027b0f0dbdf53436219c08233ed Mon Sep 17 00:00:00 2001 From: Lohikar Date: Wed, 2 Aug 2017 11:53:23 -0500 Subject: [PATCH 2/6] clean up some legacy code (#3211) changes: /obj/effect/list_container/mobl has been replaced with /datum/mobl. /obj/effect/stop has been removed as it is unused. /obj/effect/shut_controller has been removed as it is unused. Uristrunes now cache in SSicon_cache. --- code/controllers/subsystems/icon_cache.dm | 2 ++ code/defines/obj.dm | 25 +-------------------- code/game/magic/Uristrunes.dm | 13 +++++------ code/modules/clothing/spacesuits/rig/rig.dm | 5 ----- code/modules/mob/mob.dm | 16 +++++++------ 5 files changed, 17 insertions(+), 44 deletions(-) diff --git a/code/controllers/subsystems/icon_cache.dm b/code/controllers/subsystems/icon_cache.dm index 834dcb5bba7..5512c2d3c50 100644 --- a/code/controllers/subsystems/icon_cache.dm +++ b/code/controllers/subsystems/icon_cache.dm @@ -24,6 +24,8 @@ var/list/floor_light_cache = list() var/list/ashtray_cache = list() + var/list/uristrunes = list() + /* Global associative list for caching humanoid icons. Index format m or f, followed by a string of 0 and 1 to represent bodyparts followed by husk fat hulk skeleton 1 or 0. diff --git a/code/defines/obj.dm b/code/defines/obj.dm index 59c7e271d0a..66ea3a33e51 100644 --- a/code/defines/obj.dm +++ b/code/defines/obj.dm @@ -155,27 +155,11 @@ var/global/ManifestJSON var/damage = 0.0 var/range = 10.0 - -/obj/effect/list_container - name = "list container" - -/obj/effect/list_container/mobl - name = "mobl" - var/master = null - - var/list/container = list( ) - /obj/effect/projection name = "Projection" desc = "This looks like a projection of something." anchored = 1.0 - -/obj/effect/shut_controller - name = "shut controller" - var/moving = null - var/list/parts = list( ) - /obj/structure/showcase name = "Showcase" icon = 'icons/obj/stationobjs.dmi' @@ -205,13 +189,6 @@ var/global/ManifestJSON user.drop_item() src.throw_at(target, throw_range, throw_speed, user) -/obj/effect/stop - var/victim = null - icon_state = "empty" - name = "Geas" - desc = "You can't resist." - // name = "" - /obj/effect/spawner name = "object spawner" @@ -227,4 +204,4 @@ var/global/ManifestJSON desc = "A long-fried AI mainframe from the 2420s. It's more fit to be holding rats than AIs at this point." icon = 'icons/obj/mainframe.dmi' anchored = 1 - density = 1 \ No newline at end of file + density = 1 diff --git a/code/game/magic/Uristrunes.dm b/code/game/magic/Uristrunes.dm index cecbefc7985..79238be00f5 100644 --- a/code/game/magic/Uristrunes.dm +++ b/code/game/magic/Uristrunes.dm @@ -56,14 +56,12 @@ var/list/word_to_uristrune_table = null return get_uristrune(bits, animated) - -var/list/uristrune_cache = list() - /proc/get_uristrune(symbol_bits, animated = 0) var/lookup = "[symbol_bits]-[animated]" - if(lookup in uristrune_cache) - return uristrune_cache[lookup] + var/icon/result = SSicon_cache.uristrunes[lookup] + if (result) + return result var/icon/I = icon('icons/effects/uristrunes.dmi', "blank") @@ -71,7 +69,6 @@ var/list/uristrune_cache = list() if(BITTEST(symbol_bits, i)) I.Blend(icon('icons/effects/uristrunes.dmi', "rune-[1 << i]"), ICON_OVERLAY) - I.SwapColor(rgb(0, 0, 0, 100), rgb(100, 0, 0, 200)) I.SwapColor(rgb(0, 0, 0, 50), rgb(150, 0, 0, 200)) @@ -97,7 +94,7 @@ var/list/uristrune_cache = list() if(ne == "#000000" || se == "#000000" || nw == "#000000" || sw == "#000000") I.DrawBox(rgb(200, 0, 0, 100), x, y) - var/icon/result = icon(I, "") + result = icon(I, "") result.Insert(I, "", frame = 1, delay = 10) @@ -126,6 +123,6 @@ var/list/uristrune_cache = list() result.Insert(I3, "", frame = 7, delay = 2) result.Insert(I2, "", frame = 8, delay = 2) - uristrune_cache[lookup] = result + SSicon_cache.uristrunes[lookup] = result return result diff --git a/code/modules/clothing/spacesuits/rig/rig.dm b/code/modules/clothing/spacesuits/rig/rig.dm index 4cfcbec4921..038bdb8bf01 100644 --- a/code/modules/clothing/spacesuits/rig/rig.dm +++ b/code/modules/clothing/spacesuits/rig/rig.dm @@ -838,11 +838,6 @@ if(wearer.transforming || !wearer.canmove) return - if(locate(/obj/effect/stop/, wearer.loc)) - for(var/obj/effect/stop/S in wearer.loc) - if(S.victim == wearer) - return - if(!wearer.lastarea) wearer.lastarea = get_area(wearer.loc) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 6e133f84ed6..3cf83f8eb09 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -319,7 +319,11 @@ /mob/proc/clear_point() QDEL_NULL(pointing_effect) -/mob/proc/ret_grab(obj/effect/list_container/mobl/L as obj, flag) +/datum/mobl // I have no idea what the fuck this is, but it's better for it to be a datum than an /obj/effect. + var/list/container = list() + var/master + +/mob/proc/ret_grab(datum/mobl/L, flag) if ((!( istype(l_hand, /obj/item/weapon/grab) ) && !( istype(r_hand, /obj/item/weapon/grab) ))) if (!( L )) return null @@ -327,26 +331,24 @@ return L.container else if (!( L )) - L = new /obj/effect/list_container/mobl( null ) + L = new /datum/mobl L.container += src L.master = src if (istype(l_hand, /obj/item/weapon/grab)) var/obj/item/weapon/grab/G = l_hand - if (!( L.container.Find(G.affecting) )) + if (!(L.container.Find(G.affecting))) L.container += G.affecting if (G.affecting) G.affecting.ret_grab(L, 1) if (istype(r_hand, /obj/item/weapon/grab)) var/obj/item/weapon/grab/G = r_hand - if (!( L.container.Find(G.affecting) )) + if (!(L.container.Find(G.affecting))) L.container += G.affecting if (G.affecting) G.affecting.ret_grab(L, 1) if (!( flag )) if (L.master == src) - var/list/temp = list( ) - temp += L.container - //L = null + var/list/temp = L.container.Copy() qdel(L) return temp else From 3167294ab1e00f861509f2e1965353b8e0cb086c Mon Sep 17 00:00:00 2001 From: Lohikar Date: Wed, 2 Aug 2017 11:54:10 -0500 Subject: [PATCH 3/6] Improved directional lighting fallback when facing opaque objects (#3210) Facing an opaque object with a directional light source will now temporarily change the light to LIGHT_OMNI and halve the range instead of slightly tweaking where the light cone is drawn. --- code/__defines/lighting.dm | 1 + code/modules/lighting/_lighting_defs.dm | 4 +- code/modules/lighting/lighting_source.dm | 40 +++++++++---------- .../modules/lighting/lighting_source_novis.dm | 1 + 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/code/__defines/lighting.dm b/code/__defines/lighting.dm index 68c14f21e52..a24ef9762f5 100644 --- a/code/__defines/lighting.dm +++ b/code/__defines/lighting.dm @@ -10,6 +10,7 @@ #define LIGHTING_TRANSPARENT_ICON_STATE "blank" #define LIGHTING_SOFT_THRESHOLD 0.001 // If the max of the lighting lumcounts of each spectrum drops below this, disable luminosity on the lighting overlays. +#define LIGHTING_BLOCKED_FACTOR 0.5 // How much the range of a directional light will be reduced while facing a wall. // If I were you I'd leave this alone. #define LIGHTING_BASE_MATRIX \ diff --git a/code/modules/lighting/_lighting_defs.dm b/code/modules/lighting/_lighting_defs.dm index 2e1f49e1b81..92dfd46f4e3 100644 --- a/code/modules/lighting/_lighting_defs.dm +++ b/code/modules/lighting/_lighting_defs.dm @@ -1,6 +1,6 @@ // This is the define used to calculate falloff. -#define LUM_FALLOFF(C, T) (1 - CLAMP01(sqrt((C.x - T.x) ** 2 + (C.y - T.y) ** 2 + LIGHTING_HEIGHT) / max(1, light_range))) -#define LUM_FALLOFF_XY(Cx,Cy,Tx,Ty) (1 - CLAMP01(sqrt(((Cx) - (Tx)) ** 2 + ((Cy) - (Ty)) ** 2 + LIGHTING_HEIGHT) / max(1, light_range))) +#define LUM_FALLOFF(C, T) (1 - CLAMP01(sqrt((C.x - T.x) ** 2 + (C.y - T.y) ** 2 + LIGHTING_HEIGHT) / max(1, actual_range))) +#define LUM_FALLOFF_XY(Cx,Cy,Tx,Ty) (1 - CLAMP01(sqrt(((Cx) - (Tx)) ** 2 + ((Cy) - (Ty)) ** 2 + LIGHTING_HEIGHT) / max(1, actual_range))) // Macro that applies light to a new corner. // It is a macro in the interest of speed, yet not having to copy paste it. diff --git a/code/modules/lighting/lighting_source.dm b/code/modules/lighting/lighting_source.dm index e8097a9bda3..2aab0ab9078 100644 --- a/code/modules/lighting/lighting_source.dm +++ b/code/modules/lighting/lighting_source.dm @@ -37,6 +37,7 @@ var/tmp/targ_sign // The sign to test the point against. var/tmp/test_x_offset // How much the X coord should be offset due to direction. var/tmp/test_y_offset // How much the Y coord should be offset due to direction. + var/tmp/facing_opaque = FALSE var/list/datum/lighting_corner/effect_str // List used to store how much we're affecting corners. var/list/turf/affecting_turfs @@ -159,46 +160,41 @@ if (T.x == cached_origin_x && T.y == cached_origin_y && old_direction == top_atom.dir) return - var/do_offset = TRUE - var/turf/front = get_step(T, top_atom.dir) - if (front && front.has_opaque_atom) - do_offset = FALSE - - cached_origin_x = T.x - test_x_offset = cached_origin_x - cached_origin_y = T.y - test_y_offset = cached_origin_y - if (istype(top_atom, /mob) && top_atom:facing_dir) old_direction = top_atom:facing_dir else old_direction = top_atom.dir + var/turf/front = get_step(T, old_direction) + facing_opaque = (front && front.has_opaque_atom) + + cached_origin_x = test_x_offset = T.x + cached_origin_y = test_y_offset = T.y + + if (facing_opaque) + return + var/angle = light_angle / 2 switch (old_direction) if (NORTH) limit_a_t = angle + 90 limit_b_t = -(angle) + 90 - if (do_offset) - test_y_offset += 1 + ++test_y_offset if (SOUTH) limit_a_t = (angle) - 90 limit_b_t = -(angle) - 90 - if (do_offset) - test_y_offset -= 1 + --test_y_offset if (EAST) limit_a_t = angle limit_b_t = -(angle) - if (do_offset) - test_x_offset += 1 + ++test_x_offset if (WEST) limit_a_t = angle + 180 limit_b_t = -(angle) - 180 - if (do_offset) - test_x_offset -= 1 + --test_x_offset // Convert our angle + range into a vector. limit_a_x = POLAR_TO_CART_X(light_range + ARBITRARY_NUMBER, limit_a_t) @@ -255,6 +251,8 @@ REMOVE_CORNER(C,now) effect_str[C] = 0 + var/actual_range = light_range + APPLY_CORNER(C,now) UNSETEMPTY(effect_str) @@ -331,10 +329,12 @@ var/list/Tcorners var/Sx = source_turf.x var/Sy = source_turf.y + var/use_reduced = (light_angle && facing_opaque) + var/actual_range = use_reduced ? light_range * LIGHTING_BLOCKED_FACTOR : light_range - FOR_DVIEW(T, Ceiling(light_range), source_turf, 0) + FOR_DVIEW(T, Ceiling(actual_range), source_turf, 0) check_t: - if (light_angle && check_light_cone(T.x, T.y)) + if (light_angle && !facing_opaque && check_light_cone(T.x, T.y)) continue if (T.dynamic_lighting || T.light_sources) diff --git a/code/modules/lighting/lighting_source_novis.dm b/code/modules/lighting/lighting_source_novis.dm index 3ea79cca630..5a119ce4882 100644 --- a/code/modules/lighting/lighting_source_novis.dm +++ b/code/modules/lighting/lighting_source_novis.dm @@ -64,6 +64,7 @@ var/list/Tcorners var/Sx = source_turf.x var/Sy = source_turf.y + var/actual_range = light_range // novis sources don't support directional lighting. // We don't need no damn vis checks! for (Tthing in RANGE_TURFS(Ceiling(light_range), source_turf)) From 69c4658d7000b5e55295b01ddfe857dba1eb2aea Mon Sep 17 00:00:00 2001 From: Lohikar Date: Wed, 2 Aug 2017 11:55:12 -0500 Subject: [PATCH 4/6] Fix tesla coils (#3208) Fixes tesla coils not properly connecting to the powernet on anchor. --- code/modules/power/tesla/coil.dm | 2 +- html/changelogs/lohikar-coils.yml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 html/changelogs/lohikar-coils.yml diff --git a/code/modules/power/tesla/coil.dm b/code/modules/power/tesla/coil.dm index 4a86d902235..e6bc9ebc046 100644 --- a/code/modules/power/tesla/coil.dm +++ b/code/modules/power/tesla/coil.dm @@ -31,11 +31,11 @@ if(istype(W, /obj/item/weapon/wrench)) playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) user << "You [anchored ? "unfasten" : "fasten"] [src] to the flooring." + anchored = !anchored if(!anchored) disconnect_from_network() else connect_to_network() - anchored = !anchored return default_deconstruction_crowbar(user, W) diff --git a/html/changelogs/lohikar-coils.yml b/html/changelogs/lohikar-coils.yml new file mode 100644 index 00000000000..f0766980256 --- /dev/null +++ b/html/changelogs/lohikar-coils.yml @@ -0,0 +1,4 @@ +author: Lohikar +delete-after: True +changes: + - bugfix: "Tesla coils now actually work without requiring server staff intervention." From 1545ba469ed5b081b72f665d9ab123e6332b2ce0 Mon Sep 17 00:00:00 2001 From: Lohikar Date: Wed, 2 Aug 2017 11:55:53 -0500 Subject: [PATCH 5/6] Orbit Fixes (#3207) changes: Fixed an issue where the segment count argument of orbit() was ignored, leading to the Tesla not animating as it was intended to. Fixed an issue where /datum/event had two completely unrelated definitions (fixes #3192). --- code/_helpers/matrices.dm | 33 ++++++++++++------- code/datums/helper_datums/events.dm | 12 +++---- .../mecha/equipment/tools/medical_tools.dm | 2 +- code/game/mecha/mecha.dm | 2 +- html/changelogs/lohikar-orbits.yml | 4 +++ 5 files changed, 33 insertions(+), 20 deletions(-) create mode 100644 html/changelogs/lohikar-orbits.yml diff --git a/code/_helpers/matrices.dm b/code/_helpers/matrices.dm index abb0366382d..17228a32fe4 100644 --- a/code/_helpers/matrices.dm +++ b/code/_helpers/matrices.dm @@ -3,15 +3,24 @@ Turn(.) //BYOND handles cases such as -270, 360, 540 etc. DOES NOT HANDLE 180 TURNS WELL, THEY TWEEN AND LOOK LIKE SHIT -/atom/proc/SpinAnimation(speed = 10, loops = -1) - var/matrix/m120 = matrix(transform) - m120.Turn(120) - var/matrix/m240 = matrix(transform) - m240.Turn(240) - var/matrix/m360 = matrix(transform) - speed /= 3 //Gives us 3 equal time segments for our three turns. - //Why not one turn? Because byond will see that the start and finish are the same place and do nothing - //Why not two turns? Because byond will do a flip instead of a turn - animate(src, transform = m120, time = speed, loops) - animate(transform = m240, time = speed) - animate(transform = m360, time = speed) +/atom/proc/SpinAnimation(speed = 10, loops = -1, clockwise = 1, segments = 3) + if(!segments) + return + var/segment = 360/segments + if(!clockwise) + segment = -segment + var/list/matrices = list() + for(var/i in 1 to segments-1) + var/matrix/M = matrix(transform) + M.Turn(segment*i) + matrices += M + var/matrix/last = matrix(transform) + matrices += last + + speed /= segments + + animate(src, transform = matrices[1], time = speed, loops) + for(var/i in 2 to segments) //2 because 1 is covered above + animate(transform = matrices[i], time = speed) + //doesn't have an object argument because this is "Stacking" with the animate call above + //3 billion% intentional diff --git a/code/datums/helper_datums/events.dm b/code/datums/helper_datums/events.dm index 10e2f92a234..55569f32b2d 100644 --- a/code/datums/helper_datums/events.dm +++ b/code/datums/helper_datums/events.dm @@ -3,7 +3,7 @@ */ -/datum/events +/datum/mecha_events var/list/events New() @@ -24,7 +24,7 @@ return addEventType(event_type) var/list/event = events[event_type] - var/datum/event/E = new /datum/event(proc_holder,proc_name) + var/datum/mecha_event/E = new /datum/mecha_event(proc_holder,proc_name) event += E return E @@ -35,12 +35,12 @@ var/list/event = listgetindex(events,args[1]) if(istype(event)) spawn(-1) - for(var/datum/event/E in event) + for(var/datum/mecha_event/E in event) if(!E.Fire(arglist(args.Copy(2)))) clearEvent(args[1],E) return - // Arguments: event_type as text, E as /datum/event + // Arguments: event_type as text, E as /datum/mecha_event // Returns: 1 if event cleared, null on error proc/clearEvent(event_type as text, datum/event/E) if(!event_type || !E) @@ -50,7 +50,7 @@ return 1 -/datum/event +/datum/mecha_event var/listener var/proc_name @@ -64,4 +64,4 @@ if(listener) call(listener,proc_name)(arglist(args)) return 1 - return \ No newline at end of file + return diff --git a/code/game/mecha/equipment/tools/medical_tools.dm b/code/game/mecha/equipment/tools/medical_tools.dm index 26e855bd86b..3c0fd8b52ce 100644 --- a/code/game/mecha/equipment/tools/medical_tools.dm +++ b/code/game/mecha/equipment/tools/medical_tools.dm @@ -213,7 +213,7 @@ /obj/item/mecha_parts/mecha_equipment/tool/cable_layer name = "Cable Layer" icon_state = "mecha_wire" - var/datum/event/event + var/datum/mecha_event/event var/turf/old_turf var/obj/structure/cable/last_piece var/obj/item/stack/cable_coil/cable diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 202568480df..cbceabfd014 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -82,7 +82,7 @@ var/list/equipment = new var/obj/item/mecha_parts/mecha_equipment/selected var/max_equip = 3 - var/datum/events/events + var/datum/mecha_events/events var/lastcrash var/crash_cooldown = 30 diff --git a/html/changelogs/lohikar-orbits.yml b/html/changelogs/lohikar-orbits.yml new file mode 100644 index 00000000000..f019fad13b7 --- /dev/null +++ b/html/changelogs/lohikar-orbits.yml @@ -0,0 +1,4 @@ +author: Lohikar +delete-after: True +changes: + - bugfix: "Fixed a bug where orbits (such as the Tesla) didn't animate as they were intended to." From 6870bc31c148085e2bee1805211da7c12cb1c6ee Mon Sep 17 00:00:00 2001 From: skull132 Date: Wed, 2 Aug 2017 23:56:08 +0300 Subject: [PATCH 6/6] Changelogs, 02AUG2017 --- html/changelog.html | 7 +++++++ html/changelogs/.all_changelog.yml | 5 +++++ html/changelogs/lohikar-coils.yml | 4 ---- html/changelogs/lohikar-orbits.yml | 4 ---- 4 files changed, 12 insertions(+), 8 deletions(-) delete mode 100644 html/changelogs/lohikar-coils.yml delete mode 100644 html/changelogs/lohikar-orbits.yml diff --git a/html/changelog.html b/html/changelog.html index 07ad8be2143..b372b21e57b 100644 --- a/html/changelog.html +++ b/html/changelog.html @@ -56,6 +56,13 @@ -->
+

02 August 2017

+

Lohikar updated:

+
    +
  • Tesla coils now actually work without requiring server staff intervention.
  • +
  • Fixed a bug where orbits (such as the Tesla) didn't animate as they were intended to.
  • +
+

31 July 2017

Lohikar updated:

    diff --git a/html/changelogs/.all_changelog.yml b/html/changelogs/.all_changelog.yml index 712b6c3878a..5b9c2711b98 100644 --- a/html/changelogs/.all_changelog.yml +++ b/html/changelogs/.all_changelog.yml @@ -4504,3 +4504,8 @@ DO NOT EDIT THIS FILE BY HAND! AUTOMATICALLY GENERATED BY ss13_genchangelog.py. no longer steal your clothes. NanoTrasen apologises for any inconveniences caused by showing up to your workplace in the nude. - bugfix: Fixed an issue where objects could not be seen in holes in some rare cases. +2017-08-02: + Lohikar: + - bugfix: Tesla coils now actually work without requiring server staff intervention. + - bugfix: Fixed a bug where orbits (such as the Tesla) didn't animate as they were + intended to. diff --git a/html/changelogs/lohikar-coils.yml b/html/changelogs/lohikar-coils.yml deleted file mode 100644 index f0766980256..00000000000 --- a/html/changelogs/lohikar-coils.yml +++ /dev/null @@ -1,4 +0,0 @@ -author: Lohikar -delete-after: True -changes: - - bugfix: "Tesla coils now actually work without requiring server staff intervention." diff --git a/html/changelogs/lohikar-orbits.yml b/html/changelogs/lohikar-orbits.yml deleted file mode 100644 index f019fad13b7..00000000000 --- a/html/changelogs/lohikar-orbits.yml +++ /dev/null @@ -1,4 +0,0 @@ -author: Lohikar -delete-after: True -changes: - - bugfix: "Fixed a bug where orbits (such as the Tesla) didn't animate as they were intended to."