From c5f0ea76e0fa1d1236fe04a2edaf6d9c047fc7c8 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Fri, 22 Apr 2022 01:03:19 +0200 Subject: [PATCH] [MIRROR] Vim mecha changes [MDB IGNORE] (#12981) * Vim mecha changes (#66153) This PR changes the following: fixes a bug with Vim overlays, making it always appear as if there was a pilot inside, even after leaving it adds a balloon alert when a mob fails to enter the mech due to its size adds a crafting recipe for Vim in the "robots" category allows using Vim as a circuit shell allows small mobs to use the mech as well My reasoning behind the changes: fixing the overlay bug - bugfixes good, bugs bad balloon alert - it should help reduce confusion among players who can't figure why on earth they cannot enter the mech crafting recipe - I think a crafting recipe will make it a lot more accessible to players, especially because there is no way to learn about its existence in-game circuit shell - non-standard circuit shells can be pretty fun and people seemed to enjoy the ability to use circuits inside their piano synths or cameras, so I figured we could expand on this, while giving players more ways to interact with sentient pets maximum mob size increase - Vim has never really been built too often, most likely because even if people got their hands on a sentient pet, it wouldn't probably fit in the tiny mecha anyway. Currently pretty much only butterflies, rats and cockroaches can use Vim and they pretty much never become sentient. * Vim mecha changes Co-authored-by: B4CKU <50628162+B4CKU@users.noreply.github.com> --- code/__DEFINES/dcs/signals/signals_object.dm | 9 ++++ code/datums/components/crafting/recipes.dm | 12 +++++ code/modules/vehicles/cars/vim.dm | 57 +++++++++++++++++++- code/modules/vehicles/vehicle_actions.dm | 15 +++++- 4 files changed, 91 insertions(+), 2 deletions(-) diff --git a/code/__DEFINES/dcs/signals/signals_object.dm b/code/__DEFINES/dcs/signals/signals_object.dm index 300ff4f16b5..fb6fb43857c 100644 --- a/code/__DEFINES/dcs/signals/signals_object.dm +++ b/code/__DEFINES/dcs/signals/signals_object.dm @@ -338,6 +338,15 @@ ///sent to targets during the process_hit proc of projectiles #define COMSIG_PELLET_CLOUD_INIT "pellet_cloud_init" +// /obj/vehicle/sealed/car/vim signals + +///from /datum/action/vehicle/sealed/noise/chime/Trigger(): () +#define COMSIG_VIM_CHIME_USED "vim_chime_used" +///from /datum/action/vehicle/sealed/noise/buzz/Trigger(): () +#define COMSIG_VIM_BUZZ_USED "vim_buzz_used" +///from /datum/action/vehicle/sealed/headlights/vim/Trigger(): (headlights_on) +#define COMSIG_VIM_HEADLIGHTS_TOGGLED "vim_headlights_toggled" + // /obj/vehicle/sealed/mecha signals ///sent from mecha action buttons to the mecha they're linked to diff --git a/code/datums/components/crafting/recipes.dm b/code/datums/components/crafting/recipes.dm index b3634f9ee53..dff26d22f71 100644 --- a/code/datums/components/crafting/recipes.dm +++ b/code/datums/components/crafting/recipes.dm @@ -444,6 +444,18 @@ time = 40 category = CAT_ROBOT +/datum/crafting_recipe/vim + name = "Vim" + result = /obj/vehicle/sealed/car/vim + reqs = list(/obj/item/clothing/head/helmet/space/eva = 1, + /obj/item/bodypart/l_leg/robot = 1, + /obj/item/bodypart/r_leg/robot = 1, + /obj/item/flashlight = 1, + /obj/item/assembly/voice = 1) + tool_behaviors = list(TOOL_SCREWDRIVER) + time = 6 SECONDS //Has a four second do_after when building manually + category = CAT_ROBOT + /datum/crafting_recipe/improvised_pneumatic_cannon //Pretty easy to obtain but name = "Pneumatic Cannon" result = /obj/item/pneumatic_cannon/ghetto diff --git a/code/modules/vehicles/cars/vim.dm b/code/modules/vehicles/cars/vim.dm index fec1678eeed..041d463b4e8 100644 --- a/code/modules/vehicles/cars/vim.dm +++ b/code/modules/vehicles/cars/vim.dm @@ -20,8 +20,18 @@ engine_sound = 'sound/effects/servostep.ogg' ///TRUE while the vim is being welded var/being_repaired = FALSE + ///Maximum size of a mob trying to enter the mech + var/maximum_mob_size = MOB_SIZE_SMALL COOLDOWN_DECLARE(sound_cooldown) +/obj/vehicle/sealed/car/vim/Initialize(mapload) + . = ..() + AddComponent( \ + /datum/component/shell, \ + unremovable_circuit_components = list(new /obj/item/circuit_component/vim), \ + capacity = SHELL_CAPACITY_SMALL, \ + ) + /obj/vehicle/sealed/car/vim/examine(mob/user) . = ..() . += span_notice("[src] can be repaired with a welder.") @@ -36,7 +46,8 @@ if(!isanimal_or_basicmob(entering)) return FALSE var/mob/living/animal_or_basic = entering - if(animal_or_basic.mob_size != MOB_SIZE_TINY) + if(animal_or_basic.mob_size > maximum_mob_size) + entering.balloon_alert(entering, "can't fit inside!") return FALSE return ..() @@ -71,6 +82,10 @@ if(atom_integrity == max_integrity) SEND_SOUND(newoccupant, sound('sound/mecha/nominal.ogg',volume=50)) +/obj/vehicle/sealed/car/vim/mob_try_exit(mob/pilot, mob/user, silent = FALSE, randomstep = FALSE) + . = ..() + update_appearance() + /obj/vehicle/sealed/car/vim/generate_actions() initialize_controller_action_type(/datum/action/vehicle/sealed/climb_out/vim, VEHICLE_CONTROL_DRIVE) initialize_controller_action_type(/datum/action/vehicle/sealed/noise/chime, VEHICLE_CONTROL_DRIVE) @@ -90,3 +105,43 @@ . += piloted_overlay if(headlights_toggle) . += headlights_overlay + +/obj/item/circuit_component/vim + display_name = "Vim" + desc = "An minature exosuit from Nanotrasen, developed to let the irreplacable station pets live a little longer." + + /// Sent when the mech chimes. + var/datum/port/output/chime + /// Sent when the mech buzzes. + var/datum/port/output/buzz + /// Whether the mech headlights are currently on. + var/datum/port/output/are_headlights_on + +/obj/item/circuit_component/vim/populate_ports() + are_headlights_on = add_output_port("Are Headlights On", PORT_TYPE_NUMBER) + chime = add_output_port("On Chime Used", PORT_TYPE_SIGNAL) + buzz = add_output_port("On Buzz Used", PORT_TYPE_SIGNAL) + +/obj/item/circuit_component/vim/register_shell(atom/movable/shell) + . = ..() + RegisterSignal(shell, COMSIG_VIM_HEADLIGHTS_TOGGLED, .proc/on_headlights_toggle) + RegisterSignal(shell, COMSIG_VIM_CHIME_USED, .proc/on_chime_used) + RegisterSignal(shell, COMSIG_VIM_BUZZ_USED, .proc/on_buzz_used) + +/obj/item/circuit_component/vim/unregister_shell(atom/movable/shell) + . = ..() + UnregisterSignal(shell, COMSIG_VIM_HEADLIGHTS_TOGGLED) + UnregisterSignal(shell, COMSIG_VIM_CHIME_USED) + UnregisterSignal(shell, COMSIG_VIM_BUZZ_USED) + +/obj/item/circuit_component/vim/proc/on_headlights_toggle(datum/source, headlights_on) + SIGNAL_HANDLER + are_headlights_on.set_output(headlights_on) + +/obj/item/circuit_component/vim/proc/on_chime_used() + SIGNAL_HANDLER + chime.set_output(COMPONENT_SIGNAL) + +/obj/item/circuit_component/vim/proc/on_buzz_used() + SIGNAL_HANDLER + buzz.set_output(COMPONENT_SIGNAL) diff --git a/code/modules/vehicles/vehicle_actions.dm b/code/modules/vehicles/vehicle_actions.dm index b1856ddac6e..f2ec9cd44f5 100644 --- a/code/modules/vehicles/vehicle_actions.dm +++ b/code/modules/vehicles/vehicle_actions.dm @@ -341,10 +341,11 @@ var/obj/vehicle/sealed/car/vim/vim_mecha = vehicle_entered_target if(!COOLDOWN_FINISHED(vim_mecha, sound_cooldown)) vim_mecha.balloon_alert(owner, "on cooldown!") - return + return FALSE COOLDOWN_START(vim_mecha, sound_cooldown, VIM_SOUND_COOLDOWN) vehicle_entered_target.visible_message(span_notice("[vehicle_entered_target] [sound_message]")) playsound(vim_mecha, sound_path, 75) + return TRUE /datum/action/vehicle/sealed/noise/chime name = "Chime!" @@ -353,6 +354,10 @@ sound_path = 'sound/machines/chime.ogg' sound_message = "chimes!" +/datum/action/vehicle/sealed/noise/chime/Trigger(trigger_flags) + if(..()) + SEND_SIGNAL(vehicle_entered_target, COMSIG_VIM_CHIME_USED) + /datum/action/vehicle/sealed/noise/buzz name = "Buzz." desc = "Negative!" @@ -360,5 +365,13 @@ sound_path = 'sound/machines/buzz-sigh.ogg' sound_message = "buzzes." +/datum/action/vehicle/sealed/noise/buzz/Trigger(trigger_flags) + if(..()) + SEND_SIGNAL(vehicle_entered_target, COMSIG_VIM_BUZZ_USED) + /datum/action/vehicle/sealed/headlights/vim button_icon_state = "vim_headlights" + +/datum/action/vehicle/sealed/headlights/vim/Trigger(trigger_flags) + . = ..() + SEND_SIGNAL(vehicle_entered_target, COMSIG_VIM_HEADLIGHTS_TOGGLED, vehicle_entered_target.headlights_toggle)