Skip to content

Commit

Permalink
Fix bug and folder machinery (#2427)
Browse files Browse the repository at this point in the history
  • Loading branch information
Teteshnik1 authored Jul 8, 2024
1 parent a76a134 commit 4e63374
Show file tree
Hide file tree
Showing 16 changed files with 331 additions and 5 deletions.
13 changes: 8 additions & 5 deletions mods/machinery/_machinery.dme
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
#include "code/gravity_generator/wires.dm"
#include "code/sealing_generator.dm"
#include "code/telepads.dm"
#include "code/tele_pads.dm"
#include "code/gps.dm"
#include "code/bcrystal.dm"
#include "code/telesci_computer.dm"
#include "code/tele.dm"
#include "code/telesci_by_TT/tele_pads.dm"
#include "code/telesci_by_TT/gps.dm"
#include "code/telesci_by_TT/bcrystal.dm"
#include "code/telesci_by_TT/telesci_computer.dm"
#include "code/telesci_by_TT/tele.dm"
#include "code/bs_silk_by_TT/circuits.dm"
#include "code/bs_silk_by_TT/accessory.dm"
#include "code/bs_silk_by_TT/control.dm"

#endif
23 changes: 23 additions & 0 deletions mods/machinery/code/bs_silk_by_TT/accessory.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/obj/item/clothing/accessory/bs_silk
name = "bluespace snare"
desc = "A bluespace snare. Looking at the edges of this thing, you see a faint blue ripple and spatial distortion."
icon = 'icons/obj/rig_modules.dmi'
icon_state = "teleporter"
w_class = ITEM_SIZE_SMALL
origin_tech = list(TECH_BLUESPACE = 6)
var/id_tag = ""

/obj/item/clothing/accessory/bs_silk/New()
. = ..()
matter = list(MATERIAL_STEEL = 8, MATERIAL_GLASS = 5, MATERIAL_SILVER = 10)

/obj/item/clothing/accessory/bs_silk/use_tool(obj/item/I, mob/user)
.=..()
if(isMultitool(I))
var/input_id = input("Enter new BS Snare ID", "Snare ID", id_tag)
id_tag = input_id
return

/obj/item/clothing/accessory/bs_silk/examine()
..()
to_chat(usr, "<br>On small display you can notice label that mean: \"DEVICE ID: <b>[id_tag ? id_tag : "NOT SETTED"]</b>\".")
42 changes: 42 additions & 0 deletions mods/machinery/code/bs_silk_by_TT/circuits.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/obj/item/stock_parts/circuitboard/bs_snare_control
name = "circuit board (bluespace snare manager console)"
origin_tech = list(TECH_DATA = 4, TECH_BLUESPACE = 6)
build_path = /obj/machinery/computer/bs_snare_control

/obj/item/stock_parts/circuitboard/bs_snare_hub
name = "circuit board (bluespace snare hub)"
origin_tech = list(TECH_DATA = 4, TECH_BLUESPACE = 6)
build_path = /obj/machinery/bs_snare_hub
req_components = list(
/obj/item/bluespace_crystal = 2,
/obj/item/stock_parts/capacitor/super = 2,
/obj/item/stack/cable_coil = 1,
/obj/item/stock_parts/subspace/crystal = 1
)
board_type = "machine"
additional_spawn_components = list(
/obj/item/stock_parts/console_screen = 1,
/obj/item/stock_parts/power/apc/buildable = 1
)

/datum/design/circuit/bs_silk/bs_snare_control
name = "circuit board (bluespace snare manager console)"
id = "bs_snare_control"
req_tech = list(TECH_DATA = 5, TECH_BLUESPACE = 6)
build_path = /obj/item/stock_parts/circuitboard/bs_snare_control
sort_string = "VAZOR"

/datum/design/circuit/bs_silk/bs_snare_hub
name = "circuit board (bluespace snare hub)"
id = "bs_snare_hub"
req_tech = list(TECH_DATA = 5, TECH_BLUESPACE = 6)
build_path = /obj/item/stock_parts/circuitboard/bs_snare_hub
sort_string = "BSSNH"

/datum/design/item/clothing/accessory/bs_silk
name = "bluespace snare control"
id = "bs_silk"
req_tech = list(TECH_BLUESPACE = 6)
materials = list(MATERIAL_STEEL = 1000)
build_path = /obj/item/clothing/accessory/bs_silk
sort_string = "BSSIL"
116 changes: 116 additions & 0 deletions mods/machinery/code/bs_silk_by_TT/control.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
GLOBAL_LIST_EMPTY(hubs_id)
/obj/machinery/bs_snare_hub
name = "bluespace snare hub"
icon = 'mods/machinery/icons/stationobjs.dmi'
icon_state = "silk_hub"
density = FALSE

var/snare_id = ""
id_tag = ""
//animations
var/animation_icon = 'mods/machinery/icons/bs_silk.dmi'
var/back_animation = "silc_teleport_back"
var/onhub_animation = "silc_get_hub"

construct_state = /singleton/machine_construction/default/panel_closed
uncreated_component_parts = null

/obj/machinery/bs_snare_hub/proc/set_id_tag(nId)
if(nId in GLOB.hubs_id)
audible_message(SPAN_WARNING("ERROR, unable to set on this bluespace highway another hub use \"[nId]\" highway."))
return
else
GLOB.hubs_id.Remove(id_tag)
id_tag = nId
GLOB.hubs_id.Add(nId)

/obj/machinery/bs_snare_hub/use_tool(obj/item/I, mob/user)
. = ..()
if (isMultitool(I))
set_id_tag(input("Enter HUB id", "HUB ID", id_tag))

/obj/machinery/bs_snare_hub/proc/get_snaring()
. = list()
for(var/mob/living/carbon/human/M in SSmobs.mob_list)
var/obj/item/clothing/U = M?.w_uniform
if(length(U?.accessories))
for(var/obj/item/clothing/accessory/bs_silk/snare in U.accessories)
if(snare?.id_tag == snare_id)
. += M

/obj/machinery/bs_snare_hub/proc/teleport_mobs()
if(!(stat & (is_powered())))
var/list/mobs = get_snaring()
for(var/mob/living/carbon/human/M in mobs)
spawn
animated_teleportation(M, get_turf(src))
return mobs

/obj/machinery/computer/bs_snare_control
name = "bluespace snare control"
icon = 'mods/machinery/icons/computer.dmi'
icon_state = "computer"

icon_keyboard = "tech_key"
icon_screen = "ascent_screen"

var/list/hubs = list()

/obj/machinery/computer/bs_snare_control/physical_attack_hand(mob/user)
ui_interact(user)

/obj/machinery/computer/bs_snare_control/proc/ui_data4hubs()
var/list/L = hubs
var/list/dot [LAZYLEN(L)]
if(LAZYLEN(L)) for(var/i = 1; i <= LAZYLEN(L); i++)
dot[i] = list("myId" = L[i], "sId" = "")
var/obj/machinery/bs_snare_hub/h = find_hub_by_ID(L[i])
if(istype(h)) dot[i]["sId"] = h.snare_id
return dot

/obj/machinery/computer/bs_snare_control/proc/find_hub_by_ID(id)
for(var/obj/machinery/bs_snare_hub/h in SSmachines.machinery) if(id == h.id_tag)
return h

/obj/machinery/computer/bs_snare_control/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1)
var/list/data = list()
data["hubs"] = ui_data4hubs()
ui = SSnano.try_update_ui(user, src, ui_key, ui, data, force_open)
if(!ui)
ui = new(user, src, ui_key, "_inf.bs_snare_controller.tmpl", "BS Snare Control", 440, 600)
ui.set_initial_data(data)
ui.open()
/*
/obj/machinery/computer/bs_snare_control/proc/find_hubs_ID()
. = list()
for(var/obj/machinery/bs_snare_hub/HUB in SSmachines.machinery) if(HUB.id_tag in hubs)
. += HUB.id_tag
*/
/obj/machinery/computer/bs_snare_control/proc/find_hubs()
. = list()
for(var/id in hubs)
. += find_hub_by_ID(id)
/obj/machinery/computer/bs_snare_control/OnTopic(mob/user, list/href_list, state)
. = ..()
if(href_list["catch_snaring"])
var/obj/machinery/bs_snare_hub/hub = find_hub_by_ID(href_list["catch_snaring"])
if(!hub || !length(hub.teleport_mobs()))
playsound(loc, 'sound/machines/buzz-sigh.ogg', 50, 1, -1)
audible_message(SPAN_WARNING("The [src.name] buzzes and state \"SNARE EITHER DISABLED OR NOT AVAILABLE, TRY TO PROBE IT AGAIN, IF YOU ARE SURE THAT THE SNARE IN A GOOD CONDITION OR CONNECTED TO USER.\""),
SPAN_WARNING("The [src.name] buzzes and state something."),
hearing_distance = 5
)

