From 642d24e8e1ee52aca479967f3768bde04cdc2f17 Mon Sep 17 00:00:00 2001 From: Jerry Wester Date: Fri, 16 Dec 2022 22:57:32 -0700 Subject: [PATCH] tether module --- code/modules/mod/mod_types.dm | 2 + .../mod/modules/modules_engineering.dm | 59 ++++++++++++++++++- code/modules/projectiles/projectile.dm | 4 +- code/modules/research/designs/mod_designs.dm | 8 +++ .../research/techweb/nodes/mod_nodes.dm | 1 + 5 files changed, 72 insertions(+), 2 deletions(-) diff --git a/code/modules/mod/mod_types.dm b/code/modules/mod/mod_types.dm index 049842d173..565dcdc2f8 100644 --- a/code/modules/mod/mod_types.dm +++ b/code/modules/mod/mod_types.dm @@ -158,6 +158,7 @@ /obj/item/mod/module/welding, /obj/item/mod/module/rad_protection, /obj/item/mod/module/flashlight, + /obj/item/mod/module/tether, ) /obj/item/mod/control/pre_equipped/responsory @@ -248,6 +249,7 @@ /obj/item/mod/module/flashlight, /obj/item/mod/module/bikehorn, /obj/item/mod/module/rad_protection, + /obj/item/mod/module/tether, ) //one of every type of module, for testing if they all work correctly /obj/item/mod/control/pre_equipped/administrative diff --git a/code/modules/mod/modules/modules_engineering.dm b/code/modules/mod/modules/modules_engineering.dm index 2b31d31b40..1d460cfaed 100644 --- a/code/modules/mod/modules/modules_engineering.dm +++ b/code/modules/mod/modules/modules_engineering.dm @@ -81,7 +81,64 @@ complexity = 0 slowdown_active = 0 -// No tether module, sorry! +///Emergency Tether - Shoots a grappling hook projectile in 0g that throws the user towards it. +/obj/item/mod/module/tether + name = "MOD emergency tether module" + desc = "A custom-built grappling-hook powered by a winch capable of hauling the user. \ + While some older models of cargo-oriented grapples have capacities of a few tons, \ + these are only capable of working in zero-gravity environments, a blessing to some Engineers." + icon_state = "tether" + module_type = MODULE_ACTIVE + complexity = 3 + use_power_cost = DEFAULT_CHARGE_DRAIN + incompatible_modules = list(/obj/item/mod/module/tether) + cooldown_time = 1.5 SECONDS + +/obj/item/mod/module/tether/on_use() + if(mod.wearer.has_gravity(get_turf(src))) + balloon_alert(mod.wearer, "too much gravity!") + playsound(src, "gun_dry_fire", 25, TRUE) + return FALSE + return ..() + +/obj/item/mod/module/tether/on_select_use(atom/target) + . = ..() + if(!.) + return + var/obj/item/projectile/tether = new /obj/item/projectile/tether(mod.wearer.loc) + tether.preparePixelProjectile(target, mod.wearer) + tether.firer = mod.wearer + playsound(src, 'sound/weapons/batonextend.ogg', 25, TRUE) + INVOKE_ASYNC(tether, /obj/item/projectile.proc/fire) + drain_power(use_power_cost) + +/obj/item/projectile/tether + name = "tether" + icon_state = "tether_projectile" + icon = 'icons/obj/clothing/modsuit/mod_modules.dmi' + damage = 0 + nodamage = TRUE + range = 10 + hitsound = 'sound/weapons/batonextend.ogg' + hitsound_wall = 'sound/weapons/batonextend.ogg' + suppressed = SUPPRESSED_VERY + hit_threshhold = LATTICE_LAYER + /// Reference to the beam following the projectile. + var/line + +/obj/item/projectile/tether/fire(setAngle) + if(firer) + line = firer.Beam(src, "line", 'icons/obj/clothing/modsuit/mod_modules.dmi') + ..() + +/obj/item/projectile/tether/on_hit(atom/target) + . = ..() + if(firer) + firer.throw_at(target, 10, 1, firer, FALSE, FALSE, null, MOVE_FORCE_NORMAL, TRUE) + +/obj/item/projectile/tether/Destroy() + QDEL_NULL(line) + return ..() ///Radiation Protection - Protects the user from radiation, gives them a geiger counter and rad info in the panel. /obj/item/mod/module/rad_protection diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 6c6733627f..0aee51bb84 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -69,6 +69,8 @@ var/projectile_piercing = NONE /// number of times we've pierced something. Incremented BEFORE bullet_act and on_hit proc! var/pierces = 0 + /// If objects are below this layer, we pass through them + var/hit_threshhold = PROJECTILE_HIT_THRESHHOLD_LAYER /// "leftover" pixels for Range() calculation as pixel_move() was moved to simulated semi-pixel movement and Range() is in tiles. var/pixels_range_leftover = 0 /// "leftover" tick pixels and stuff yeah, so we don't round off things and introducing tracing inaccuracy. @@ -519,7 +521,7 @@ if(!isliving(target)) if(isturf(target)) // non dense turfs return FALSE - if(target.layer < PROJECTILE_HIT_THRESHHOLD_LAYER) + if(target.layer < hit_threshhold) return FALSE else if(!direct_target) // non dense objects do not get hit unless specifically clicked return FALSE diff --git a/code/modules/research/designs/mod_designs.dm b/code/modules/research/designs/mod_designs.dm index 4a8110dc1e..289a9d007b 100644 --- a/code/modules/research/designs/mod_designs.dm +++ b/code/modules/research/designs/mod_designs.dm @@ -241,6 +241,14 @@ build_type = PROTOLATHE departmental_flags = DEPARTMENTAL_FLAG_SECURITY +/datum/design/module/mod_tether + name = "Emergency Tether Module" + id = "mod_tether" + materials = list(/datum/material/iron = 1000, /datum/material/silver = 500) + build_path = /obj/item/mod/module/tether + build_type = PROTOLATHE + departmental_flags = DEPARTMENTAL_FLAG_ENGINEERING + /datum/design/module/mod_mouthhole name = "Eating Apparatus Module" id = "mod_mouthhole" diff --git a/code/modules/research/techweb/nodes/mod_nodes.dm b/code/modules/research/techweb/nodes/mod_nodes.dm index 3757c41683..7505e1610c 100644 --- a/code/modules/research/techweb/nodes/mod_nodes.dm +++ b/code/modules/research/techweb/nodes/mod_nodes.dm @@ -44,6 +44,7 @@ "mod_visor_meson", "mod_t_ray", "mod_magboot", + "mod_tether", "mod_constructor", "mod_mister_atmos", )