")
+ text = replacetext(text, "\[cell\]", "")
+ text = replacetext(text, "\[logo\]", " ") // Not sure if these would get used but why not
+ text = replacetext(text, "\[sglogo\]", " ")
+ return text
+
+// This is used when reading text that went through paper_markup2html(), to reverse it so that edits don't need to replace everything once more to avoid sanitization.
+/proc/html2paper_markup(var/text)
+ text = replacetext(text, " ", "\[br\]")
+ text = replacetext(text, "", "\[center\]")
+ text = replacetext(text, "", "\[/center\]")
+ text = replacetext(text, " ", "\[br\]")
+ text = replacetext(text, "", "\[b\]")
+ text = replacetext(text, "", "\[/b\]")
+ text = replacetext(text, "", "\[i\]")
+ text = replacetext(text, "", "\[/i\]")
+ text = replacetext(text, "", "\[u\]")
+ text = replacetext(text, "", "\[/u\]")
+ text = replacetext(text, "", "\[large\]")
+ text = replacetext(text, "", "\[/large\]")
+ text = replacetext(text, "", "\[h1\]")
+ text = replacetext(text, "", "\[/h1\]")
+ text = replacetext(text, "", "\[h2\]")
+ text = replacetext(text, "", "\[/h2\]")
+ text = replacetext(text, "", "\[h3\]")
+ text = replacetext(text, "", "\[/h3\]")
+
+ text = replacetext(text, "", "\[*\]")
+ text = replacetext(text, " ", "\[hr\]")
+ text = replacetext(text, "", "\[small\]")
+ text = replacetext(text, "", "\[/small\]")
+ text = replacetext(text, "", "\[list\]")
+ text = replacetext(text, " ", "\[/list\]")
+ text = replacetext(text, "", "\[table\]")
+ text = replacetext(text, " ", "\[/table\]")
+ text = replacetext(text, "", "\[grid\]")
+ text = replacetext(text, " ", "\[/grid\]")
+ text = replacetext(text, " |
", "\[row\]")
+ text = replacetext(text, "", "\[cell\]")
+ text = replacetext(text, " ", "\[logo\]") // Not sure if these would get used but why not
+ text = replacetext(text, " ", "\[sglogo\]")
+ return text
#undef NEWSFILE
\ No newline at end of file
diff --git a/code/modules/client/preference_setup/loadout/loadout_eyes.dm b/code/modules/client/preference_setup/loadout/loadout_eyes.dm
index 5909b0eb2e..533cf88a51 100644
--- a/code/modules/client/preference_setup/loadout/loadout_eyes.dm
+++ b/code/modules/client/preference_setup/loadout/loadout_eyes.dm
@@ -42,15 +42,13 @@
display_name = "Security HUD, sunglasses (Security)"
path = /obj/item/clothing/glasses/sunglasses/sechud
-/datum/gear/eyes/secaviators
- display_name = "Security HUD Aviators"
+/datum/gear/eyes/security/aviator
+ display_name = "Security HUD Aviators (Security)"
path = /obj/item/clothing/glasses/sunglasses/sechud/aviator
- allowed_roles = list("Security Officer","Head of Security","Warden")
-/datum/gear/eyes/secaviators/prescription
- display_name = "Security HUD Aviators, prescription"
+/datum/gear/eyes/security/aviator/prescription
+ display_name = "Security HUD Aviators, prescription (Security)"
path = /obj/item/clothing/glasses/sunglasses/sechud/aviator/prescription
- allowed_roles = list("Security Officer","Head of Security","Warden")
/datum/gear/eyes/medical
display_name = "Medical HUD (Medical)"
@@ -61,10 +59,32 @@
display_name = "Medical HUD, prescription (Medical)"
path = /obj/item/clothing/glasses/hud/health/prescription
-/datum/gear/eyes/shades
- display_name = "Sunglasses, fat (Security/Command)"
- path = /obj/item/clothing/glasses/sunglasses/big
- allowed_roles = list("Security Officer","Head of Security","Warden","Colony Director","Head of Personnel","Quartermaster","Internal Affairs Agent","Detective")
+/datum/gear/eyes/medical/aviator
+ display_name = "Medical HUD Aviators (Medical)"
+ path = /obj/item/clothing/glasses/sunglasses/medhud/aviator
+
+/datum/gear/eyes/medical/aviator
+ display_name = "Medical HUD Aviators, prescription (Medical)"
+ path = /obj/item/clothing/glasses/sunglasses/medhud/aviator/prescription
+
+/datum/gear/eyes/meson
+ display_name = "Optical Meson Scanners (Engineering)"
+ path = /obj/item/clothing/glasses/meson
+ allowed_roles = list("Station Engineer","Chief Engineer","Atmospheric Technician")
+
+/datum/gear/eyes/meson/prescription
+ display_name = "Optical Meson Scanners, prescription (Engineering)"
+ path = /obj/item/clothing/glasses/meson/prescription
+
+/datum/gear/eyes/meson/aviator
+ display_name = "Optical Meson Aviators, (Engineering)"
+ path = /obj/item/clothing/glasses/meson/aviator
+
+/datum/gear/eyes/meson/aviator/prescription
+ display_name = "Optical Meson Aviators, prescription (Engineering)"
+ path = /obj/item/clothing/glasses/meson/aviator/prescription
+
+/datum/gear/eyes/meson/aviator/prescription
/datum/gear/eyes/glasses/fakesun
display_name = "Sunglasses, stylish"
@@ -74,7 +94,16 @@
display_name = "Sunglasses, stylish aviators"
path = /obj/item/clothing/glasses/fakesunglasses/aviator
-/datum/gear/eyes/shades/prescriptionsun
+/datum/gear/eyes/sun
+ display_name = "Sunglasses (Security/Command)"
+ path = /obj/item/clothing/glasses/sunglasses
+ allowed_roles = list("Security Officer","Head of Security","Warden","Colony Director","Head of Personnel","Quartermaster","Internal Affairs Agent","Detective")
+
+/datum/gear/eyes/sun/shades
+ display_name = "Sunglasses, fat (Security/Command)"
+ path = /obj/item/clothing/glasses/sunglasses/big
+
+/datum/gear/eyes/sun/prescriptionsun
display_name = "sunglasses, presciption (Security/Command)"
path = /obj/item/clothing/glasses/sunglasses/prescription
cost = 2
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index 4b04dd0046..710c072e94 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -1,4 +1,4 @@
-//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
+#define SAVE_RESET -1
var/list/preferences_datums = list()
@@ -199,7 +199,8 @@ datum/preferences
dat += "Slot - "
dat += "Load slot - "
dat += "Save slot - "
- dat += "Reload slot"
+ dat += "Reload slot - "
+ dat += "Reset slot"
else
dat += "Please create an account to save your preferences."
@@ -248,6 +249,11 @@ datum/preferences
load_character(text2num(href_list["changeslot"]))
sanitize_preferences()
close_load_dialog(usr)
+ else if(href_list["resetslot"])
+ if("No" == alert("This will reset the current slot. Continue?", "Reset current slot?", "No", "Yes"))
+ return 0
+ load_character(SAVE_RESET)
+ sanitize_preferences()
else
return 0
diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm
index d3fad955d6..22eab43de5 100644
--- a/code/modules/client/preferences_savefile.dm
+++ b/code/modules/client/preferences_savefile.dm
@@ -67,11 +67,20 @@
if(!S) return 0
S.cd = "/"
if(!slot) slot = default_slot
- slot = sanitize_integer(slot, 1, config.character_slots, initial(default_slot))
- if(slot != default_slot)
- default_slot = slot
- S["default_slot"] << slot
- S.cd = "/character[slot]"
+ if(slot != SAVE_RESET) // SAVE_RESET will reset the slot as though it does not exist, but keep the current slot for saving purposes.
+ slot = sanitize_integer(slot, 1, config.character_slots, initial(default_slot))
+ if(slot != default_slot)
+ default_slot = slot
+ S["default_slot"] << slot
+ else
+ S["default_slot"] << default_slot
+
+ if(slot != SAVE_RESET)
+ S.cd = "/character[slot]"
+ player_setup.load_character(S)
+ else
+ player_setup.load_character(S)
+ S.cd = "/character[default_slot]"
player_setup.load_character(S)
return 1
diff --git a/code/modules/clothing/glasses/glasses.dm b/code/modules/clothing/glasses/glasses.dm
index 0208574e5b..53678c13e4 100644
--- a/code/modules/clothing/glasses/glasses.dm
+++ b/code/modules/clothing/glasses/glasses.dm
@@ -69,6 +69,19 @@ BLIND // can't see anything
desc = "Optical Meson Scanner with prescription lenses."
prescription = 1
+/obj/item/clothing/glasses/meson/aviator
+ name = "Engineering Aviators"
+ icon_state = "aviator_eng"
+ off_state = "aviator"
+ item_state_slots = list(slot_r_hand_str = "sunglasses", slot_l_hand_str = "sunglasses")
+ action_button_name = "Toggle HUD"
+ activation_sound = 'sound/effects/pop.ogg'
+
+/obj/item/clothing/glasses/meson/aviator/prescription
+ name = "Prescription Engineering Aviators"
+ desc = "Engineering Aviators with prescription lenses."
+ prescription = 1
+
/obj/item/clothing/glasses/science
name = "Science Goggles"
desc = "The goggles do nothing!"
@@ -242,20 +255,20 @@ BLIND // can't see anything
icon_state = "bigsunglasses"
/obj/item/clothing/glasses/fakesunglasses //Sunglasses without flash immunity
- desc = "A pair of designer sunglasses. Doesn't seem like it'll block flashes."
name = "stylish sunglasses"
+ desc = "A pair of designer sunglasses. Doesn't seem like it'll block flashes."
icon_state = "sun"
item_state_slots = list(slot_r_hand_str = "sunglasses", slot_l_hand_str = "sunglasses")
/obj/item/clothing/glasses/fakesunglasses/aviator
- desc = "A pair of designer sunglasses. Doesn't seem like it'll block flashes."
name = "stylish aviators"
- icon_state = "sec_flash"
+ desc = "A pair of designer sunglasses. Doesn't seem like it'll block flashes."
+ icon_state = "aviator"
/obj/item/clothing/glasses/sunglasses/sechud
name = "HUDSunglasses"
desc = "Sunglasses with a HUD."
- icon_state = "sunhud"
+ icon_state = "sunSecHud"
var/obj/item/clothing/glasses/hud/security/hud = null
New()
@@ -269,10 +282,10 @@ BLIND // can't see anything
icon_state = "swatgoggles"
/obj/item/clothing/glasses/sunglasses/sechud/aviator
- name = "HUD aviators"
+ name = "Security HUD aviators"
desc = "Modified aviator glasses that can be switch between HUD and flash protection modes."
- icon_state = "sec_hud"
- off_state = "sec_flash"
+ icon_state = "aviator_sec"
+ off_state = "aviator"
action_button_name = "Toggle Mode"
var/on = 1
toggleable = 1
@@ -311,10 +324,68 @@ BLIND // can't see anything
icon_state = off_state
/obj/item/clothing/glasses/sunglasses/sechud/aviator/prescription
- name = "Prescription HUD aviators"
+ name = "Prescription Security HUD aviators"
desc = "Modified aviator glasses that can be switch between HUD and flash protection modes. Comes with bonus prescription lenses."
prescription = 6
+/obj/item/clothing/glasses/sunglasses/medhud
+ name = "HUDSunglasses"
+ desc = "Sunglasses with a HUD."
+ icon_state = "sunMedHud"
+ var/obj/item/clothing/glasses/hud/health/hud = null
+
+/obj/item/clothing/glasses/sunglasses/medhud/New()
+ ..()
+ src.hud = new/obj/item/clothing/glasses/hud/health(src)
+ return
+
+/obj/item/clothing/glasses/sunglasses/medhud/aviator
+ name = "Medical HUD aviators"
+ desc = "Modified aviator glasses with a toggled health HUD."
+ icon_state = "aviator_med"
+ off_state = "aviator"
+ action_button_name = "Toggle Mode"
+ var/on = 1
+ toggleable = 1
+ activation_sound = 'sound/effects/pop.ogg'
+
+ var/hud_holder
+
+/obj/item/clothing/glasses/sunglasses/medhud/aviator/New()
+ ..()
+ hud_holder = hud
+
+/obj/item/clothing/glasses/sunglasses/medhud/aviator/Destroy()
+ qdel(hud_holder)
+ hud_holder = null
+ hud = null
+ . = ..()
+
+/obj/item/clothing/glasses/sunglasses/medhud/aviator/attack_self(mob/user)
+ if(toggleable && !user.incapacitated())
+ on = !on
+ if(on)
+ src.hud = hud_holder
+ to_chat(user, "You switch the [src] to HUD mode.")
+ else
+ src.hud = null
+ to_chat(user, "You switch \the [src] off.")
+ update_icon()
+ user << activation_sound
+ user.update_inv_glasses()
+ user.update_action_buttons()
+
+/obj/item/clothing/glasses/sunglasses/medhud/aviator/update_icon()
+ if(on)
+ icon_state = initial(icon_state)
+ else
+ icon_state = off_state
+
+/obj/item/clothing/glasses/sunglasses/medhud/aviator/prescription
+ name = "Prescription Medical HUD aviators"
+ desc = "Modified aviator glasses with a toggled health HUD. Comes with bonus prescription lenses."
+ prescription = 6
+
/obj/item/clothing/glasses/thermal
name = "Optical Thermal Scanner"
desc = "Thermals in the shape of glasses."
diff --git a/code/modules/clothing/gloves/miscellaneous.dm b/code/modules/clothing/gloves/miscellaneous.dm
index 09a1909392..4e17916853 100644
--- a/code/modules/clothing/gloves/miscellaneous.dm
+++ b/code/modules/clothing/gloves/miscellaneous.dm
@@ -92,4 +92,9 @@
siemens_coefficient = 0
phoronproof = 1
permeability_coefficient = 0.05
- species_restricted = list("Vox")
\ No newline at end of file
+ species_restricted = list("Vox")
+
+ cold_protection = HANDS
+ min_cold_protection_temperature = GLOVES_MIN_COLD_PROTECTION_TEMPERATURE
+ heat_protection = HANDS
+ max_heat_protection_temperature = GLOVES_MAX_HEAT_PROTECTION_TEMPERATURE
diff --git a/code/modules/clothing/shoes/magboots.dm b/code/modules/clothing/shoes/magboots.dm
index 57a50b4c09..63e4d93965 100644
--- a/code/modules/clothing/shoes/magboots.dm
+++ b/code/modules/clothing/shoes/magboots.dm
@@ -107,7 +107,6 @@
magpulse = 1
canremove = 0 //kinda hard to take off magclaws when you are gripping them tightly.
to_chat(user, "You dig your claws deeply into the flooring, bracing yourself.")
- to_chat(user, "It would be hard to take off the [src] without relaxing your grip first.")
user.update_action_buttons()
//In case they somehow come off while enabled.
diff --git a/code/modules/clothing/spacesuits/alien.dm b/code/modules/clothing/spacesuits/alien.dm
index 7f28b34a9d..43a19c558f 100644
--- a/code/modules/clothing/spacesuits/alien.dm
+++ b/code/modules/clothing/spacesuits/alien.dm
@@ -33,17 +33,16 @@
w_class = ITEMSIZE_NORMAL
item_flags = STOPPRESSUREDAMAGE | THICKMATERIAL | PHORONGUARD
allowed = list(/obj/item/weapon/gun,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/melee/energy/sword,/obj/item/weapon/handcuffs,/obj/item/weapon/tank)
- slowdown = 1
phoronproof = 1
armor = list(melee = 60, bullet = 50, laser = 40,energy = 15, bomb = 30, bio = 30, rad = 30)
- siemens_coefficient = 0.6
+ siemens_coefficient = 0.2
heat_protection = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS
max_heat_protection_temperature = SPACE_SUIT_MAX_HEAT_PROTECTION_TEMPERATURE
species_restricted = list("Vox")
/obj/item/clothing/head/helmet/space/vox
armor = list(melee = 60, bullet = 50, laser = 40, energy = 15, bomb = 30, bio = 30, rad = 30)
- siemens_coefficient = 0.6
+ siemens_coefficient = 0.2
item_flags = STOPPRESSUREDAMAGE | THICKMATERIAL | AIRTIGHT | PHORONGUARD
flags_inv = 0
phoronproof = 1
diff --git a/code/modules/clothing/spacesuits/rig/suits/alien.dm b/code/modules/clothing/spacesuits/rig/suits/alien.dm
index 61fec573c1..d34739cad3 100644
--- a/code/modules/clothing/spacesuits/rig/suits/alien.dm
+++ b/code/modules/clothing/spacesuits/rig/suits/alien.dm
@@ -47,9 +47,10 @@
icon_state = "vox_rig"
armor = list(melee = 60, bullet = 50, laser = 40, energy = 15, bomb = 30, bio = 30, rad = 30)
item_flags = THICKMATERIAL
+ siemens_coefficient = 0.2
phoronproof = 1
- air_type = /obj/item/weapon/tank/phoron/vox
+ air_type = /obj/item/weapon/tank/vox
helm_type = /obj/item/clothing/head/helmet/space/rig/vox
boot_type = /obj/item/clothing/shoes/magboots/rig/vox
@@ -58,10 +59,15 @@
/obj/item/clothing/head/helmet/space/rig/vox
species_restricted = list("Vox")
+ flags_inv = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE
phoronproof = 1
/obj/item/clothing/shoes/magboots/rig/vox
+ name = "talons"
species_restricted = list("Vox")
+ sprite_sheets = list(
+ "Vox" = 'icons/mob/species/vox/shoes.dmi'
+ )
phoronproof = 1
/obj/item/clothing/suit/space/rig/vox
@@ -69,14 +75,37 @@
phoronproof = 1
/obj/item/clothing/gloves/gauntlets/rig/vox
- name = "talons"
siemens_coefficient = 0
species_restricted = list("Vox")
+ sprite_sheets = list(
+ "Vox" = 'icons/mob/species/vox/gloves.dmi'
+ )
phoronproof = 1
+/obj/item/weapon/rig/vox/carapace
+ name = "dense alien control module"
+ suit_type = "dense alien"
+ armor = list(melee = 60, bullet = 50, laser = 40, energy = 15, bomb = 30, bio = 30, rad = 30)
+ emp_protection = 40 //change this to 30 if too high.
+ phoronproof = 1
+
+ req_access = list(access_syndicate)
+
+ cell_type = /obj/item/weapon/cell/hyper
+
+ initial_modules = list(
+ /obj/item/rig_module/mounted/energy_blade,
+ /obj/item/rig_module/sprinter,
+ /obj/item/rig_module/electrowarfare_suite,
+ /obj/item/rig_module/vision,
+ /obj/item/rig_module/power_sink,
+ /obj/item/rig_module/self_destruct
+ )
+
/obj/item/weapon/rig/vox/stealth
name = "sinister alien control module"
suit_type = "sinister alien"
+ icon_state = "voxstealth_rig"
armor = list(melee = 40, bullet = 30, laser = 30, energy = 15, bomb = 30, bio = 100, rad = 100)
emp_protection = 40 //change this to 30 if too high.
slowdown = 0
@@ -88,6 +117,7 @@
initial_modules = list(
/obj/item/rig_module/stealth_field,
+ /obj/item/rig_module/electrowarfare_suite,
/obj/item/rig_module/vision,
/obj/item/rig_module/power_sink,
/obj/item/rig_module/self_destruct
diff --git a/code/modules/clothing/spacesuits/rig/suits/station.dm b/code/modules/clothing/spacesuits/rig/suits/station.dm
index b0c8838532..11dfbfb961 100644
--- a/code/modules/clothing/spacesuits/rig/suits/station.dm
+++ b/code/modules/clothing/spacesuits/rig/suits/station.dm
@@ -201,6 +201,7 @@
req_access = list(access_medical)
initial_modules = list(
+ /obj/item/rig_module/sprinter,
/obj/item/rig_module/chem_dispenser/injector,
/obj/item/rig_module/maneuvering_jets,
/obj/item/rig_module/device/healthscanner,
diff --git a/code/modules/clothing/under/xenos/vox.dm b/code/modules/clothing/under/xenos/vox.dm
index 9c1f3ce6b0..b29df92e8c 100644
--- a/code/modules/clothing/under/xenos/vox.dm
+++ b/code/modules/clothing/under/xenos/vox.dm
@@ -1,6 +1,8 @@
/obj/item/clothing/under/vox
has_sensor = 0
species_restricted = list("Vox")
+ valid_accessory_slots = list("vox")
+ restricted_accessory_slots = list("vox")
phoronproof = 1
/obj/item/clothing/under/vox/vox_casual
@@ -14,4 +16,18 @@
name = "alien robes"
desc = "Weird and flowing!"
icon_state = "vox-casual-2"
- item_state = "vox-casual-2"
\ No newline at end of file
+ item_state = "vox-casual-2"
+
+//Vox Accessories
+/obj/item/clothing/accessory/storage/vox
+ name = "alien mesh"
+ desc = "An alien mesh. Seems to be made up mostly of pockets and writhing flesh."
+ icon_state = "webbing-vox"
+ slot = "vox"
+
+ slots = 5
+
+/obj/item/clothing/accessory/storage/vox/New()
+ ..()
+ hold.max_storage_space = slots * ITEMSIZE_COST_NORMAL
+ hold.max_w_class = ITEMSIZE_NORMAL
\ No newline at end of file
diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm
index 1a89c9c0a4..edc796594c 100644
--- a/code/modules/hydroponics/grown.dm
+++ b/code/modules/hydroponics/grown.dm
@@ -52,9 +52,13 @@
var/list/reagent_data = seed.chems[rid]
if(reagent_data && reagent_data.len)
var/rtotal = reagent_data[1]
+ var/list/data = list()
if(reagent_data.len > 1 && potency > 0)
rtotal += round(potency/reagent_data[2])
- reagents.add_reagent(rid,max(1,rtotal))
+ if(rid == "nutriment")
+ data[seed.seed_name] = max(1,rtotal)
+
+ reagents.add_reagent(rid,max(1,rtotal),data)
update_desc()
if(reagents.total_volume > 0)
bitesize = 1+round(reagents.total_volume / 2, 1)
diff --git a/code/modules/integrated_electronics/_defines.dm b/code/modules/integrated_electronics/_defines.dm
index d9daa035d5..c404f61581 100644
--- a/code/modules/integrated_electronics/_defines.dm
+++ b/code/modules/integrated_electronics/_defines.dm
@@ -8,6 +8,13 @@
#define IC_SPAWN_DEFAULT 1 // If the circuit comes in the default circuit box.
#define IC_SPAWN_RESEARCH 2 // If the circuit design will be autogenerated for RnD.
+#define IC_FORMAT_STRING "\"
+#define IC_FORMAT_NUMBER "\"
+#define IC_FORMAT_REF "\["
+#define IC_FORMAT_LIST "\]"
+#define IC_FORMAT_ANY "\"
+#define IC_FORMAT_PULSE "\"
+
var/list/all_integrated_circuits = list()
/proc/initialize_integrated_circuits_list()
@@ -20,377 +27,19 @@ var/list/all_integrated_circuits = list()
icon = 'icons/obj/electronic_assemblies.dmi'
icon_state = "template"
w_class = ITEMSIZE_TINY
+ var/obj/item/device/electronic_assembly/assembly = null // Reference to the assembly holding this circuit, if any.
var/extended_desc = null
var/list/inputs = list()
var/list/outputs = list()
var/list/activators = list()
var/next_use = 0 //Uses world.time
- var/complexity = 1 //This acts as a limitation on building machines, more resource-intensive components cost more 'space'.
- var/cooldown_per_use = 1 SECOND
- var/spawn_flags = null // Used for world initializing, see the #defines above.
- var/category_text = "NO CATEGORY" // To show up on circuit printer, and perhaps other places.
- var/autopulse = -1 // When input is received, the circuit will pulse itself if set to 1. 0 means it won't. -1 means it is permanently off.
-
-/obj/item/integrated_circuit/examine(mob/user)
- ..()
- to_chat(user, "This board has [inputs.len] input pin\s and [outputs.len] output pin\s.")
- for(var/datum/integrated_io/input/I in inputs)
- if(I.linked.len)
- to_chat(user, "The [I] is connected to [I.get_linked_to_desc()].")
- for(var/datum/integrated_io/output/O in outputs)
- if(O.linked.len)
- to_chat(user, "The [O] is connected to [O.get_linked_to_desc()].")
- for(var/datum/integrated_io/activate/A in activators)
- if(A.linked.len)
- to_chat(user, "The [A] is connected to [A.get_linked_to_desc()].")
-
- interact(user)
-
-/obj/item/integrated_circuit/New()
- setup_io(inputs, /datum/integrated_io/input)
- setup_io(outputs, /datum/integrated_io/output)
- setup_io(activators, /datum/integrated_io/activate)
- ..()
-
-/obj/item/integrated_circuit/proc/setup_io(var/list/io_list, var/io_type)
- var/list/io_list_copy = io_list.Copy()
- io_list.Cut()
- for(var/io_entry in io_list_copy)
- io_list.Add(new io_type(src, io_entry, io_list_copy[io_entry]))
-
-/obj/item/integrated_circuit/proc/on_data_written() //Override this for special behaviour when new data gets pushed to the circuit.
- return
-
-/obj/item/integrated_circuit/Destroy()
- for(var/datum/integrated_io/I in inputs)
- qdel(I)
- for(var/datum/integrated_io/O in outputs)
- qdel(O)
- for(var/datum/integrated_io/A in activators)
- qdel(A)
- . = ..()
-
-/obj/item/integrated_circuit/nano_host()
- if(istype(src.loc, /obj/item/device/electronic_assembly))
- var/obj/item/device/electronic_assembly/assembly = loc
- return assembly.resolve_nano_host()
- return ..()
-
-/obj/item/integrated_circuit/emp_act(severity)
- for(var/datum/integrated_io/io in inputs + outputs + activators)
- io.scramble()
-
-/obj/item/integrated_circuit/verb/rename_component()
- set name = "Rename Circuit"
- set category = "Object"
- set desc = "Rename your circuit, useful to stay organized."
-
- var/mob/M = usr
- if(!CanInteract(M, physical_state))
- return
-
- var/input = sanitizeSafe(input("What do you want to name the circuit?", "Rename", src.name) as null|text, MAX_NAME_LEN)
- if(src && input && CanInteract(M, physical_state))
- to_chat(M, "The circuit '[src.name]' is now labeled '[input]'.")
- name = input
-
-/obj/item/integrated_circuit/proc/get_pin_ref(var/pin_type, var/pin_number)
- switch(pin_type)
- if(IC_INPUT)
- if(pin_number > inputs.len)
- return null
- return inputs[pin_number]
- if(IC_OUTPUT)
- if(pin_number > outputs.len)
- return null
- return outputs[pin_number]
- if(IC_ACTIVATOR)
- if(pin_number > activators.len)
- return null
- return activators[pin_number]
- return null
-
-/obj/item/integrated_circuit/interact(mob/user)
- if(!CanInteract(user, physical_state))
- return
-
- var/window_height = 350
- var/window_width = 600
-
- //var/table_edge_width = "[(window_width - window_width * 0.1) / 4]px"
- //var/table_middle_width = "[(window_width - window_width * 0.1) - (table_edge_width * 2)]px"
- var/table_edge_width = "30%"
- var/table_middle_width = "40%"
-
- var/HTML = list()
- HTML += "[src.name]"
- HTML += ""
- HTML += " "
-
- HTML += " \[Refresh\] | "
- HTML += "\[Rename\] | "
- HTML += "\[Remove\] "
-
- HTML += ""
- //HTML += ""
- //HTML += ""
- //HTML += ""
- HTML += ""
- HTML += ""
- HTML += ""
- HTML += ""
-
- var/column_width = 3
- var/row_height = max(inputs.len, outputs.len, 1)
-
- for(var/i = 1 to row_height)
- HTML += ""
- for(var/j = 1 to column_width)
- var/datum/integrated_io/io = null
- var/words = list()
- var/height = 1
- switch(j)
- if(1)
- io = get_pin_ref(IC_INPUT, i)
- if(io)
- if(io.linked.len)
- words += "[io.name] [io.display_data()] "
- for(var/datum/integrated_io/linked in io.linked)
- words += "\[[linked.name]\] \
- @ [linked.holder] "
- else
- words += "[io.name] [io.display_data()] "
- for(var/datum/integrated_io/linked in io.linked)
- words += "\[[linked.name]\] \
- @ [linked.holder] "
- if(outputs.len > inputs.len)
- height = 1
- if(2)
- if(i == 1)
- words += "[src.name]
[src.desc]"
- height = row_height
- else
- continue
- if(3)
- io = get_pin_ref(IC_OUTPUT, i)
- if(io)
- if(io.linked.len)
- words += "[io.name] [io.display_data()] "
- for(var/datum/integrated_io/linked in io.linked)
- words += "\[[linked.name]\] \
- @ [linked.holder] "
- else
- words += "[io.name] [io.display_data()] "
- for(var/datum/integrated_io/linked in io.linked)
- words += "\[[linked.name]\] \
- @ [linked.holder] "
- if(inputs.len > outputs.len)
- height = 1
- HTML += "[jointext(words, null)] | "
- HTML += " "
-
- for(var/activator in activators)
- var/datum/integrated_io/io = activator
- var/words = list()
- if(io.linked.len)
- words += "[io.name] "
- for(var/datum/integrated_io/linked in io.linked)
- words += "\[[linked.name]\] \
- @ [linked.holder] "
- else
- words += "[io.name] "
- for(var/datum/integrated_io/linked in io.linked)
- words += "\[[linked.name]\] \
- @ [linked.holder] "
- HTML += ""
- HTML += "| [jointext(words, null)] | "
- HTML += " "
-
- HTML += " "
- HTML += " "
-
- if(autopulse != -1)
- HTML += " Meta Variables;"
- HTML += " \[Autopulse\] = [autopulse ? "ON" : "OFF"]"
- HTML += " "
-
- HTML += " Complexity: [complexity]"
- HTML += " [extended_desc]"
-
- HTML += ""
- user << browse(jointext(HTML, null), "window=circuit-\ref[src];size=[window_width]x[window_height];border=1;can_resize=1;can_close=1;can_minimize=1")
-
- onclose(user, "circuit-\ref[src]")
-
-/obj/item/integrated_circuit/Topic(href, href_list, state = physical_state)
- if(..())
- return 1
- var/pin = locate(href_list["pin"]) in inputs + outputs + activators
-
- var/obj/held_item = usr.get_active_hand()
- if(href_list["wire"])
- if(istype(held_item, /obj/item/device/integrated_electronics/wirer))
- var/obj/item/device/integrated_electronics/wirer/wirer = held_item
- if(pin)
- wirer.wire(pin, usr)
-
- else if(istype(held_item, /obj/item/device/integrated_electronics/debugger))
- var/obj/item/device/integrated_electronics/debugger/debugger = held_item
- if(pin)
- debugger.write_data(pin, usr)
- else
- to_chat(usr, "You can't do a whole lot without the proper tools.")
-
- if(href_list["examine"])
- examine(usr)
-
- if(href_list["rename"])
- rename_component(usr)
-
- if(href_list["autopulse"])
- if(autopulse != -1)
- autopulse = !autopulse
-
- if(href_list["remove"])
- if(istype(held_item, /obj/item/weapon/screwdriver))
- disconnect_all()
- var/turf/T = get_turf(src)
- forceMove(T)
- playsound(T, 'sound/items/Crowbar.ogg', 50, 1)
- to_chat(usr, "You pop \the [src] out of the case, and slide it out.")
- else
- to_chat(usr, "You need a screwdriver to remove components.")
- var/obj/item/device/electronic_assembly/ea = loc
- if(istype(ea))
- ea.interact(usr)
- return
-
- interact(usr) // To refresh the UI.
-
-/datum/integrated_io
- var/name = "input/output"
- var/obj/item/integrated_circuit/holder = null
- var/weakref/data = null // This is a weakref, to reduce typecasts. Note that oftentimes numbers and text may also occupy this.
- var/list/linked = list()
- var/io_type = DATA_CHANNEL
-
-/datum/integrated_io/New(var/newloc, var/name, var/data)
- ..()
- src.name = name
- src.data = data
- holder = newloc
- if(!istype(holder))
- message_admins("ERROR: An integrated_io ([src.name]) spawned without a valid holder! This is a bug.")
-
-/datum/integrated_io/Destroy()
- disconnect()
- data = null
- holder = null
- . = ..()
-
-/datum/integrated_io/nano_host()
- return holder.nano_host()
+ var/complexity = 1 //This acts as a limitation on building machines, more resource-intensive components cost more 'space'.
+ var/cooldown_per_use = 1 SECOND // Circuits are limited in how many times they can be work()'d by this variable.
+ var/power_draw_per_use = 0 // How much power is drawn when work()'d.
+ var/power_draw_idle = 0 // How much power is drawn when doing nothing.
+ var/spawn_flags = null // Used for world initializing, see the #defines above.
+ var/category_text = "NO CATEGORY THIS IS A BUG" // To show up on circuit printer, and perhaps other places.
+ var/autopulse = -1 // When input is received, the circuit will pulse itself if set to 1. 0 means it won't. -1 means it is permanently off.
+ var/removable = TRUE // Determines if a circuit is removable from the assembly.
-/datum/integrated_io/proc/data_as_type(var/as_type)
- if(!isweakref(data))
- return
- var/weakref/w = data
- var/output = w.resolve()
- return istype(output, as_type) ? output : null
-
-/datum/integrated_io/proc/display_data()
- if(isnull(data))
- return "(null)" // Empty data means nothing to show.
- if(istext(data))
- return "(\"[data]\")" // Wraps the 'string' in escaped quotes, so that people know it's a 'string'.
- if(isweakref(data))
- var/weakref/w = data
- var/atom/A = w.resolve()
- //return A ? "([A.name] \[Ref\])" : "(null)" // For refs, we want just the name displayed.
- return A ? "(\ref[A] \[Ref\])" : "(null)"
- return "([data])" // Nothing special needed for numbers or other stuff.
-
-/datum/integrated_io/activate/display_data()
- return "(\[pulse\])"
-
-/datum/integrated_io/proc/scramble()
- if(isnull(data))
- return
- if(isnum(data))
- write_data_to_pin(rand(-10000, 10000))
- if(istext(data))
- write_data_to_pin("ERROR")
- push_data()
-
-/datum/integrated_io/activate/scramble()
- push_data()
-
-/datum/integrated_io/proc/write_data_to_pin(var/new_data)
- if(isnull(new_data) || isnum(new_data) || istext(new_data) || isweakref(new_data)) // Anything else is a type we don't want.
- data = new_data
- holder.on_data_written()
-
-/datum/integrated_io/proc/push_data()
- for(var/datum/integrated_io/io in linked)
- io.write_data_to_pin(data)
-
-/datum/integrated_io/activate/push_data()
- for(var/datum/integrated_io/io in linked)
- io.holder.check_then_do_work()
-
-/datum/integrated_io/proc/pull_data()
- for(var/datum/integrated_io/io in linked)
- write_data_to_pin(io.data)
-
-/datum/integrated_io/proc/get_linked_to_desc()
- if(linked.len)
- return "the [english_list(linked)]"
- return "nothing"
-
-/datum/integrated_io/proc/disconnect()
- //First we iterate over everything we are linked to.
- for(var/datum/integrated_io/their_io in linked)
- //While doing that, we iterate them as well, and disconnect ourselves from them.
- for(var/datum/integrated_io/their_linked_io in their_io.linked)
- if(their_linked_io == src)
- their_io.linked.Remove(src)
- else
- continue
- //Now that we're removed from them, we gotta remove them from us.
- src.linked.Remove(their_io)
-
-/datum/integrated_io/input
- name = "input pin"
-
-/datum/integrated_io/output
- name = "output pin"
-
-/datum/integrated_io/activate
- name = "activation pin"
- io_type = PULSE_CHANNEL
-
-/obj/item/integrated_circuit/proc/push_data()
- for(var/datum/integrated_io/output/O in outputs)
- O.push_data()
-
-/obj/item/integrated_circuit/proc/pull_data()
- for(var/datum/integrated_io/input/I in inputs)
- I.push_data()
-
-/obj/item/integrated_circuit/proc/check_then_do_work()
- if(world.time < next_use) // All intergrated circuits have an internal cooldown, to protect from spam.
- return
- next_use = world.time + cooldown_per_use
- do_work()
-
-/obj/item/integrated_circuit/proc/do_work()
- return
-
-/obj/item/integrated_circuit/proc/disconnect_all()
- for(var/datum/integrated_io/input/I in inputs)
- I.disconnect()
- for(var/datum/integrated_io/output/O in outputs)
- O.disconnect()
- for(var/datum/integrated_io/activate/A in activators)
- A.disconnect()
\ No newline at end of file
diff --git a/code/modules/integrated_electronics/assemblies.dm b/code/modules/integrated_electronics/core/assemblies.dm
similarity index 51%
rename from code/modules/integrated_electronics/assemblies.dm
rename to code/modules/integrated_electronics/core/assemblies.dm
index ff994aa43c..88b804f80a 100644
--- a/code/modules/integrated_electronics/assemblies.dm
+++ b/code/modules/integrated_electronics/core/assemblies.dm
@@ -11,6 +11,7 @@
var/max_components = IC_COMPONENTS_BASE
var/max_complexity = IC_COMPLEXITY_BASE
var/opened = 0
+ var/obj/item/weapon/cell/device/battery = null // Internal cell which most circuits need to work.
/obj/item/device/electronic_assembly/medium
name = "electronic mechanism"
@@ -23,8 +24,8 @@
name = "electronic machine"
icon_state = "setup_large"
w_class = ITEMSIZE_LARGE
- max_components = IC_COMPONENTS_BASE * 3
- max_complexity = IC_COMPLEXITY_BASE * 3
+ max_components = IC_COMPONENTS_BASE * 4
+ max_complexity = IC_COMPLEXITY_BASE * 4
/obj/item/device/electronic_assembly/drone
name = "electronic drone"
@@ -41,6 +42,32 @@
max_complexity = IC_COMPLEXITY_BASE / 2
var/obj/item/weapon/implant/integrated_circuit/implant = null
+/obj/item/device/electronic_assembly/New()
+ ..()
+ battery = new(src)
+ processing_objects |= src
+
+/obj/item/device/electronic_assembly/Destroy()
+ battery = null
+ processing_objects -= src
+ for(var/atom/movable/AM in contents)
+ qdel(AM)
+ ..()
+
+/obj/item/device/electronic_assembly/process()
+ handle_idle_power()
+
+/obj/item/device/electronic_assembly/proc/handle_idle_power()
+ // First we generate power.
+ for(var/obj/item/integrated_circuit/passive/power/P in contents)
+ P.make_energy()
+
+ // Now spend it.
+ for(var/obj/item/integrated_circuit/IC in contents)
+ if(IC.power_draw_idle)
+ if(!draw_power(IC.power_draw_idle))
+ IC.power_fail()
+
/obj/item/device/electronic_assembly/implant/update_icon()
..()
implant.icon_state = icon_state
@@ -70,13 +97,18 @@
HTML += " \[Refresh\] | "
HTML += "\[Rename\] "
HTML += "[total_parts]/[max_components] ([round((total_parts / max_components) * 100, 0.1)]%) space taken up in the assembly. "
- HTML += "[total_complexity]/[max_complexity] ([round((total_complexity / max_complexity) * 100, 0.1)]%) maximum complexity."
+ HTML += "[total_complexity]/[max_complexity] ([round((total_complexity / max_complexity) * 100, 0.1)]%) maximum complexity. "
+ if(battery)
+ HTML += "[round(battery.charge, 0.1)]/[battery.maxcharge] ([round(battery.percent(), 0.1)]%) cell charge. \[Remove\]"
+ else
+ HTML += "No powercell detected!"
HTML += "
"
HTML += "Components; "
for(var/obj/item/integrated_circuit/circuit in contents)
HTML += "[circuit.name] | "
HTML += "\[Rename\] | "
- HTML += "\[Remove\]"
+ if(circuit.removable)
+ HTML += "\[Remove\]"
HTML += " "
HTML += " |