if(href_list["add_id"])
var/new_id = input(user, "Enter HUB id.", "HUB ID")
if(length(new_id)) Adjacent(user) ? (hubs += new_id) : to_chat(user, "You are too far from [src].")

if(href_list["remove_id"])
hubs.Remove(href_list["remove_id"])

if(href_list["set_id"])
var/obj/machinery/bs_snare_hub/h = find_hub_by_ID(href_list["set_id"])
if(h)
var/i = input(user, "Enter new BS Snare ID", "Snare ID", h.snare_id)
Adjacent(user) ? (h.snare_id = i) : to_chat(user, "You are too far from [src].")
return TOPIC_REFRESH
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added mods/machinery/icons/bs_silk.dmi
Binary file not shown.
Binary file added mods/machinery/icons/computer.dmi
Binary file not shown.
Binary file added mods/machinery/icons/stationobjs.dmi
Binary file not shown.
2 changes: 2 additions & 0 deletions mods/utility_items/_utility_items.dme
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@
#include "code/reagents.dm"
#include "code/cell_charger.dm"
#include "code/vox.dm"
#include "code/simple.dm"
#include "code/circuit.dm"

#endif
32 changes: 32 additions & 0 deletions mods/utility_items/code/circuit.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/obj/item/organ/internal/augment/active/simple/circuit
name = "integrated circuit frame"
action_button_name = "Activate Circuit"
icon_state = "circuit"
augment_slots = AUGMENT_ARM
holding_type = null //We must get the holding item externally
//Limited to robolimbs
augment_flags = AUGMENT_MECHANICAL
desc = "A DIY modular assembly, courtesy of Xion Industrial. Circuitry not included"


