mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 21:18:37 +01:00
Integrated Circuits (Wiremod) (#59232)
Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com> Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com> Co-authored-by: ATH1909 <42606352+ATH1909@users.noreply.github.com> Co-authored-by: Maurukas <66576896+Maurukas@users.noreply.github.com>
This commit is contained in:
co-authored by
Watermelon914
Mothblocks
ATH1909
Maurukas
parent
bc34e2a168
commit
b84a9f97b2
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* # Bot
|
||||
*
|
||||
* Immobile (but not dense) shells that can interact with world.
|
||||
*/
|
||||
/obj/structure/bot
|
||||
name = "bot"
|
||||
icon = 'icons/obj/wiremod.dmi'
|
||||
icon_state = "setup_medium_box"
|
||||
|
||||
density = FALSE
|
||||
light_system = MOVABLE_LIGHT
|
||||
light_on = FALSE
|
||||
|
||||
/obj/structure/bot/Initialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/shell, null, SHELL_CAPACITY_LARGE)
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* # Compact Remote
|
||||
*
|
||||
* A handheld device with one big button.
|
||||
*/
|
||||
/obj/item/compact_remote
|
||||
name = "compact remote"
|
||||
icon = 'icons/obj/wiremod.dmi'
|
||||
icon_state = "setup_small_simple"
|
||||
inhand_icon_state = "electronic"
|
||||
worn_icon_state = "electronic"
|
||||
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
|
||||
light_system = MOVABLE_LIGHT_DIRECTIONAL
|
||||
light_on = FALSE
|
||||
|
||||
/obj/item/compact_remote/Initialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/shell, list(
|
||||
new /obj/item/circuit_component/compact_remote()
|
||||
), SHELL_CAPACITY_SMALL)
|
||||
|
||||
/obj/item/circuit_component/compact_remote
|
||||
display_name = "Compact Remote"
|
||||
|
||||
/// Called when attack_self is called on the shell.
|
||||
var/datum/port/output/signal
|
||||
|
||||
/obj/item/circuit_component/compact_remote/Initialize()
|
||||
. = ..()
|
||||
signal = add_output_port("Signal", PORT_TYPE_SIGNAL)
|
||||
|
||||
/obj/item/circuit_component/compact_remote/Destroy()
|
||||
signal = null
|
||||
return ..()
|
||||
|
||||
/obj/item/circuit_component/compact_remote/register_shell(atom/movable/shell)
|
||||
RegisterSignal(shell, COMSIG_ITEM_ATTACK_SELF, .proc/send_trigger)
|
||||
|
||||
/obj/item/circuit_component/compact_remote/unregister_shell(atom/movable/shell)
|
||||
UnregisterSignal(shell, COMSIG_ITEM_ATTACK_SELF)
|
||||
|
||||
/**
|
||||
* Called when the shell item is used in hand.
|
||||
*/
|
||||
/obj/item/circuit_component/compact_remote/proc/send_trigger(atom/source, mob/user)
|
||||
SIGNAL_HANDLER
|
||||
source.balloon_alert(user, "clicked primary button")
|
||||
playsound(source, get_sfx("terminal_type"), 25, FALSE)
|
||||
signal.set_output(COMPONENT_SIGNAL)
|
||||
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
* # Compact Remote
|
||||
*
|
||||
* A handheld device with several buttons.
|
||||
* In game, this translates to having different signals for normal usage, alt-clicking, and ctrl-clicking when in your hand.
|
||||
*/
|
||||
/obj/item/controller
|
||||
name = "controller"
|
||||
icon = 'icons/obj/wiremod.dmi'
|
||||
icon_state = "setup_small_calc"
|
||||
inhand_icon_state = "electronic"
|
||||
worn_icon_state = "electronic"
|
||||
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
|
||||
light_system = MOVABLE_LIGHT_DIRECTIONAL
|
||||
light_on = FALSE
|
||||
|
||||
/obj/item/controller/Initialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/shell, list(
|
||||
new /obj/item/circuit_component/controller()
|
||||
), SHELL_CAPACITY_MEDIUM)
|
||||
|
||||
/obj/item/circuit_component/controller
|
||||
display_name = "Controller"
|
||||
|
||||
/// The three separate buttons that are called in attack_hand on the shell.
|
||||
var/datum/port/output/signal
|
||||
var/datum/port/output/alt
|
||||
var/datum/port/output/right
|
||||
|
||||
/obj/item/circuit_component/controller/Initialize()
|
||||
. = ..()
|
||||
signal = add_output_port("Signal", PORT_TYPE_SIGNAL)
|
||||
alt = add_output_port("Alternate Signal", PORT_TYPE_SIGNAL)
|
||||
right = add_output_port("Extra Signal", PORT_TYPE_SIGNAL)
|
||||
|
||||
/obj/item/circuit_component/controller/Destroy()
|
||||
signal = null
|
||||
alt = null
|
||||
right = null
|
||||
return ..()
|
||||
|
||||
/obj/item/circuit_component/controller/register_shell(atom/movable/shell)
|
||||
RegisterSignal(shell, COMSIG_ITEM_ATTACK_SELF, .proc/send_trigger)
|
||||
RegisterSignal(shell, COMSIG_CLICK_ALT, .proc/send_alternate_signal)
|
||||
RegisterSignal(shell, COMSIG_CLICK_ALT_SECONDARY, .proc/send_right_signal)
|
||||
|
||||
/obj/item/circuit_component/controller/unregister_shell(atom/movable/shell)
|
||||
UnregisterSignal(shell, list(
|
||||
COMSIG_ITEM_ATTACK_SELF,
|
||||
COMSIG_CLICK_ALT_SECONDARY,
|
||||
COMSIG_CLICK_ALT,
|
||||
))
|
||||
|
||||
/**
|
||||
* Called when the shell item is used in hand, including right click.
|
||||
*/
|
||||
/obj/item/circuit_component/controller/proc/send_trigger(atom/source, mob/user)
|
||||
SIGNAL_HANDLER
|
||||
if(!user.Adjacent(source))
|
||||
return
|
||||
source.balloon_alert(user, "clicked primary button")
|
||||
playsound(source, get_sfx("terminal_type"), 25, FALSE)
|
||||
signal.set_output(COMPONENT_SIGNAL)
|
||||
|
||||
/**
|
||||
* Called when the shell item is alt-clicked
|
||||
*/
|
||||
/obj/item/circuit_component/controller/proc/send_alternate_signal(atom/source, mob/user)
|
||||
SIGNAL_HANDLER
|
||||
if(!user.Adjacent(source))
|
||||
return
|
||||
source.balloon_alert(user, "clicked alternate button")
|
||||
playsound(source, get_sfx("terminal_type"), 25, FALSE)
|
||||
alt.set_output(COMPONENT_SIGNAL)
|
||||
|
||||
/obj/item/circuit_component/controller/proc/send_right_signal(atom/source, mob/user)
|
||||
SIGNAL_HANDLER
|
||||
if(!user.Adjacent(source))
|
||||
return
|
||||
source.balloon_alert(user, "clicked extra button")
|
||||
playsound(source, get_sfx("terminal_type"), 25, FALSE)
|
||||
right.set_output(COMPONENT_SIGNAL)
|
||||
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* # Drone
|
||||
*
|
||||
* A movable mob that can be fed inputs on which direction to travel.
|
||||
*/
|
||||
/mob/living/circuit_drone
|
||||
name = "drone"
|
||||
icon = 'icons/obj/wiremod.dmi'
|
||||
icon_state = "setup_medium_med"
|
||||
living_flags = 0
|
||||
light_system = MOVABLE_LIGHT_DIRECTIONAL
|
||||
light_on = FALSE
|
||||
|
||||
/mob/living/circuit_drone/Initialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/shell, list(
|
||||
new /obj/item/circuit_component/bot_circuit()
|
||||
), SHELL_CAPACITY_LARGE)
|
||||
|
||||
/mob/living/circuit_drone/updatehealth()
|
||||
. = ..()
|
||||
if(health < 0)
|
||||
gib(no_brain = TRUE, no_organs = TRUE, no_bodyparts = TRUE)
|
||||
|
||||
/mob/living/circuit_drone/spawn_gibs()
|
||||
new /obj/effect/gibspawner/robot(drop_location(), src, get_static_viruses())
|
||||
|
||||
/obj/item/circuit_component/bot_circuit
|
||||
display_name = "Drone"
|
||||
|
||||
/// The inputs to allow for the drone to move
|
||||
var/datum/port/input/north
|
||||
var/datum/port/input/east
|
||||
var/datum/port/input/south
|
||||
var/datum/port/input/west
|
||||
|
||||
/obj/item/circuit_component/bot_circuit/Initialize()
|
||||
. = ..()
|
||||
north = add_input_port("Move North", PORT_TYPE_SIGNAL)
|
||||
east = add_input_port("Move East", PORT_TYPE_SIGNAL)
|
||||
south = add_input_port("Move South", PORT_TYPE_SIGNAL)
|
||||
west = add_input_port("Move West", PORT_TYPE_SIGNAL)
|
||||
|
||||
/obj/item/circuit_component/bot_circuit/input_received(datum/port/input/port)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/mob/living/shell = parent.shell
|
||||
if(!istype(shell) || shell.stat)
|
||||
return
|
||||
|
||||
var/direction
|
||||
|
||||
if(COMPONENT_TRIGGERED_BY(north, port))
|
||||
direction = NORTH
|
||||
else if(COMPONENT_TRIGGERED_BY(east, port))
|
||||
direction = EAST
|
||||
else if(COMPONENT_TRIGGERED_BY(south, port))
|
||||
direction = SOUTH
|
||||
else if(COMPONENT_TRIGGERED_BY(west, port))
|
||||
direction = WEST
|
||||
|
||||
if(!direction)
|
||||
return
|
||||
|
||||
if(shell.Process_Spacemove(direction))
|
||||
shell.Move(get_step(shell, direction), direction)
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* # Server
|
||||
*
|
||||
* Immobile (but not dense) shells that can interact with
|
||||
* world.
|
||||
*/
|
||||
/obj/structure/server
|
||||
name = "server"
|
||||
icon = 'icons/obj/wiremod.dmi'
|
||||
icon_state = "setup_stationary"
|
||||
|
||||
density = TRUE
|
||||
light_system = MOVABLE_LIGHT
|
||||
light_on = FALSE
|
||||
|
||||
/obj/structure/server/Initialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/shell, null, SHELL_CAPACITY_VERY_LARGE, SHELL_FLAG_REQUIRE_ANCHOR)
|
||||
|
||||
/obj/structure/server/wrench_act(mob/living/user, obj/item/tool)
|
||||
set_anchored(!anchored)
|
||||
tool.play_tool_sound(src)
|
||||
balloon_alert(user, "You [anchored?"secure":"unsecure"] [src].")
|
||||
return TRUE
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* # Shell Item
|
||||
*
|
||||
* Printed out by protolathes. Screwdriver to complete the shell.
|
||||
*/
|
||||
/obj/item/shell
|
||||
name = "assembly"
|
||||
desc = "A shell assembly that can be completed by screwdrivering it."
|
||||
icon = 'icons/obj/wiremod.dmi'
|
||||
var/shell_to_spawn
|
||||
var/screw_delay = 3 SECONDS
|
||||
|
||||
/obj/item/shell/screwdriver_act(mob/living/user, obj/item/tool)
|
||||
user.visible_message("<span class='notice'>[user] begins finishing [src].</span>", "<span class='notice'>You begin finishing [src].</span>")
|
||||
tool.play_tool_sound(src)
|
||||
if(!do_after(user, screw_delay, src))
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] finishes [src].</span>", "<span class='notice'>You finish [src].</span>")
|
||||
|
||||
var/turf/drop_loc = drop_location()
|
||||
|
||||
qdel(src)
|
||||
if(drop_loc)
|
||||
new shell_to_spawn(drop_loc)
|
||||
|
||||
return TRUE
|
||||
|
||||
/obj/item/shell/bot
|
||||
name = "bot assembly"
|
||||
icon_state = "setup_medium_box-open"
|
||||
shell_to_spawn = /obj/structure/bot
|
||||
|
||||
/obj/item/shell/drone
|
||||
name = "drone assembly"
|
||||
icon_state = "setup_medium_med-open"
|
||||
shell_to_spawn = /mob/living/circuit_drone
|
||||
|
||||
/obj/item/shell/server
|
||||
name = "server assembly"
|
||||
icon_state = "setup_stationary-open"
|
||||
shell_to_spawn = /obj/structure/server
|
||||
screw_delay = 10 SECONDS
|
||||
Reference in New Issue
Block a user