Skip to content

Commit

Permalink
TGS Test Merge (#4818)
Browse files Browse the repository at this point in the history
  • Loading branch information
cm13-github committed Apr 3, 2024
2 parents 6598433 + d14897c commit 1afd796
Show file tree
Hide file tree
Showing 21 changed files with 1,340 additions and 45 deletions.
32 changes: 23 additions & 9 deletions code/game/machinery/vending/vendor_types/crew/synthetic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
//------------CLOTHING VENDOR---------------

GLOBAL_LIST_INIT(cm_vending_clothing_synth, list(
list("EXPERIMENTAL TOOL TOKEN (TAKE ALL)", 0, null, null, null),
list("EXPERIMENTAL TOOL TOKEN", 0, null, null, null),
list("Experimental Tool Vendor Token", 0, /obj/item/coin/marine/synth, MARINE_CAN_BUY_ESSENTIALS, VENDOR_ITEM_MANDATORY),

list("RADIO (TAKE ALL)", 0, null, null, null),
Expand Down Expand Up @@ -134,11 +134,11 @@ GLOBAL_LIST_INIT(cm_vending_clothing_synth, list(
list("Latex Gloves", 0, /obj/item/clothing/gloves/latex, MARINE_CAN_BUY_GLOVES, VENDOR_ITEM_REGULAR),

list("BACKPACK (CHOOSE 1)", 0, null, null, null),
list("Smartpack, Blue", 0, /obj/item/storage/backpack/marine/smartpack, MARINE_CAN_BUY_BACKPACK, VENDOR_ITEM_REGULAR),
/*list("Smartpack, Blue", 0, /obj/item/storage/backpack/marine/smartpack, MARINE_CAN_BUY_BACKPACK, VENDOR_ITEM_REGULAR),
list("Smartpack, Green", 0, /obj/item/storage/backpack/marine/smartpack/green, MARINE_CAN_BUY_BACKPACK, VENDOR_ITEM_REGULAR),
list("Smartpack, Tan", 0, /obj/item/storage/backpack/marine/smartpack/tan, MARINE_CAN_BUY_BACKPACK, VENDOR_ITEM_REGULAR),
list("Smartpack, White", 0, /obj/item/storage/backpack/marine/smartpack/white, MARINE_CAN_BUY_BACKPACK, VENDOR_ITEM_REGULAR),
list("Smartpack, Black", 0, /obj/item/storage/backpack/marine/smartpack/black, MARINE_CAN_BUY_BACKPACK, VENDOR_ITEM_REGULAR),
list("Smartpack, Black", 0, /obj/item/storage/backpack/marine/smartpack/black, MARINE_CAN_BUY_BACKPACK, VENDOR_ITEM_REGULAR),*/
list("Logistics IMP Backpack", 0, /obj/item/storage/backpack/marine/satchel/big, MARINE_CAN_BUY_BACKPACK, VENDOR_ITEM_REGULAR),
list("Expedition Chestrig", 0, /obj/item/storage/backpack/marine/satchel/intel/chestrig, MARINE_CAN_BUY_BACKPACK, VENDOR_ITEM_REGULAR),

Expand Down Expand Up @@ -303,6 +303,7 @@ GLOBAL_LIST_INIT(cm_vending_clothing_synth_snowflake, list(
list("Backpack, USCM Medical", 12, /obj/item/storage/backpack/marine/medic, null, VENDOR_ITEM_REGULAR),
list("Chestrig, Technician", 12, /obj/item/storage/backpack/marine/satchel/tech, null, VENDOR_ITEM_REGULAR),
list("Satchel, USCM", 12, /obj/item/storage/backpack/marine/satchel, null, VENDOR_ITEM_REGULAR),
list("Satchel, USCM Medical", 12, /obj/item/storage/backpack/marine/satchel/medic, null, VENDOR_ITEM_REGULAR),
list("Satchel, Leather", 12, /obj/item/storage/backpack/satchel, null, VENDOR_ITEM_REGULAR),
list("Satchel, Medical", 12, /obj/item/storage/backpack/satchel/med, null, VENDOR_ITEM_REGULAR),
list("USCM RTO Pack", 12, /obj/item/storage/backpack/marine/satchel/rto, null, VENDOR_ITEM_REGULAR),
Expand Down Expand Up @@ -358,16 +359,29 @@ GLOBAL_LIST_INIT(cm_vending_clothing_synth_snowflake, list(
return GLOB.cm_vending_synth_tools

GLOBAL_LIST_INIT(cm_vending_synth_tools, list(
list("Autocompressor", 15, /obj/item/clothing/suit/auto_cpr, null, VENDOR_ITEM_REGULAR),
list("PK-130", 0, null, null, null),
list("PK-130 SIMI Wrist-Mounted Computer", 15, /obj/item/clothing/gloves/synth, MARINE_CAN_BUY_GLOVES, VENDOR_ITEM_MANDATORY),
list("PK-130 Repair Mode", 7, /obj/item/device/simi_chip/repair, null, VENDOR_ITEM_RECOMMENDED),
list("PK-130 Protection Mode", 7, /obj/item/device/simi_chip/protect, null, VENDOR_ITEM_REGULAR),
list("PK-130 Anchor Mode", 3, /obj/item/device/simi_chip/anchor, null, VENDOR_ITEM_REGULAR),
list("PK-130 Motion Detector", 4, /obj/item/device/simi_chip/motion_detector, null, VENDOR_ITEM_REGULAR),
list("PK-130 Recovery Hook", 15, /obj/item/device/simi_chip/rescue_hook, null, VENDOR_ITEM_REGULAR),

list("UTILITY & SELF DEFENSE TOOLS", 0, null, null, null),
list("Telescopic Baton", 15, /obj/item/weapon/telebaton, null, VENDOR_ITEM_REGULAR),
list("Experimental Meson Goggles", 15, /obj/item/clothing/glasses/night/experimental_mesons, null, VENDOR_ITEM_REGULAR),
list("Backpack Firefighting Watertank", 15, /obj/item/reagent_container/glass/watertank/atmos, null, VENDOR_ITEM_REGULAR),
list("Breaching Hammer", 15, /obj/item/weapon/twohanded/breacher/synth, null, VENDOR_ITEM_REGULAR),

list("MEDICAL TOOLS", 0, null, null, null),
list("Autocompressor", 15, /obj/item/clothing/suit/auto_cpr, null, VENDOR_ITEM_REGULAR),
list("Compact Defibrillator", 15, /obj/item/device/defibrillator/compact, null, VENDOR_ITEM_REGULAR),
list("Compact Nailgun kit", 15, /obj/effect/essentials_set/cnailgun, null, VENDOR_ITEM_REGULAR),
list("Portable Dialysis Machine", 15, /obj/item/tool/portadialysis, null, VENDOR_ITEM_REGULAR),
list("Crew Monitor", 15, /obj/item/tool/crew_monitor, null, VENDOR_ITEM_REGULAR),
list("Experimental Meson Goggles", 15, /obj/item/clothing/glasses/night/experimental_mesons, null, VENDOR_ITEM_REGULAR),

list("CONSTRUCTION TOOLS", 0, null, null, null),
list("Breaching Hammer", 15, /obj/item/weapon/twohanded/breacher/synth, null, VENDOR_ITEM_REGULAR),
list("Compact Nailgun kit", 15, /obj/effect/essentials_set/cnailgun, null, VENDOR_ITEM_REGULAR),
list("Maintenance Jack", 15, /obj/item/maintenance_jack, null, VENDOR_ITEM_REGULAR),
list("Portable Dialysis Machine", 15, /obj/item/tool/portadialysis, null, VENDOR_ITEM_REGULAR),
list("Telescopic Baton", 15, /obj/item/weapon/telebaton, null, VENDOR_ITEM_REGULAR),
))

//------------EXPERIMENTAL TOOL KITS---------------
Expand Down
6 changes: 4 additions & 2 deletions code/game/objects/items/devices/motion_detector.dm
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,11 @@
if(ishuman(loc))
return loc

/obj/item/device/motiondetector/sg
/obj/item/device/motiondetector/integrated
name = "integrated motion detector"
desc = "A motion sensing component from another device."

/obj/item/device/motiondetector/sg/get_user()
/obj/item/device/motiondetector/integrated/get_user()
var/atom/A = loc
if(ishuman(A.loc))
return A.loc
Expand Down
44 changes: 44 additions & 0 deletions code/game/objects/items/tools/synth_bracer/_defines.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Possible Bracer Colors
#define SIMI_COLOR_DEFAULT "default"
#define SIMI_COLOR_WHITE "white"

/// Loads/Reloads the available actions on the computer itself.
#define SIMI_ACTIONS_LOAD "load"
#define SIMI_ACTIONS_RELOAD "reload"
/// Cleans and then adds actions to the user.
#define SIMI_ACTIONS_ADD "add"
/// Removes actions from the user.
#define SIMI_ACTIONS_REMOVE "remove"

/// No active module.
#define SIMI_ACTIVE_NONE "none"

// Primary Abilities
#define SIMI_PRIMARY_ACTION "primary"

/// Synth self-repair
#define SIMI_ABILITY_REPAIR "repair"
#define SIMI_REPAIR_COST 50

/// Synth fortify, enforced stationary
#define SIMI_ABILITY_ANCHOR "anchor"
#define SIMI_IMMOBILE_COST 20

/// Damage reduced but incapable of self defense.
#define SIMI_ABILITY_PROTECT "protect"
#define SIMI_PROTECTIVE_COST 60

// Secondary Abilities
#define SIMI_SECONDARY_ACTION "secondary"

/// Rescue hook.
#define SIMI_SECONDARY_HOOK "hook"
/// Motion Detector
#define SIMI_SECONDARY_MD "motion"

// Statuses
#define SIMI_STATUS_IDLE "status_idle"
#define SIMI_STATUS_NOACCESS "status_unauthorized"
#define SIMI_STATUS_LOWPOWER "status_lowbattery"
#define SIMI_STATUS_NOPOWER "status_nobattery"
#define SIMI_STATUS_CHARGING "status_charging"
34 changes: 34 additions & 0 deletions code/game/objects/items/tools/synth_bracer/abilities/chips.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/obj/item/device/simi_chip
name = "PK-130 SIMI programmable circuit (NOT FOR USE)"
desc = "A programmable computer circuit used within the PK-130 SINI wrist-mounted computer to add or unlock various functions."
icon = 'icons/obj/items/synth/bracer.dmi'
icon_state = "simi_chip_white"

/// The action this chip will add to the SIMI
var/chip_action = /datum/action/human_action
/// If this chip is 'secret' or not (cannot be removed/one time use)
var/secret = FALSE

/obj/item/device/simi_chip/repair
name = "PK-130 SIMI programmable circuit (Self-Repair)"
chip_action = /datum/action/human_action/synth_bracer/repair_form
icon_state = "simi_chip_red"

/obj/item/device/simi_chip/protect
name = "PK-130 SIMI programmable circuit (Damage Bracing)"
icon_state = "simi_chip_blue"
chip_action = /datum/action/human_action/synth_bracer/protective_form

/obj/item/device/simi_chip/anchor
name = "PK-130 SIMI programmable circuit (Anchor)"
icon_state = "simi_chip_blue"
chip_action = /datum/action/human_action/synth_bracer/anchor_form

/obj/item/device/simi_chip/rescue_hook
name = "PK-130 SIMI programmable circuit (Rescue Hook)"
chip_action = /datum/action/human_action/activable/synth_bracer/rescue_hook

/obj/item/device/simi_chip/motion_detector
name = "PK-130 SIMI programmable circuit (Motion Detector)"
chip_action = /datum/action/human_action/synth_bracer/motion_detector
desc = "A programmable computer circuit used within the PK-130 SINI wrist-mounted computer to add or unlock various functions. This one activates a motion detector capability, at a running cost of power."
228 changes: 228 additions & 0 deletions code/game/objects/items/tools/synth_bracer/abilities/framework.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
/* -- ACTIVATABLE ACTIONS -- */

/datum/action/human_action/activable/synth_bracer
icon_file = 'icons/obj/items/synth/bracer.dmi'
var/mob/living/carbon/human/synth
var/obj/item/clothing/gloves/synth/synth_bracer
var/charge_cost = 0
var/handles_cooldown = FALSE
var/handles_charge_cost = FALSE
/// What cateogry of action it is. Can only have one active action from each type.
var/category = SIMI_SECONDARY_ACTION
var/human_adaptable = FALSE
/// The tag to tell what ability is active.
var/ability_tag = SIMI_ACTIVE_NONE

/datum/action/human_action/activable/synth_bracer/give_to(user)
/// never add a check to see if the synth has gloves on, because they shouldn't have these abilities while not wearing gloves. it should runtime to let us know
synth = user
synth_bracer = synth.gloves
if(!issynth(user) && !is_human_usable())
synth = null
synth_bracer = null
return FALSE
return ..()

/datum/action/human_action/activable/synth_bracer/remove_from(mob/living/carbon/human/H)
synth = null
synth_bracer = null
return ..()

/datum/action/human_action/activable/synth_bracer/Destroy()
synth = null
synth_bracer = null
return ..()

/datum/action/human_action/activable/synth_bracer/action_activate()
if(is_active())
set_inactive(category)
return
..()

/datum/action/human_action/activable/synth_bracer/use_ability(mob/M)
if(!can_use_action())
return FALSE
if(synth_bracer.battery_charge < charge_cost)
to_chat(synth, SPAN_WARNING("You don't have enough charge to to do this! Charge: <b>[synth_bracer.battery_charge]/[synth_bracer.battery_charge_max]</b> you need [SPAN_RED(charge_cost)]."))
return FALSE
if(!handles_cooldown && cooldown)
enter_cooldown()
if(!handles_charge_cost && charge_cost)
synth_bracer.drain_charge(owner, charge_cost)
return TRUE

/datum/action/human_action/activable/synth_bracer/can_use_action()
if(is_active())
set_inactive(category)
return FALSE
if(!issynth(owner) && !is_human_usable())
to_chat(owner, SPAN_WARNING("You have no idea how to use this!"))
if(owner.is_mob_incapacitated())
to_chat(owner, SPAN_WARNING("You cannot use this action while incapacitated!"))
return FALSE

switch(category)
if(SIMI_PRIMARY_ACTION)
if(synth_bracer.active_ability != SIMI_ACTIVE_NONE)
to_chat(owner, SPAN_WARNING("You cannot use this action while another primary ability is active."))
return FALSE
if(SIMI_SECONDARY_ACTION)
if(synth_bracer.active_utility != SIMI_ACTIVE_NONE)
to_chat(owner, SPAN_WARNING("You cannot use this action while another secondary ability is active."))
return FALSE

if(synth_bracer.battery_charge <= 0)
to_chat(synth, SPAN_WARNING("You cannot do this without power!"))
return FALSE
if(synth_bracer.battery_charge < charge_cost)
to_chat(synth, SPAN_WARNING("You don't have enough charge to to do this! Charge: <b>[synth_bracer.battery_charge]/[synth_bracer.battery_charge_max]</b> you need [SPAN_RED(charge_cost)]."))
return FALSE
if(!action_cooldown_check())
return FALSE
return ..()

/datum/action/human_action/activable/synth_bracer/proc/is_human_usable()
if(human_adaptable && synth_bracer.human_adapted)
return TRUE
return FALSE

/datum/action/human_action/activable/synth_bracer/proc/set_active(category = SIMI_SECONDARY_ACTION, set_ability = SIMI_ACTIVE_NONE)
switch(category)
if(SIMI_PRIMARY_ACTION)
synth_bracer.active_ability = set_ability
if(SIMI_SECONDARY_ACTION)
synth_bracer.active_utility = set_ability
if((synth_bracer.active_ability == SIMI_ACTIVE_NONE) && (synth_bracer.active_utility == SIMI_ACTIVE_NONE))
synth_bracer.flags_item &= ~NODROP
else
synth_bracer.flags_item |= NODROP
synth_bracer.update_icon(synth)

/datum/action/human_action/activable/synth_bracer/proc/set_inactive(category = SIMI_SECONDARY_ACTION)
set_active(category, SIMI_ACTIVE_NONE)

/datum/action/human_action/activable/synth_bracer/proc/is_active()
switch(category)
if(SIMI_PRIMARY_ACTION)
if(synth_bracer.active_ability == ability_tag)
return TRUE
if(SIMI_SECONDARY_ACTION)
if(synth_bracer.active_utility == ability_tag)
return TRUE
return FALSE
/* -- ON-CLICK ACTIONS -- */

/datum/action/human_action/synth_bracer
icon_file = 'icons/obj/items/synth/bracer.dmi'
var/mob/living/carbon/human/synth
var/obj/item/clothing/gloves/synth/synth_bracer
var/ability_used_time = 0
var/charge_cost = 0
var/handles_cooldown = FALSE // whether the cooldown gets handled by the child, or should be done automatically here
var/handles_charge_cost = FALSE
/// What cateogry of action it is. Can only have one active action from each type.
var/category = SIMI_SECONDARY_ACTION
var/human_adaptable = FALSE
/// The tag to tell what ability is active.
var/ability_tag = SIMI_ACTIVE_NONE

/datum/action/human_action/synth_bracer/give_to(user)
synth = user
synth_bracer = synth.gloves
if(!issynth(user) && !is_human_usable())
synth = null
synth_bracer = null
return FALSE
return ..()

/datum/action/human_action/synth_bracer/remove_from(user)
synth = null
synth_bracer = null
return ..()

/datum/action/human_action/synth_bracer/Destroy()
synth = null
synth_bracer = null
return ..()

/datum/action/human_action/synth_bracer/action_cooldown_check()
return ability_used_time <= world.time

/datum/action/human_action/synth_bracer/proc/enter_cooldown(amount = cooldown)
ability_used_time = world.time + amount
update_button_icon()
addtimer(CALLBACK(src, PROC_REF(update_button_icon)), amount)

/datum/action/human_action/synth_bracer/update_button_icon()
if(!button)
return
if(!action_cooldown_check())
button.color = rgb(240,180,0,200)
else
button.color = rgb(255,255,255,255)

/datum/action/human_action/synth_bracer/can_use_action()
if(!issynth(owner) && !is_human_usable())
to_chat(owner, SPAN_WARNING("You have no idea how to use this!"))
if(owner.is_mob_incapacitated())
to_chat(owner, SPAN_WARNING("You cannot use this action while incapacitated!"))
return FALSE

switch(category)
if(SIMI_PRIMARY_ACTION)
if(synth_bracer.active_ability != SIMI_ACTIVE_NONE)
to_chat(owner, SPAN_WARNING("You cannot use this action while another primary ability is active."))
return FALSE
if(SIMI_SECONDARY_ACTION)
if(synth_bracer.active_utility != SIMI_ACTIVE_NONE)
to_chat(owner, SPAN_WARNING("You cannot use this action while another secondary ability is active."))
return FALSE

if(synth_bracer.battery_charge <= 0)
to_chat(synth, SPAN_WARNING("You cannot do this without power!"))
return FALSE
if(synth_bracer.battery_charge < charge_cost)
to_chat(synth, SPAN_WARNING("You don't have enough charge to to do this! Charge: <b>[synth_bracer.battery_charge]/[synth_bracer.battery_charge_max]</b> you need [SPAN_RED(charge_cost)]."))
return FALSE
if(!action_cooldown_check())
return FALSE
return ..()

/datum/action/human_action/synth_bracer/action_activate()
if(is_active())
set_inactive(category)
return FALSE
if(!handles_cooldown && cooldown)
enter_cooldown()
if(!handles_charge_cost && charge_cost)
synth_bracer.drain_charge(owner, charge_cost)

/datum/action/human_action/synth_bracer/proc/is_human_usable()
if(human_adaptable && synth_bracer.human_adapted)
return TRUE
return FALSE

/datum/action/human_action/synth_bracer/proc/set_active(category = SIMI_SECONDARY_ACTION, set_ability = SIMI_ACTIVE_NONE)
switch(category)
if(SIMI_PRIMARY_ACTION)
synth_bracer.active_ability = set_ability
if(SIMI_SECONDARY_ACTION)
synth_bracer.active_utility = set_ability
if((synth_bracer.active_ability == SIMI_ACTIVE_NONE) && (synth_bracer.active_utility == SIMI_ACTIVE_NONE))
synth_bracer.flags_item &= ~NODROP
else
synth_bracer.flags_item |= NODROP
synth_bracer.update_icon(synth)

/datum/action/human_action/synth_bracer/proc/set_inactive(category = SIMI_SECONDARY_ACTION)
set_active(category, SIMI_ACTIVE_NONE)

/datum/action/human_action/synth_bracer/proc/is_active()
switch(category)
if(SIMI_PRIMARY_ACTION)
if(synth_bracer.active_ability == ability_tag)
return TRUE
if(SIMI_SECONDARY_ACTION)
if(synth_bracer.active_utility == ability_tag)
return TRUE
return FALSE
Loading

0 comments on commit 1afd796

Please sign in to comment.