/obj/item/organ/internal/augment/active/simple/circuit/use_tool(obj/item/W as obj, mob/user as mob)
if(isCrowbar(W))
//Remove internal circuit
if(holding)
holding.canremove = 1
holding.dropInto(loc)
to_chat(user, SPAN_WARNING("You take out \the [holding]."))
holding = null
playsound(loc, 'sound/items/Crowbar.ogg', 50, 1)
else to_chat(user, SPAN_WARNING("The augment is empty!"))
return
if(istype(W, /obj/item/device/electronic_assembly/augment))
if(holding)
to_chat(user, SPAN_WARNING("There's already an assembly in there."))
else if(user.unEquip(W, src))
holding = W
holding.canremove = 0
playsound(loc, 'sound/items/Crowbar.ogg', 50, 1)
return

..()
83 changes: 83 additions & 0 deletions mods/utility_items/code/simple.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
//Simple toggleabse module. Just put holding in hands or get it back
/obj/item/organ/internal/augment/active/simple
var/obj/item/holding = null
var/holding_type = null
var/deploy_sound
var/retract_sound

/obj/item/organ/internal/augment/active/simple/Initialize()
. = ..()
if(holding_type)
holding = new holding_type(src)
holding.canremove = 0

/obj/item/organ/internal/augment/active/simple/Destroy()
if(holding)
GLOB.item_unequipped_event.unregister(holding, src)
if(holding.loc == src)
qdel(holding)
holding = null
return ..()

/obj/item/organ/internal/augment/active/simple/proc/holding_dropped()

//Stop caring
GLOB.item_unequipped_event.unregister(holding, src)

if(holding.loc != src) //something went wrong and is no longer attached/ it broke
holding.canremove = 1
holding = null //We no longer hold this, you will have to get a replacement module or fix it somehow

/obj/item/organ/internal/augment/active/simple/proc/deploy()

var/slot = null
if(limb.organ_tag in list(BP_L_ARM, BP_L_HAND))
slot = slot_l_hand
else if(limb.organ_tag in list(BP_R_ARM, BP_R_HAND))
slot = slot_r_hand
if(owner.equip_to_slot_if_possible(holding, slot))
GLOB.item_unequipped_event.register(holding, src, /obj/item/organ/internal/augment/active/simple/proc/holding_dropped )
owner.visible_message(
SPAN_WARNING("\The [owner] extends \his [holding.name] from \his [limb.name]."),
SPAN_NOTICE("You extend your [holding.name] from your [limb.name].")
)
if (deploy_sound)
playsound(owner, deploy_sound, 30)
return TRUE

/obj/item/organ/internal/augment/active/simple/proc/retract()
if(holding.loc == src)
return

if(ismob(holding.loc) && holding.loc == owner)
var/mob/M = holding.loc
if(!M.drop_from_inventory(holding, src))
to_chat(owner, "\The [holding.name] fails to retract.")
return
M.visible_message(
SPAN_WARNING("\The [M] retracts \his [holding.name] into \his [limb.name]."),
SPAN_NOTICE("You retract your [holding.name] into your [limb.name].")
)
if (retract_sound)
playsound(owner, retract_sound, 30)
return TRUE



/obj/item/organ/internal/augment/active/simple/activate()
if(!can_activate())
return

if(holding.loc == src) //item not in hands
deploy()
else //retract item
retract()
owner.update_action_buttons()

/obj/item/organ/internal/augment/active/simple/can_activate()
if(..())
if(!holding)
to_chat(owner, SPAN_WARNING("The device is damaged and fails to deploy"))
return FALSE
return TRUE
return FALSE
25 changes: 25 additions & 0 deletions nano/templates/_inf.bs_snare_controller.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{:helper.link('Add Hub ID', null, {'add_id' : 1}, null)}}<br><br>

<table border='1'>
<tr>
<th>Hub ID
<th>Snare ID
<th>Activate
<th>Remove
<th>Snare Setup
{{for data.hubs}}
<tr>
<td>{{:value.myId}}
<td>{{:value.sId}}
<td>{{:helper.link('Catch', null, {'catch_snaring' : value.myId}, null)}}
<td>{{:helper.link('Remove', null, {'remove_id' : value.myId}, null)}}
<td>{{:helper.link('Set Snare', null, {'set_id' : value.myId}, null)}}
{{empty}}
<tr>
<td>NOT FOUND
<td>NOT FOUND
<td>NOT FOUND
<td>NOT FOUND
<td>NOT FOUND
{{/for}}
</table>

0 comments on commit 4e63374

Please sign in to comment.