From d0ff76bed9a17ca2fb315f751b01fd543572be17 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Fri, 3 Nov 2023 05:09:40 +0100 Subject: [PATCH] [MIRROR] Removes virtual-specific subtypes of drinking glass + adds a new fishing map [MDB IGNORE] (#24759) * Removes virtual-specific subtypes of drinking glass + adds a new fishing map (#79423) ## About The Pull Request Changed how loot signals work with bitrunning entirely, which allows map creators to attach functionality to objects without creating subtypes of the item As a bonus I added a fishing minigame map which uses it ## Why It's Good For The Game It's a messy solution to need to create subtypes just for the one-off map that needs them ## Changelog :cl: add: Added a new fishing map to bitrunning. add: You are no longer limited to pina coladas on the beach bar domain. Cheers! /:cl: * Removes virtual-specific subtypes of drinking glass + adds a new fishing map --------- Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com> --- _maps/virtual_domains/beach_bar.dmm | 33 +- _maps/virtual_domains/breeze_bay.dmm | 836 ++++++++++++++++++ .../components/bitrunning_points.dm | 67 +- .../modules/bitrunning/server/map_handling.dm | 7 +- .../bitrunning/server/signal_handlers.dm | 3 + .../virtual_domain/domains/beach_bar.dm | 19 +- .../virtual_domain/domains/breeze_bay.dm | 22 + .../virtual_domain/virtual_domain.dm | 8 + tgstation.dme | 1 + 9 files changed, 932 insertions(+), 64 deletions(-) create mode 100644 _maps/virtual_domains/breeze_bay.dmm create mode 100644 code/modules/bitrunning/virtual_domain/domains/breeze_bay.dm diff --git a/_maps/virtual_domains/beach_bar.dmm b/_maps/virtual_domains/beach_bar.dmm index 29fe04d8283..08c7008ae8a 100644 --- a/_maps/virtual_domains/beach_bar.dmm +++ b/_maps/virtual_domains/beach_bar.dmm @@ -159,9 +159,9 @@ pixel_x = -8; pixel_y = -1 }, -/obj/item/reagent_containers/cup/glass/drinkingglass/filled/virtual_domain{ - pixel_y = 8; - pixel_x = 5 +/obj/item/reagent_containers/cup/glass/drinkingglass/filled/pina_colada{ + pixel_y = 5; + pixel_x = 6 }, /turf/open/floor/wood, /area/virtual_domain/powered) @@ -300,6 +300,9 @@ /obj/item/food/meat/slab/rawcrab, /turf/open/floor/wood, /area/virtual_domain/powered) +"no" = ( +/turf/open/misc/asteroid/basalt/lava_land_surface, +/area/virtual_domain/powered) "nP" = ( /obj/item/stack/sheet/iron/fifty, /obj/effect/mapping_helpers/burnt_floor, @@ -424,10 +427,10 @@ /area/virtual_domain/powered) "uq" = ( /obj/structure/table/wood, -/obj/item/reagent_containers/cup/glass/drinkingglass/filled/virtual_domain, -/obj/item/reagent_containers/cup/glass/drinkingglass/filled/virtual_domain{ - pixel_x = -4; - pixel_y = 8 +/obj/item/reagent_containers/cup/glass/drinkingglass/filled/pina_colada, +/obj/item/reagent_containers/cup/glass/drinkingglass/filled/pina_colada{ + pixel_x = -5; + pixel_y = 5 }, /turf/open/floor/wood, /area/virtual_domain/powered) @@ -878,11 +881,11 @@ /area/virtual_domain/powered) "Mp" = ( /obj/structure/table/wood, -/obj/item/reagent_containers/cup/glass/drinkingglass/filled/virtual_domain{ - pixel_y = 7; - pixel_x = 4 +/obj/item/reagent_containers/cup/glass/drinkingglass/filled/pina_colada{ + pixel_x = 5; + pixel_y = 5 }, -/obj/item/reagent_containers/cup/glass/drinkingglass/filled/virtual_domain, +/obj/item/reagent_containers/cup/glass/drinkingglass/filled/pina_colada, /turf/open/floor/wood, /area/virtual_domain/powered) "Mw" = ( @@ -2116,7 +2119,7 @@ iz (23,1,1) = {" iz Al -xb +no Fn Cb wD @@ -2159,7 +2162,7 @@ xW (24,1,1) = {" iz Al -xb +no Fn wD Gz @@ -2202,7 +2205,7 @@ xW (25,1,1) = {" iz Al -xb +no Fn OK Gz @@ -2245,7 +2248,7 @@ xW (26,1,1) = {" iz Al -xb +no Fn Sg wD diff --git a/_maps/virtual_domains/breeze_bay.dmm b/_maps/virtual_domains/breeze_bay.dmm new file mode 100644 index 00000000000..6fe6f49ab3a --- /dev/null +++ b/_maps/virtual_domains/breeze_bay.dmm @@ -0,0 +1,836 @@ +//MAP CONVERTED BY dmm2tgm.py THIS HEADER COMMENT PREVENTS RECONVERSION, DO NOT REMOVE +"a" = ( +/turf/closed/indestructible/binary, +/area/virtual_domain/powered) +"c" = ( +/obj/structure/flora/coconuts, +/turf/open/misc/beach/sand, +/area/virtual_domain/powered) +"d" = ( +/obj/structure/chair/wood, +/turf/open/floor/wood/large, +/area/virtual_domain/powered) +"e" = ( +/turf/open/floor/carpet/red, +/area/virtual_domain/powered) +"g" = ( +/obj/item/toy/beach_ball/branded, +/turf/open/misc/beach/sand, +/area/virtual_domain/powered) +"i" = ( +/turf/open/water/beach, +/area/virtual_domain/powered) +"k" = ( +/obj/effect/landmark/bitrunning/loot_signal, +/turf/open/misc/beach/sand, +/area/virtual_domain/powered) +"m" = ( +/obj/item/fishing_rod{ + pixel_x = 5; + pixel_y = -5 + }, +/obj/item/fishing_rod, +/obj/item/fishing_rod{ + pixel_y = 5; + pixel_x = -5 + }, +/obj/structure/table/wood, +/turf/open/misc/beach/sand, +/area/virtual_domain/powered) +"o" = ( +/obj/structure/flora/tree/jungle/style_5, +/turf/open/misc/beach/sand, +/area/virtual_domain/powered) +"p" = ( +/turf/open/floor/carpet/blue, +/area/virtual_domain/powered) +"s" = ( +/obj/structure/fluff/beach_umbrella/cap, +/turf/open/misc/beach/sand, +/area/virtual_domain/powered) +"t" = ( +/obj/structure/fluff/beach_umbrella/syndi, +/turf/open/misc/beach/sand, +/area/virtual_domain/powered) +"v" = ( +/obj/effect/baseturf_helper/virtual_domain, +/obj/effect/landmark/bitrunning/safehouse_spawn, +/turf/template_noop, +/area/virtual_domain/safehouse) +"y" = ( +/obj/structure/flora/bush/sparsegrass/style_random, +/turf/open/misc/beach/sand, +/area/virtual_domain/powered) +"z" = ( +/mob/living/basic/crab, +/turf/open/misc/beach/sand, +/area/virtual_domain/powered) +"B" = ( +/obj/structure/flora/tree/jungle/style_6, +/turf/open/misc/beach/sand, +/area/virtual_domain/powered) +"C" = ( +/obj/structure/flora/tree/jungle/style_2, +/turf/open/misc/beach/sand, +/area/virtual_domain/powered) +"D" = ( +/turf/open/floor/carpet/green, +/area/virtual_domain/powered) +"F" = ( +/obj/structure/fluff/beach_umbrella/engine, +/turf/open/misc/beach/sand, +/area/virtual_domain/powered) +"G" = ( +/obj/structure/flora/bush/jungle/a/style_random, +/turf/open/misc/beach/sand, +/area/virtual_domain/powered) +"H" = ( +/obj/structure/flora/tree/jungle/style_4, +/turf/open/misc/beach/sand, +/area/virtual_domain/powered) +"I" = ( +/turf/template_noop, +/area/virtual_domain/safehouse) +"J" = ( +/turf/open/misc/beach/sand, +/area/virtual_domain/powered) +"K" = ( +/obj/structure/flora/tree/jungle, +/turf/open/misc/beach/sand, +/area/virtual_domain/powered) +"L" = ( +/obj/item/fishing_line, +/obj/item/fishing_hook, +/obj/item/fishing_hook, +/obj/item/fishing_hook, +/obj/structure/closet/crate, +/obj/item/bait_can/worm, +/turf/open/misc/beach/sand, +/area/virtual_domain/powered) +"O" = ( +/obj/structure/flora/rock/style_random, +/turf/open/misc/beach/sand, +/area/virtual_domain/powered) +"P" = ( +/turf/open/misc/beach/coast, +/area/virtual_domain/powered) +"Q" = ( +/obj/structure/flora/bush/stalky/style_random, +/turf/open/water/beach, +/area/virtual_domain/powered) +"R" = ( +/obj/structure/closet/crate/freezer{ + name = "Cooler" + }, +/obj/item/reagent_containers/cup/glass/ice, +/obj/item/reagent_containers/cup/glass/colocup, +/obj/item/reagent_containers/cup/glass/colocup, +/obj/item/reagent_containers/cup/glass/bottle/beer{ + desc = "Beer advertised to be the best in space."; + name = "Masterbrand Beer" + }, +/obj/item/reagent_containers/cup/glass/bottle/beer{ + desc = "Beer advertised to be the best in space."; + name = "Masterbrand Beer" + }, +/obj/item/reagent_containers/cup/glass/bottle/beer{ + desc = "Beer advertised to be the best in space."; + name = "Masterbrand Beer" + }, +/obj/item/reagent_containers/cup/glass/bottle/beer/light, +/obj/item/reagent_containers/cup/glass/bottle/beer/light, +/obj/item/reagent_containers/cup/glass/bottle/beer/light, +/obj/item/clothing/head/soft/fishing_hat, +/turf/open/misc/beach/sand, +/area/virtual_domain/powered) +"S" = ( +/obj/structure/flora/tree/jungle/style_3, +/turf/open/misc/beach/sand, +/area/virtual_domain/powered) +"U" = ( +/obj/structure/flora/tree/palm/style_random, +/turf/open/misc/beach/sand, +/area/virtual_domain/powered) +"X" = ( +/turf/open/floor/wood/large, +/area/virtual_domain/powered) +"Z" = ( +/obj/effect/baseturf_helper/virtual_domain, +/turf/closed/indestructible/binary, +/area/virtual_domain/powered) + +(1,1,1) = {" +a +a +a +a +a +a +a +a +a +a +a +a +a +a +a +a +a +a +a +a +a +a +a +a +Z +"} +(2,1,1) = {" +a +K +G +y +J +J +J +J +J +J +J +z +P +i +i +i +i +i +i +i +Q +i +i +i +a +"} +(3,1,1) = {" +a +J +O +J +J +I +I +I +I +I +v +J +P +Q +i +i +i +i +i +i +i +i +i +i +a +"} +(4,1,1) = {" +a +J +C +J +J +I +I +I +I +I +I +J +P +i +i +i +i +i +i +i +i +i +i +i +a +"} +(5,1,1) = {" +a +J +y +J +J +I +I +I +I +I +I +J +P +i +i +i +i +i +i +i +i +i +i +i +a +"} +(6,1,1) = {" +a +S +J +J +J +I +I +I +I +I +I +y +P +i +i +i +i +i +i +i +i +i +i +i +a +"} +(7,1,1) = {" +a +G +G +J +J +I +I +I +I +I +I +J +P +i +i +i +i +i +i +i +i +i +i +i +a +"} +(8,1,1) = {" +a +J +H +g +J +I +I +I +I +I +I +J +P +i +i +i +i +i +i +i +i +i +i +i +a +"} +(9,1,1) = {" +a +G +y +J +J +I +I +I +I +I +I +J +P +i +i +i +i +i +i +i +i +i +i +i +a +"} +(10,1,1) = {" +a +o +J +J +J +J +J +J +J +J +J +J +P +i +i +i +i +i +i +i +i +i +i +i +a +"} +(11,1,1) = {" +a +J +J +J +J +J +J +J +J +J +J +J +P +i +i +i +i +i +i +i +i +i +i +i +a +"} +(12,1,1) = {" +a +J +B +y +J +J +J +U +c +J +J +J +P +i +i +i +i +i +i +i +i +i +i +i +a +"} +(13,1,1) = {" +a +J +J +J +J +s +J +J +J +J +k +J +P +i +i +i +i +i +i +i +i +i +i +i +a +"} +(14,1,1) = {" +a +K +y +J +J +p +p +J +J +J +m +J +P +i +i +i +i +i +i +i +i +i +i +i +a +"} +(15,1,1) = {" +a +J +J +J +J +t +J +J +J +J +L +J +P +i +i +i +i +i +i +i +i +i +i +i +a +"} +(16,1,1) = {" +a +J +C +J +J +e +e +J +J +J +J +J +P +i +i +i +i +X +X +i +i +i +i +i +a +"} +(17,1,1) = {" +a +G +J +J +J +F +J +J +J +J +J +J +P +i +i +i +i +X +X +i +i +i +i +i +a +"} +(18,1,1) = {" +a +S +G +J +J +D +D +J +J +J +J +J +X +X +X +X +X +X +X +X +X +X +i +i +a +"} +(19,1,1) = {" +a +J +J +J +J +R +J +J +J +J +J +J +X +X +X +X +X +X +X +X +d +X +i +i +a +"} +(20,1,1) = {" +a +J +H +J +J +J +J +J +J +J +J +J +P +i +i +i +i +i +i +i +i +i +i +i +a +"} +(21,1,1) = {" +a +J +O +J +J +J +J +J +J +c +J +J +P +i +i +i +i +i +i +i +i +i +i +i +a +"} +(22,1,1) = {" +a +o +J +y +J +J +J +J +J +U +J +J +P +i +i +i +i +i +i +i +i +i +i +i +a +"} +(23,1,1) = {" +a +J +G +J +J +J +J +J +J +y +J +J +P +i +i +i +i +i +i +i +i +i +Q +i +a +"} +(24,1,1) = {" +a +J +B +J +z +J +y +J +J +J +J +J +P +i +Q +i +i +i +i +i +i +i +i +i +a +"} +(25,1,1) = {" +a +a +a +a +a +a +a +a +a +a +a +a +a +a +a +a +a +a +a +a +a +a +a +a +a +"} diff --git a/code/modules/bitrunning/components/bitrunning_points.dm b/code/modules/bitrunning/components/bitrunning_points.dm index 58dda4a68ff..328a70679e6 100644 --- a/code/modules/bitrunning/components/bitrunning_points.dm +++ b/code/modules/bitrunning/components/bitrunning_points.dm @@ -1,46 +1,37 @@ -/// Attaches a component which listens for a given signal from the item. -/// -/// When the signal is received, it will add points to the signaler. +/// Attaches to a turf so it spawns a crate when a certain amount of points are added to it. /datum/component/bitrunning_points - /// The range at which we can find the signaler - var/max_point_range - /// Weakref to the loot crate landmark - where we send points - var/datum/weakref/our_spawner - /// The amount of points per each signal - var/points_per_signal - /// The signal we listen for - var/signal_type + /// The amount required to spawn a crate + var/points_goal = 10 + /// A special condition limits this from spawning a crate + var/points_received = 0 -/datum/component/bitrunning_points/Initialize(signal_type, points_per_signal = 1, max_point_range = 4) - src.max_point_range = max_point_range - src.points_per_signal = points_per_signal - src.signal_type = signal_type +/datum/component/bitrunning_points/Initialize(datum/lazy_template/virtual_domain/domain) + . = ..() + if(!isturf(parent)) + return COMPONENT_INCOMPATIBLE - locate_spawner() + RegisterSignal(domain, COMSIG_BITRUNNER_GOAL_POINT, PROC_REF(on_add_points)) -/datum/component/bitrunning_points/RegisterWithParent() - RegisterSignal(parent, signal_type, PROC_REF(on_event)) - -/datum/component/bitrunning_points/UnregisterFromParent() - UnregisterSignal(parent, signal_type) - -/// Finds the signaler if it hasn't been found yet. -/datum/component/bitrunning_points/proc/locate_spawner() - var/obj/effect/landmark/bitrunning/loot_signal/spawner = our_spawner?.resolve() - if(spawner) - return spawner - - for(var/obj/effect/landmark/bitrunning/loot_signal/found in GLOB.landmarks_list) - if(IN_GIVEN_RANGE(get_turf(parent), found, max_point_range)) - our_spawner = WEAKREF(found) - return found - -/// Once the specified signal is received, whisper to the spawner to add points. -/datum/component/bitrunning_points/proc/on_event(datum/source) +/// Listens for points to be added which will eventually spawn a crate. +/datum/component/bitrunning_points/proc/on_add_points(datum/source, points_to_add) SIGNAL_HANDLER - var/obj/effect/landmark/bitrunning/loot_signal/spawner = locate_spawner() - if(isnull(spawner)) + points_received += points_to_add + + if(points_received < points_goal) return - SEND_SIGNAL(spawner, COMSIG_BITRUNNER_GOAL_POINT, points_per_signal) + reveal() + +/// Spawns the crate with some effects +/datum/component/bitrunning_points/proc/reveal() + playsound(src, 'sound/magic/blink.ogg', 50, TRUE) + + var/turf/tile = parent + new /obj/structure/closet/crate/secure/bitrunning/encrypted(tile) + + var/datum/effect_system/spark_spread/quantum/sparks = new(tile) + sparks.set_up(number = 5, location = tile) + sparks.start() + + qdel(src) diff --git a/code/modules/bitrunning/server/map_handling.dm b/code/modules/bitrunning/server/map_handling.dm index 14332c9d1ee..061a60b858b 100644 --- a/code/modules/bitrunning/server/map_handling.dm +++ b/code/modules/bitrunning/server/map_handling.dm @@ -91,7 +91,7 @@ var/turf/goal_turfs = list() var/turf/crate_turfs = list() - for(var/thing in GLOB.landmarks_list) + for(var/obj/effect/landmark/bitrunning/thing in GLOB.landmarks_list) if(istype(thing, /obj/effect/landmark/bitrunning/hololadder_spawn)) exit_turfs += get_turf(thing) qdel(thing) // i'm worried about multiple servers getting confused so lets clean em up @@ -110,6 +110,11 @@ qdel(thing) continue + if(istype(thing, /obj/effect/landmark/bitrunning/loot_signal)) + var/turf/signaler_turf = get_turf(thing) + signaler_turf.AddComponent(/datum/component/bitrunning_points, generated_domain) + qdel(thing) + if(!length(exit_turfs)) CRASH("Failed to find exit turfs on generated domain.") if(!length(goal_turfs)) diff --git a/code/modules/bitrunning/server/signal_handlers.dm b/code/modules/bitrunning/server/signal_handlers.dm index 24f26ea3988..c41c0b529fc 100644 --- a/code/modules/bitrunning/server/signal_handlers.dm +++ b/code/modules/bitrunning/server/signal_handlers.dm @@ -87,6 +87,9 @@ UnregisterSignal(source, COMSIG_LAZY_TEMPLATE_LOADED) + /// Just in case there's any special handling for the domain + generated_domain.setup_domain(created_atoms) + /// Handles when cybercops are summoned into the area or ghosts click a ghost role spawner /obj/machinery/quantum_server/proc/on_threat_created(datum/source, mob/living/threat) SIGNAL_HANDLER diff --git a/code/modules/bitrunning/virtual_domain/domains/beach_bar.dm b/code/modules/bitrunning/virtual_domain/domains/beach_bar.dm index a6fb3e921e0..f632b0681bf 100644 --- a/code/modules/bitrunning/virtual_domain/domains/beach_bar.dm +++ b/code/modules/bitrunning/virtual_domain/domains/beach_bar.dm @@ -8,15 +8,14 @@ map_name = "beach_bar" safehouse_path = /datum/map_template/safehouse/mine -/obj/item/reagent_containers/cup/glass/drinkingglass/filled/virtual_domain - name = "pina colada" - desc = "Whose drink is this? Not yours, that's for sure. Well, it's not like they're going to miss it." - list_reagents = list(/datum/reagent/consumable/ethanol/pina_colada = 30) - -/obj/item/reagent_containers/cup/glass/drinkingglass/filled/virtual_domain/Initialize(mapload, vol) +/datum/lazy_template/virtual_domain/beach_bar/setup_domain(list/created_atoms) . = ..() - AddComponent(/datum/component/bitrunning_points, \ - signal_type = COMSIG_GLASS_DRANK, \ - points_per_signal = 0.5, \ - ) + for(var/obj/item/reagent_containers/cup/glass/drink in created_atoms) + RegisterSignal(drink, COMSIG_GLASS_DRANK, PROC_REF(on_drink_drank)) + +/// Eventually reveal the cache +/datum/lazy_template/virtual_domain/beach_bar/proc/on_drink_drank(datum/source) + SIGNAL_HANDLER + + add_points(0.5) diff --git a/code/modules/bitrunning/virtual_domain/domains/breeze_bay.dm b/code/modules/bitrunning/virtual_domain/domains/breeze_bay.dm new file mode 100644 index 00000000000..62fd3117a94 --- /dev/null +++ b/code/modules/bitrunning/virtual_domain/domains/breeze_bay.dm @@ -0,0 +1,22 @@ +/datum/lazy_template/virtual_domain/breeze_bay + name = "Breeze Bay" + desc = "A beach front town with a large forest to the north." + help_text = "It's simple! Enjoy some rays, catch some fish, and have a good time! Don't get bit by the crabs, though." + key = "breeze_bay" + map_name = "breeze_bay" + safehouse_path = /datum/map_template/safehouse/wood + +/datum/lazy_template/virtual_domain/breeze_bay/setup_domain(list/created_atoms) + . = ..() + + for(var/obj/item/fishing_rod/rod in created_atoms) + RegisterSignal(rod, COMSIG_FISHING_ROD_CAUGHT_FISH, PROC_REF(on_fish_caught)) + +/// Eventually reveal the cache +/datum/lazy_template/virtual_domain/breeze_bay/proc/on_fish_caught(datum/source, reward) + SIGNAL_HANDLER + + if(isnull(reward)) + return + + add_points(2) diff --git a/code/modules/bitrunning/virtual_domain/virtual_domain.dm b/code/modules/bitrunning/virtual_domain/virtual_domain.dm index 202376a2c33..5e6cb0f2582 100644 --- a/code/modules/bitrunning/virtual_domain/virtual_domain.dm +++ b/code/modules/bitrunning/virtual_domain/virtual_domain.dm @@ -36,3 +36,11 @@ var/test_only = FALSE /// The safehouse to load into the map var/datum/map_template/safehouse/safehouse_path = /datum/map_template/safehouse/den + +/// Sends a point to any loot signals on the map +/datum/lazy_template/virtual_domain/proc/add_points(points_to_add) + SEND_SIGNAL(src, COMSIG_BITRUNNER_GOAL_POINT, points_to_add) + +/// Overridable proc to be called after the map is loaded. +/datum/lazy_template/virtual_domain/proc/setup_domain(list/created_atoms) + return diff --git a/tgstation.dme b/tgstation.dme index 43914db8489..a45c9c24b42 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -3409,6 +3409,7 @@ #include "code\modules\bitrunning\virtual_domain\domains\ash_drake.dm" #include "code\modules\bitrunning\virtual_domain\domains\beach_bar.dm" #include "code\modules\bitrunning\virtual_domain\domains\blood_drunk_miner.dm" +#include "code\modules\bitrunning\virtual_domain\domains\breeze_bay.dm" #include "code\modules\bitrunning\virtual_domain\domains\bubblegum.dm" #include "code\modules\bitrunning\virtual_domain\domains\clown_planet.dm" #include "code\modules\bitrunning\virtual_domain\domains\colossus.dm"