[MOSTLY MODULAR] Borg inducers take two (#9504)

* Upgrade module

* mechfab design

* techweb

* the guts of the pr

* give the module a construction time

* add a charge safety

* Update robot.dm

* rid the commented dmi

* begone single letter vars

out of this house

* begone comment

* no more INDUCER

* more single letter vars have been escorted to the graveyard

* W stands for Weapon

* how many fucking single letter vars can exist in one file

* man i should really compile this stuff

* replaces camels with snakes. terrible for camel sales.

* the FBI came and took the illegal camels in my basement

* Update modular_skyrat/modules/borg_buffs/code/robot.dm

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>

* annihilate the tool checks.

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>

* suggested variable rename

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>

* More variaable rename

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>

* falsify

* adds a proper health and safety check to the code

* oops

* makes the upgrade cheaper. ore silo rejoice

* Revert "makes the upgrade cheaper. ore silo rejoice"

This reverts commit d86de129995074073d67c22084f355f6ddebeceb.

Co-authored-by: Gandalf <jzo123@hotmail.com>
Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
This commit is contained in:
Helios7-1
2021-11-27 20:58:52 -05:00
committed by GitHub
co-authored by GoldenAlpharex Gandalf
parent be5c75fb52
commit a7d14ed8ae
4 changed files with 117 additions and 0 deletions
@@ -865,6 +865,7 @@
"borg_upgrade_lavaproof",
"borg_upgrade_rped",
"advanced_materials", // SKYRAT ADDITION - ADVANCED MATERIALS UPGRADE
"inducer_module", // SKYRAT ADDITION - INDUCER MODULE UPGRADE
)
research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 2000)
@@ -116,3 +116,76 @@
tool_behaviour = TOOL_KNIFE
to_chat(user, span_notice("You attach the knife bit to [src]."))
icon_state = "knife_screw_cyborg"
/obj/item/inducer/cyborg
name = "Cyborg Inducer"
desc = "A tool for inductively charging internal power cells using the battery of a cyborg"
powertransfer = 250
var/power_safety_threshold = 1000
/obj/item/inducer/cyborg/attackby(obj/item/weapon, mob/user)
return
/obj/item/inducer/cyborg/recharge(atom/movable/target_atom, mob/user)
if(!iscyborg(user))
return
var/mob/living/silicon/robot/borg_user = user
cell = borg_user.cell
if(!isturf(target_atom) && user.loc == target_atom)
return FALSE
if(recharging)
return TRUE
else
recharging = TRUE
var/obj/item/stock_parts/cell/target_cell = target_atom.get_cell()
var/obj/target_object
var/coefficient = 1
if(istype(target_atom, /obj/item/gun/energy))
to_chat(user, span_alert("Error unable to interface with device."))
return FALSE
if(istype(target_atom, /obj/item/clothing/suit/space))
to_chat(user, span_alert("Error unable to interface with device."))
return FALSE
if(cell.charge <= power_safety_threshold ) // Cyborg charge safety. Prevents a borg from inducing themself to death.
to_chat(user, span_alert("Unable to charge device. User battery safety engaged."))
return
if(istype(target_atom, /obj))
target_object = target_atom
if(target_cell)
var/done_any = FALSE
if(target_cell.charge >= target_cell.maxcharge)
to_chat(user, span_notice("[target_atom] is fully charged!"))
recharging = FALSE
return TRUE
user.visible_message(span_notice("[user] starts recharging [target_atom] with [src]."), span_notice("You start recharging [target_atom] with [src]."))
while(target_cell.charge < target_cell.maxcharge)
if(do_after(user, 1 SECONDS, target = user) && cell.charge > (power_safety_threshold + powertransfer))
done_any = TRUE
induce(target_cell, coefficient)
do_sparks(1, FALSE, target_atom)
if(target_object)
target_object.update_appearance()
else
break
if(done_any) // Only show a message if we succeeded at least once
user.visible_message(span_notice("[user] recharged [target_atom]!"), span_notice("You recharged [target_atom]!"))
recharging = FALSE
return FALSE
recharging = FALSE
/obj/item/inducer/attack(mob/target_mob, mob/living/user)
if(user.combat_mode)
return ..()
if(cantbeused(user))
return
if(recharge(target_mob, user))
return
return ..()
/obj/item/inducer/cyborg/attack_self(mob/user)
return
@@ -38,3 +38,17 @@
/datum/material/plasma=7500,
)
category = list("Cyborg Upgrade Modules")
/datum/design/inducer_upgrade
name = "Cyborg Upgrade (Inducer)"
id = "inducer_module"
construction_time = 60
build_type = MECHFAB
build_path = /obj/item/borg/upgrade/inducer
materials = list(
/datum/material/iron=10000,
/datum/material/gold=4000,
/datum/material/plasma=2000,
)
category = list("Cyborg Upgrade Modules")
@@ -215,3 +215,32 @@
qdel(plasteel_energy)
for(var/datum/robot_energy_storage/titanium/titanium_energy in borgo.model.storages)
qdel(titanium_energy)
// funny borg inducer upgrade
/obj/item/borg/upgrade/inducer
name = "engineering cyborg inducer upgrade"
desc = "An inducer device for the engineering cyborg."
icon_state = "cyborg_upgrade3"
require_model = TRUE
model_type = list(/obj/item/robot_model/engineering, /obj/item/robot_model/saboteur)
model_flags = BORG_MODEL_ENGINEERING
/obj/item/borg/upgrade/inducer/action(mob/living/silicon/robot/target_robot, user = usr)
. = ..()
if(.)
var/obj/item/inducer/cyborg/inducer = locate() in target_robot
if(inducer)
to_chat(user, span_warning("This unit is already equipped with an inducer module!"))
return FALSE
inducer = new(target_robot.model)
target_robot.model.basic_modules += inducer
target_robot.model.add_module(inducer, FALSE, TRUE)
/obj/item/borg/upgrade/inducer/deactivate(mob/living/silicon/robot/target_robot, user = usr)
. = ..()
if (.)
var/obj/item/inducer/cyborg/inducer = locate() in target_robot.model
if (inducer)
target_robot.model.remove_module(inducer, TRUE)