Merge pull request #8082 from Kelenius/ofMachinesAndParts

Update for machine upgrades and some science
This commit is contained in:
Chinsky
2015-02-10 23:24:19 +03:00
27 changed files with 1239 additions and 1043 deletions

View File

@@ -632,9 +632,11 @@
#include "code\game\objects\items\weapons\circuitboards\computer\research.dm" #include "code\game\objects\items\weapons\circuitboards\computer\research.dm"
#include "code\game\objects\items\weapons\circuitboards\computer\supply.dm" #include "code\game\objects\items\weapons\circuitboards\computer\supply.dm"
#include "code\game\objects\items\weapons\circuitboards\computer\telecomms.dm" #include "code\game\objects\items\weapons\circuitboards\computer\telecomms.dm"
#include "code\game\objects\items\weapons\circuitboards\machinery\biogenerator.dm"
#include "code\game\objects\items\weapons\circuitboards\machinery\cloning.dm" #include "code\game\objects\items\weapons\circuitboards\machinery\cloning.dm"
#include "code\game\objects\items\weapons\circuitboards\machinery\pacman.dm" #include "code\game\objects\items\weapons\circuitboards\machinery\pacman.dm"
#include "code\game\objects\items\weapons\circuitboards\machinery\power.dm" #include "code\game\objects\items\weapons\circuitboards\machinery\power.dm"
#include "code\game\objects\items\weapons\circuitboards\machinery\recharge_station.dm"
#include "code\game\objects\items\weapons\circuitboards\machinery\research.dm" #include "code\game\objects\items\weapons\circuitboards\machinery\research.dm"
#include "code\game\objects\items\weapons\circuitboards\machinery\shieldgen.dm" #include "code\game\objects\items\weapons\circuitboards\machinery\shieldgen.dm"
#include "code\game\objects\items\weapons\circuitboards\machinery\telecomms.dm" #include "code\game\objects\items\weapons\circuitboards\machinery\telecomms.dm"

View File

@@ -7,52 +7,47 @@
icon = 'icons/obj/Cryogenic2.dmi' icon = 'icons/obj/Cryogenic2.dmi'
icon_state = "freezer_0" icon_state = "freezer_0"
density = 1 density = 1
anchored = 1
anchored = 1.0
var/heatsink_temperature = T20C //the constant temperature resevoir into which the freezer pumps heat. Probably the hull of the station or something.
var/internal_volume = 600 //L
use_power = 0 use_power = 0
idle_power_usage = 5 //5 Watts for thermostat related circuitry idle_power_usage = 5 // 5 Watts for thermostat related circuitry
var/max_power_rating = 20000 //power rating when the usage is turned up to 100 var/heatsink_temperature = T20C // The constant temperature reservoir into which the freezer pumps heat. Probably the hull of the station or something.
var/internal_volume = 600 // L
var/max_power_rating = 20000 // Power rating when the usage is turned up to 100
var/power_setting = 100 var/power_setting = 100
var/set_temperature = T20C //thermostat var/set_temperature = T20C // Thermostat
var/cooling = 0 var/cooling = 0
var/opened = 0 //for deconstruction
/obj/machinery/atmospherics/unary/freezer/New() /obj/machinery/atmospherics/unary/freezer/New()
..() ..()
air_contents.volume = internal_volume
initialize_directions = dir initialize_directions = dir
component_parts = list() component_parts = list()
component_parts += new /obj/item/weapon/circuitboard/unary_atmos/cooler(src) component_parts += new /obj/item/weapon/circuitboard/unary_atmos/cooler(src)
component_parts += new /obj/item/weapon/stock_parts/matter_bin(src) component_parts += new /obj/item/weapon/stock_parts/matter_bin(src)
component_parts += new /obj/item/weapon/stock_parts/capacitor(src) component_parts += new /obj/item/weapon/stock_parts/capacitor(src)
component_parts += new /obj/item/weapon/stock_parts/capacitor(src) component_parts += new /obj/item/weapon/stock_parts/capacitor(src)
component_parts += new /obj/item/weapon/stock_parts/manipulator(src) component_parts += new /obj/item/weapon/stock_parts/manipulator(src)
component_parts += new /obj/item/stack/cable_coil(src, 2)
power_rating = max_power_rating * (power_setting/100) RefreshParts()
/obj/machinery/atmospherics/unary/freezer/initialize() /obj/machinery/atmospherics/unary/freezer/initialize()
if(node) return if(node)
return
var/node_connect = dir var/node_connect = dir
for(var/obj/machinery/atmospherics/target in get_step(src,node_connect)) for(var/obj/machinery/atmospherics/target in get_step(src, node_connect))
if(target.initialize_directions & get_dir(target,src)) if(target.initialize_directions & get_dir(target, src))
node = target node = target
break break
update_icon() update_icon()
/obj/machinery/atmospherics/unary/freezer/update_icon() /obj/machinery/atmospherics/unary/freezer/update_icon()
if(src.node) if(node)
if(src.use_power && cooling) if(use_power && cooling)
icon_state = "freezer_1" icon_state = "freezer_1"
else else
icon_state = "freezer" icon_state = "freezer"
@@ -61,10 +56,10 @@
return return
/obj/machinery/atmospherics/unary/freezer/attack_ai(mob/user as mob) /obj/machinery/atmospherics/unary/freezer/attack_ai(mob/user as mob)
src.ui_interact(user) ui_interact(user)
/obj/machinery/atmospherics/unary/freezer/attack_hand(mob/user as mob) /obj/machinery/atmospherics/unary/freezer/attack_hand(mob/user as mob)
src.ui_interact(user) ui_interact(user)
/obj/machinery/atmospherics/unary/freezer/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) /obj/machinery/atmospherics/unary/freezer/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
// this is the data which will be sent to the ui // this is the data which will be sent to the ui
@@ -78,15 +73,15 @@
data["powerSetting"] = power_setting data["powerSetting"] = power_setting
var/temp_class = "good" var/temp_class = "good"
if (air_contents.temperature > (T0C - 20)) if(air_contents.temperature > (T0C - 20))
temp_class = "bad" temp_class = "bad"
else if (air_contents.temperature < (T0C - 20) && air_contents.temperature > (T0C - 100)) else if(air_contents.temperature < (T0C - 20) && air_contents.temperature > (T0C - 100))
temp_class = "average" temp_class = "average"
data["gasTemperatureClass"] = temp_class data["gasTemperatureClass"] = temp_class
// update the ui if it exists, returns null if no ui is passed/found // update the ui if it exists, returns null if no ui is passed/found
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui) if(!ui)
// the ui does not exist, so we'll create a new() one // the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm // for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "freezer.tmpl", "Gas Cooling System", 440, 300) ui = new(user, src, ui_key, "freezer.tmpl", "Gas Cooling System", 440, 300)
@@ -98,30 +93,31 @@
ui.set_auto_update(1) ui.set_auto_update(1)
/obj/machinery/atmospherics/unary/freezer/Topic(href, href_list) /obj/machinery/atmospherics/unary/freezer/Topic(href, href_list)
if (href_list["toggleStatus"]) if(href_list["toggleStatus"])
src.use_power = !src.use_power use_power = !use_power
update_icon() update_icon()
if(href_list["temp"]) if(href_list["temp"])
var/amount = text2num(href_list["temp"]) var/amount = text2num(href_list["temp"])
if(amount > 0) if(amount > 0)
src.set_temperature = min(src.set_temperature+amount, 1000) set_temperature = min(set_temperature + amount, 1000)
else else
src.set_temperature = max(src.set_temperature+amount, 0) set_temperature = max(set_temperature + amount, 0)
if(href_list["setPower"]) //setting power to 0 is redundant anyways if(href_list["setPower"]) //setting power to 0 is redundant anyways
var/new_setting = between(0, text2num(href_list["setPower"]), 100) var/new_setting = between(0, text2num(href_list["setPower"]), 100)
set_power_level(new_setting) set_power_level(new_setting)
src.add_fingerprint(usr) add_fingerprint(usr)
return 1 return 1
/obj/machinery/atmospherics/unary/freezer/process() /obj/machinery/atmospherics/unary/freezer/process()
..() ..()
if(stat & (NOPOWER|BROKEN) || !use_power) if(stat & (NOPOWER|BROKEN) || !use_power)
cooling = 0 cooling = 0
update_icon() update_icon()
return return
if (network && air_contents.temperature > set_temperature) if(network && air_contents.temperature > set_temperature)
cooling = 1 cooling = 1
var/heat_transfer = max( -air_contents.get_thermal_energy_change(set_temperature - 5), 0 ) var/heat_transfer = max( -air_contents.get_thermal_energy_change(set_temperature - 5), 0 )
@@ -132,7 +128,7 @@
heat_transfer = min(heat_transfer, cop * power_rating) //limit heat transfer by available power heat_transfer = min(heat_transfer, cop * power_rating) //limit heat transfer by available power
var/removed = -air_contents.add_thermal_energy(-heat_transfer) //remove the heat var/removed = -air_contents.add_thermal_energy(-heat_transfer) //remove the heat
if (debug) if(debug)
visible_message("[src]: Removing [removed] W.") visible_message("[src]: Removing [removed] W.")
use_power(power_rating) use_power(power_rating)
@@ -147,49 +143,37 @@
/obj/machinery/atmospherics/unary/freezer/RefreshParts() /obj/machinery/atmospherics/unary/freezer/RefreshParts()
..() ..()
var/cap_rating = 0 var/cap_rating = 0
var/cap_count = 0
var/manip_rating = 0 var/manip_rating = 0
var/manip_count = 0
var/bin_rating = 0 var/bin_rating = 0
var/bin_count = 0
for(var/obj/item/weapon/stock_parts/P in component_parts) for(var/obj/item/weapon/stock_parts/P in component_parts)
if(istype(P, /obj/item/weapon/stock_parts/capacitor)) if(istype(P, /obj/item/weapon/stock_parts/capacitor))
cap_rating += P.rating cap_rating += P.rating
cap_count++
if(istype(P, /obj/item/weapon/stock_parts/manipulator)) if(istype(P, /obj/item/weapon/stock_parts/manipulator))
manip_rating += P.rating manip_rating += P.rating
manip_count++
if(istype(P, /obj/item/weapon/stock_parts/matter_bin)) if(istype(P, /obj/item/weapon/stock_parts/matter_bin))
bin_rating += P.rating bin_rating += P.rating
bin_count++
cap_rating /= cap_count
bin_rating /= bin_count
manip_rating /= manip_count
power_rating = initial(power_rating)*cap_rating //more powerful power_rating = initial(power_rating) * cap_rating / 2 //more powerful
heatsink_temperature = initial(heatsink_temperature)/((manip_rating+bin_rating)/2) //more efficient heatsink_temperature = initial(heatsink_temperature) / ((manip_rating + bin_rating) / 2) //more efficient
air_contents.volume = max(initial(internal_volume) - 200, 0) + 200*bin_rating air_contents.volume = max(initial(internal_volume) - 200, 0) + 200 * bin_rating
set_power_level(power_setting) set_power_level(power_setting)
/obj/machinery/atmospherics/unary/freezer/proc/set_power_level(var/new_power_setting) /obj/machinery/atmospherics/unary/freezer/proc/set_power_level(var/new_power_setting)
power_setting = new_power_setting power_setting = new_power_setting
power_rating = max_power_rating * (power_setting/100) power_rating = max_power_rating * (power_setting/100)
//dismantling code. copied from autolathe
/obj/machinery/atmospherics/unary/freezer/attackby(var/obj/item/O as obj, var/mob/user as mob) /obj/machinery/atmospherics/unary/freezer/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(istype(O, /obj/item/weapon/screwdriver)) if(default_deconstruction_screwdriver(user, O))
opened = !opened
user << "You [opened ? "open" : "close"] the maintenance hatch of [src]."
return return
if(default_deconstruction_crowbar(user, O))
if (opened && istype(O, /obj/item/weapon/crowbar)) return
dismantle() if(default_part_replacement(user, O))
return return
..() ..()
/obj/machinery/atmospherics/unary/freezer/examine(mob/user) /obj/machinery/atmospherics/unary/freezer/examine(mob/user)
..(user) ..(user)
if (opened) if(panel_open)
user << "The maintenance hatch is open." user << "The maintenance hatch is open."

View File

@@ -7,25 +7,21 @@
icon = 'icons/obj/Cryogenic2.dmi' icon = 'icons/obj/Cryogenic2.dmi'
icon_state = "heater_0" icon_state = "heater_0"
density = 1 density = 1
anchored = 1
anchored = 1.0
var/set_temperature = T20C //thermostat
var/max_temperature = T20C + 680
var/internal_volume = 600 //L
use_power = 0 use_power = 0
idle_power_usage = 5 //5 Watts for thermostat related circuitry idle_power_usage = 5 //5 Watts for thermostat related circuitry
var/max_temperature = T20C + 680
var/internal_volume = 600 //L
var/max_power_rating = 20000 //power rating when the usage is turned up to 100 var/max_power_rating = 20000 //power rating when the usage is turned up to 100
var/power_setting = 100 var/power_setting = 100
var/set_temperature = T20C //thermostat
var/heating = 0 //mainly for icon updates var/heating = 0 //mainly for icon updates
var/opened = 0 //for deconstruction
/obj/machinery/atmospherics/unary/heater/New() /obj/machinery/atmospherics/unary/heater/New()
..() ..()
air_contents.volume = internal_volume
initialize_directions = dir initialize_directions = dir
component_parts = list() component_parts = list()
@@ -33,16 +29,18 @@
component_parts += new /obj/item/weapon/stock_parts/matter_bin(src) component_parts += new /obj/item/weapon/stock_parts/matter_bin(src)
component_parts += new /obj/item/weapon/stock_parts/capacitor(src) component_parts += new /obj/item/weapon/stock_parts/capacitor(src)
component_parts += new /obj/item/weapon/stock_parts/capacitor(src) component_parts += new /obj/item/weapon/stock_parts/capacitor(src)
component_parts += new /obj/item/stack/cable_coil(src, 5)
power_rating = max_power_rating * (power_setting/100) RefreshParts()
/obj/machinery/atmospherics/unary/heater/initialize() /obj/machinery/atmospherics/unary/heater/initialize()
if(node) return if(node)
return
var/node_connect = dir var/node_connect = dir
for(var/obj/machinery/atmospherics/target in get_step(src,node_connect)) for(var/obj/machinery/atmospherics/target in get_step(src, node_connect))
if(target.initialize_directions & get_dir(target,src)) if(target.initialize_directions & get_dir(target, src))
node = target node = target
break break
@@ -50,8 +48,8 @@
/obj/machinery/atmospherics/unary/heater/update_icon() /obj/machinery/atmospherics/unary/heater/update_icon()
if(src.node) if(node)
if(src.use_power && src.heating) if(use_power && heating)
icon_state = "heater_1" icon_state = "heater_1"
else else
icon_state = "heater" icon_state = "heater"
@@ -68,7 +66,7 @@
update_icon() update_icon()
return return
if (network && air_contents.total_moles && air_contents.temperature < set_temperature) if(network && air_contents.total_moles && air_contents.temperature < set_temperature)
air_contents.add_thermal_energy(power_rating * HEATER_PERF_MULT) air_contents.add_thermal_energy(power_rating * HEATER_PERF_MULT)
use_power(power_rating) use_power(power_rating)
@@ -80,10 +78,10 @@
update_icon() update_icon()
/obj/machinery/atmospherics/unary/heater/attack_ai(mob/user as mob) /obj/machinery/atmospherics/unary/heater/attack_ai(mob/user as mob)
src.ui_interact(user) ui_interact(user)
/obj/machinery/atmospherics/unary/heater/attack_hand(mob/user as mob) /obj/machinery/atmospherics/unary/heater/attack_hand(mob/user as mob)
src.ui_interact(user) ui_interact(user)
/obj/machinery/atmospherics/unary/heater/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) /obj/machinery/atmospherics/unary/heater/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
// this is the data which will be sent to the ui // this is the data which will be sent to the ui
@@ -97,13 +95,13 @@
data["powerSetting"] = power_setting data["powerSetting"] = power_setting
var/temp_class = "normal" var/temp_class = "normal"
if (air_contents.temperature > (T20C+40)) if(air_contents.temperature > (T20C+40))
temp_class = "bad" temp_class = "bad"
data["gasTemperatureClass"] = temp_class data["gasTemperatureClass"] = temp_class
// update the ui if it exists, returns null if no ui is passed/found // update the ui if it exists, returns null if no ui is passed/found
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui) if(!ui)
// the ui does not exist, so we'll create a new() one // the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm // for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "freezer.tmpl", "Gas Heating System", 440, 300) ui = new(user, src, ui_key, "freezer.tmpl", "Gas Heating System", 440, 300)
@@ -115,63 +113,54 @@
ui.set_auto_update(1) ui.set_auto_update(1)
/obj/machinery/atmospherics/unary/heater/Topic(href, href_list) /obj/machinery/atmospherics/unary/heater/Topic(href, href_list)
if (href_list["toggleStatus"]) if(href_list["toggleStatus"])
src.use_power = !src.use_power use_power = !use_power
update_icon() update_icon()
if(href_list["temp"]) if(href_list["temp"])
var/amount = text2num(href_list["temp"]) var/amount = text2num(href_list["temp"])
if(amount > 0) if(amount > 0)
src.set_temperature = min(src.set_temperature+amount, max_temperature) set_temperature = min(set_temperature + amount, max_temperature)
else else
src.set_temperature = max(src.set_temperature+amount, 0) set_temperature = max(set_temperature + amount, 0)
if(href_list["setPower"]) //setting power to 0 is redundant anyways if(href_list["setPower"]) //setting power to 0 is redundant anyways
var/new_setting = between(0, text2num(href_list["setPower"]), 100) var/new_setting = between(0, text2num(href_list["setPower"]), 100)
set_power_level(new_setting) set_power_level(new_setting)
src.add_fingerprint(usr) add_fingerprint(usr)
return 1 return 1
//upgrading parts //upgrading parts
/obj/machinery/atmospherics/unary/heater/RefreshParts() /obj/machinery/atmospherics/unary/heater/RefreshParts()
..() ..()
var/cap_rating = 0 var/cap_rating = 0
var/cap_count = 0
var/bin_rating = 0 var/bin_rating = 0
var/bin_count = 0
for(var/obj/item/weapon/stock_parts/P in component_parts) for(var/obj/item/weapon/stock_parts/P in component_parts)
if(istype(P, /obj/item/weapon/stock_parts/capacitor)) if(istype(P, /obj/item/weapon/stock_parts/capacitor))
cap_rating += P.rating cap_rating += P.rating
cap_count++
if(istype(P, /obj/item/weapon/stock_parts/matter_bin)) if(istype(P, /obj/item/weapon/stock_parts/matter_bin))
bin_rating += P.rating bin_rating += P.rating
bin_count++
cap_rating /= cap_count
bin_rating /= bin_count
max_power_rating = initial(max_power_rating)*cap_rating max_power_rating = initial(max_power_rating) * cap_rating / 2
max_temperature = max(initial(max_temperature) - T20C, 0)*((bin_rating*2 + cap_rating)/3) + T20C max_temperature = max(initial(max_temperature) - T20C, 0) * ((bin_rating * 4 + cap_rating) / 5) + T20C
air_contents.volume = max(initial(internal_volume) - 200, 0) + 200*bin_rating air_contents.volume = max(initial(internal_volume) - 200, 0) + 200 * bin_rating
set_power_level(power_setting) set_power_level(power_setting)
/obj/machinery/atmospherics/unary/heater/proc/set_power_level(var/new_power_setting) /obj/machinery/atmospherics/unary/heater/proc/set_power_level(var/new_power_setting)
power_setting = new_power_setting power_setting = new_power_setting
power_rating = max_power_rating * (power_setting/100) power_rating = max_power_rating * (power_setting/100)
//dismantling code. copied from autolathe
/obj/machinery/atmospherics/unary/heater/attackby(var/obj/item/O as obj, var/mob/user as mob) /obj/machinery/atmospherics/unary/heater/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(istype(O, /obj/item/weapon/screwdriver)) if(default_deconstruction_screwdriver(user, O))
opened = !opened
user << "You [opened ? "open" : "close"] the maintenance hatch of [src]."
return return
if(default_deconstruction_crowbar(user, O))
if (opened && istype(O, /obj/item/weapon/crowbar)) return
dismantle() if(default_part_replacement(user, O))
return return
..() ..()
/obj/machinery/atmospherics/unary/heater/examine(mob/user) /obj/machinery/atmospherics/unary/heater/examine(mob/user)
..(user) ..(user)
if (opened) if(panel_open)
user << "The maintenance hatch is open." user << "The maintenance hatch is open."

View File

@@ -395,6 +395,22 @@
///////////////////////////////////////Stock Parts ///////////////////////////////// ///////////////////////////////////////Stock Parts /////////////////////////////////
/obj/item/weapon/storage/part_replacer
name = "rapid part exchange device"
desc = "Special mechanical module made to store, sort, and apply standard machine parts."
icon_state = "RPED"
item_state = "RPED"
w_class = 5
can_hold = list("/obj/item/weapon/stock_parts")
storage_slots = 50
use_to_pickup = 1
allow_quick_gather = 1
allow_quick_empty = 1
collection_mode = 1
display_contents_with_number = 1
max_w_class = 3
max_combined_w_class = 100
/obj/item/weapon/stock_parts /obj/item/weapon/stock_parts
name = "stock part" name = "stock part"
desc = "What?" desc = "What?"

View File

@@ -13,14 +13,30 @@
var/list/storage_capacity = list("metal" = 0, "glass" = 0) var/list/storage_capacity = list("metal" = 0, "glass" = 0)
var/show_category = "All" var/show_category = "All"
var/panel_open = 0
var/hacked = 0 var/hacked = 0
var/disabled = 0 var/disabled = 0
var/shocked = 0 var/shocked = 0
var/busy = 0 var/busy = 0
var/mat_efficiency = 1
var/build_time = 50
var/datum/wires/autolathe/wires = null var/datum/wires/autolathe/wires = null
/obj/machinery/autolathe/New()
..()
wires = new(src)
//Create parts for lathe.
component_parts = list()
component_parts += new /obj/item/weapon/circuitboard/autolathe(src)
component_parts += new /obj/item/weapon/stock_parts/matter_bin(src)
component_parts += new /obj/item/weapon/stock_parts/matter_bin(src)
component_parts += new /obj/item/weapon/stock_parts/matter_bin(src)
component_parts += new /obj/item/weapon/stock_parts/manipulator(src)
component_parts += new /obj/item/weapon/stock_parts/console_screen(src)
RefreshParts()
/obj/machinery/autolathe/proc/update_recipe_list() /obj/machinery/autolathe/proc/update_recipe_list()
if(!machine_recipes) if(!machine_recipes)
machine_recipes = autolathe_recipes machine_recipes = autolathe_recipes
@@ -33,8 +49,8 @@
user << "<span class='danger'>\The [src] is disabled!</span>" user << "<span class='danger'>\The [src] is disabled!</span>"
return return
if (shocked) if(shocked)
shock(user,50) shock(user, 50)
var/dat = "<center><h1>Autolathe Control Panel</h1><hr/>" var/dat = "<center><h1>Autolathe Control Panel</h1><hr/>"
@@ -65,16 +81,16 @@
else else
//Make sure it's buildable and list requires resources. //Make sure it's buildable and list requires resources.
for(var/material in R.resources) for(var/material in R.resources)
var/sheets = round(stored_material[material]/R.resources[material]) var/sheets = round(stored_material[material]/round(R.resources[material]*mat_efficiency))
if(isnull(max_sheets) || max_sheets > sheets) if(isnull(max_sheets) || max_sheets > sheets)
max_sheets = sheets max_sheets = sheets
if(!isnull(stored_material[material]) && stored_material[material] < R.resources[material]) if(!isnull(stored_material[material]) && stored_material[material] < round(R.resources[material]*mat_efficiency))
can_make = 0 can_make = 0
if(!comma) if(!comma)
comma = 1 comma = 1
else else
material_string += ", " material_string += ", "
material_string += "[R.resources[material]] [material]" material_string += "[round(R.resources[material] * mat_efficiency)] [material]"
material_string += ".<br></td>" material_string += ".<br></td>"
//Build list of multipliers for sheets. //Build list of multipliers for sheets.
if(R.is_stack) if(R.is_stack)
@@ -99,31 +115,27 @@
/obj/machinery/autolathe/attackby(var/obj/item/O as obj, var/mob/user as mob) /obj/machinery/autolathe/attackby(var/obj/item/O as obj, var/mob/user as mob)
if (stat) if(busy)
return
if (busy)
user << "<span class='notice'>\The [src] is busy. Please wait for completion of previous operation.</span>" user << "<span class='notice'>\The [src] is busy. Please wait for completion of previous operation.</span>"
return return
if(istype(O, /obj/item/weapon/screwdriver)) if(default_deconstruction_screwdriver(user, O))
panel_open = !panel_open
icon_state = (panel_open ? "autolathe_t": "autolathe")
user << "You [panel_open ? "open" : "close"] the maintenance hatch of [src]."
updateUsrDialog() updateUsrDialog()
return return
if(default_deconstruction_crowbar(user, O))
return
if(default_part_replacement(user, O))
return
if (panel_open) if(stat)
return
if(panel_open)
//Don't eat multitools or wirecutters used on an open lathe. //Don't eat multitools or wirecutters used on an open lathe.
if(istype(O, /obj/item/device/multitool) || istype(O, /obj/item/weapon/wirecutters)) if(istype(O, /obj/item/device/multitool) || istype(O, /obj/item/weapon/wirecutters))
attack_hand(user) attack_hand(user)
return return
//Dismantle the frame.
if(istype(O, /obj/item/weapon/crowbar))
dismantle()
return
if(O.loc != user && !(istype(O,/obj/item/stack))) if(O.loc != user && !(istype(O,/obj/item/stack)))
return 0 return 0
@@ -170,11 +182,11 @@
else else
user << "You fill \the [src] with \the [eating]." user << "You fill \the [src] with \the [eating]."
flick("autolathe_o",src) // Plays metal insertion animation. Work out a good way to work out a fitting animation. ~Z flick("autolathe_o", src) // Plays metal insertion animation. Work out a good way to work out a fitting animation. ~Z
if(istype(eating,/obj/item/stack)) if(istype(eating,/obj/item/stack))
var/obj/item/stack/stack = eating var/obj/item/stack/stack = eating
stack.use(max(1,round(total_used/mass_per_sheet))) // Always use at least 1 to prevent infinite materials. stack.use(max(1, round(total_used/mass_per_sheet))) // Always use at least 1 to prevent infinite materials.
else else
user.drop_item(O) user.drop_item(O)
del(O) del(O)
@@ -227,18 +239,18 @@
//Check if we still have the materials. //Check if we still have the materials.
for(var/material in making.resources) for(var/material in making.resources)
if(!isnull(stored_material[material])) if(!isnull(stored_material[material]))
if(stored_material[material] < (making.resources[material]*multiplier)) if(stored_material[material] < round(making.resources[material] * mat_efficiency) * multiplier)
return return
//Consume materials. //Consume materials.
for(var/material in making.resources) for(var/material in making.resources)
if(!isnull(stored_material[material])) if(!isnull(stored_material[material]))
stored_material[material] = max(0,stored_material[material]-(making.resources[material]*multiplier)) stored_material[material] = max(0, stored_material[material] - round(making.resources[material] * mat_efficiency) * multiplier)
//Fancy autolathe animation. //Fancy autolathe animation.
flick("autolathe_n",src) flick("autolathe_n", src)
sleep(50) sleep(build_time)
busy = 0 busy = 0
@@ -247,39 +259,31 @@
//Create the desired item. //Create the desired item.
var/obj/item/I = new making.path(get_step(loc, get_dir(src,usr))) var/obj/item/I = new making.path(get_step(loc, get_dir(src,usr)))
if(multiplier>1 && istype(I,/obj/item/stack)) if(multiplier > 1 && istype(I, /obj/item/stack))
var/obj/item/stack/S = I var/obj/item/stack/S = I
S.amount = multiplier S.amount = multiplier
updateUsrDialog() updateUsrDialog()
/obj/machinery/autolathe/update_icon()
/obj/machinery/autolathe/New() icon_state = (panel_open ? "autolathe_t" : "autolathe")
..()
wires = new(src)
//Create parts for lathe.
component_parts = list()
component_parts += new /obj/item/weapon/circuitboard/autolathe(src)
component_parts += new /obj/item/weapon/stock_parts/matter_bin(src)
component_parts += new /obj/item/weapon/stock_parts/matter_bin(src)
component_parts += new /obj/item/weapon/stock_parts/matter_bin(src)
component_parts += new /obj/item/weapon/stock_parts/manipulator(src)
component_parts += new /obj/item/weapon/stock_parts/console_screen(src)
RefreshParts()
//Updates overall lathe storage size. //Updates overall lathe storage size.
/obj/machinery/autolathe/RefreshParts() /obj/machinery/autolathe/RefreshParts()
..() ..()
var/tot_rating = 0 var/mb_rating = 0
var/man_rating = 0
for(var/obj/item/weapon/stock_parts/matter_bin/MB in component_parts) for(var/obj/item/weapon/stock_parts/matter_bin/MB in component_parts)
tot_rating += MB.rating mb_rating += MB.rating
for(var/obj/item/weapon/stock_parts/manipulator/M in component_parts)
man_rating += M.rating
storage_capacity["metal"] = tot_rating * 25000 storage_capacity["metal"] = mb_rating * 25000
storage_capacity["glass"] = tot_rating * 12500 storage_capacity["glass"] = mb_rating * 12500
build_time = 50 / man_rating
mat_efficiency = 1.1 - man_rating * 0.1// Normally, price is 1.25 the amount of material, so this shouldn't go higher than 0.8. Maximum rating of parts is 3
/obj/machinery/autolathe/dismantle() /obj/machinery/autolathe/dismantle()
..()
var/list/sheets = list("metal" = /obj/item/stack/sheet/metal, "glass" = /obj/item/stack/sheet/glass) var/list/sheets = list("metal" = /obj/item/stack/sheet/metal, "glass" = /obj/item/stack/sheet/glass)
for(var/mat in stored_material) for(var/mat in stored_material)
@@ -288,3 +292,4 @@
if(stored_material[mat] > S.perunit) if(stored_material[mat] > S.perunit)
S.amount = round(stored_material[mat] / S.perunit) S.amount = round(stored_material[mat] / S.perunit)
S.loc = loc S.loc = loc
..()

View File

@@ -15,7 +15,7 @@
if(I.matter && !recipe.resources) //This can be overidden in the datums. if(I.matter && !recipe.resources) //This can be overidden in the datums.
recipe.resources = list() recipe.resources = list()
for(var/material in I.matter) for(var/material in I.matter)
recipe.resources[material] = round(I.matter[material]*1.25) // More expensive to produce than they are to recycle. recipe.resources[material] = I.matter[material]*1.25 // More expensive to produce than they are to recycle.
del(I) del(I)
/datum/autolathe/recipe /datum/autolathe/recipe

View File

@@ -13,7 +13,6 @@
var/c_tag_order = 999 var/c_tag_order = 999
var/status = 1 var/status = 1
anchored = 1.0 anchored = 1.0
var/panel_open = 0 // 0 = Closed / 1 = Open
var/invuln = null var/invuln = null
var/bugged = 0 var/bugged = 0
var/obj/item/weapon/camera_assembly/assembly = null var/obj/item/weapon/camera_assembly/assembly = null
@@ -57,7 +56,7 @@
/obj/machinery/camera/Del() /obj/machinery/camera/Del()
if(!alarm_on) if(!alarm_on)
triggerCameraAlarm() triggerCameraAlarm()
cancelCameraAlarm() cancelCameraAlarm()
..() ..()
@@ -70,7 +69,7 @@
kick_viewers() kick_viewers()
triggerCameraAlarm() triggerCameraAlarm()
update_icon() update_icon()
spawn(900) spawn(900)
stat &= ~EMPED stat &= ~EMPED
cancelCameraAlarm() cancelCameraAlarm()
@@ -85,11 +84,11 @@
/obj/machinery/camera/ex_act(severity) /obj/machinery/camera/ex_act(severity)
if(src.invuln) if(src.invuln)
return return
//camera dies if an explosion touches it! //camera dies if an explosion touches it!
if(severity <= 2 || prob(50)) if(severity <= 2 || prob(50))
destroy() destroy()
..() //and give it the regular chance of being deleted outright ..() //and give it the regular chance of being deleted outright
@@ -174,7 +173,7 @@
if (S.current == src) if (S.current == src)
O << "[U] holds \a [itemname] up to one of the cameras ..." O << "[U] holds \a [itemname] up to one of the cameras ..."
O << browse(text("<HTML><HEAD><TITLE>[]</TITLE></HEAD><BODY><TT>[]</TT></BODY></HTML>", itemname, info), text("window=[]", itemname)) O << browse(text("<HTML><HEAD><TITLE>[]</TITLE></HEAD><BODY><TT>[]</TT></BODY></HTML>", itemname, info), text("window=[]", itemname))
else if (istype(W, /obj/item/weapon/camera_bug)) else if (istype(W, /obj/item/weapon/camera_bug))
if (!src.can_use()) if (!src.can_use())
user << "\blue Camera non-functional" user << "\blue Camera non-functional"
@@ -185,7 +184,7 @@
else else
user << "\blue Camera bugged." user << "\blue Camera bugged."
src.bugged = 1 src.bugged = 1
else if(W.damtype == BRUTE || W.damtype == BURN) //bashing cameras else if(W.damtype == BRUTE || W.damtype == BURN) //bashing cameras
if (W.force >= src.toughness) if (W.force >= src.toughness)
visible_message("<span class='warning'><b>[src] has been [pick(W.attack_verb)] with [W] by [user]!</b></span>") visible_message("<span class='warning'><b>[src] has been [pick(W.attack_verb)] with [W] by [user]!</b></span>")
@@ -194,7 +193,7 @@
if (I.hitsound) if (I.hitsound)
playsound(loc, I.hitsound, 50, 1, -1) playsound(loc, I.hitsound, 50, 1, -1)
take_damage(W.force) take_damage(W.force)
else else
..() ..()
@@ -221,14 +220,14 @@
if (force >= toughness && (force > toughness*4 || prob(25))) if (force >= toughness && (force > toughness*4 || prob(25)))
destroy() destroy()
//Used when someone breaks a camera //Used when someone breaks a camera
/obj/machinery/camera/proc/destroy() /obj/machinery/camera/proc/destroy()
invalidateCameraCache() invalidateCameraCache()
stat |= BROKEN stat |= BROKEN
kick_viewers() kick_viewers()
triggerCameraAlarm() triggerCameraAlarm()
update_icon() update_icon()
//sparks //sparks
var/datum/effect/effect/system/spark_spread/spark_system = new /datum/effect/effect/system/spark_spread() var/datum/effect/effect/system/spark_spread/spark_system = new /datum/effect/effect/system/spark_spread()
spark_system.set_up(5, 0, loc) spark_system.set_up(5, 0, loc)
@@ -266,7 +265,7 @@
alarm_on = 1 alarm_on = 1
if(!get_area(src)) if(!get_area(src))
return return
for(var/mob/living/silicon/S in mob_list) for(var/mob/living/silicon/S in mob_list)
S.triggerAlarm("Camera", get_area(src), list(src), src) S.triggerAlarm("Camera", get_area(src), list(src), src)
@@ -275,7 +274,7 @@
alarm_on = 0 alarm_on = 0
if(!get_area(src)) if(!get_area(src))
return return
for(var/mob/living/silicon/S in mob_list) for(var/mob/living/silicon/S in mob_list)
S.cancelAlarm("Camera", get_area(src), src) S.cancelAlarm("Camera", get_area(src), src)
@@ -355,7 +354,7 @@
/obj/machinery/camera/interact(mob/living/user as mob) /obj/machinery/camera/interact(mob/living/user as mob)
if(!panel_open || istype(user, /mob/living/silicon/ai)) if(!panel_open || istype(user, /mob/living/silicon/ai))
return return
if(stat & BROKEN) if(stat & BROKEN)
user << "<span class='warning'>\The [src] is broken.</span>" user << "<span class='warning'>\The [src] is broken.</span>"
return return

View File

@@ -3,18 +3,41 @@
//Potential replacement for genetics revives or something I dunno (?) //Potential replacement for genetics revives or something I dunno (?)
//Find a dead mob with a brain and client.
/proc/find_dead_player(var/find_key)
if(isnull(find_key))
return
var/mob/selected = null
for(var/mob/living/M in player_list)
//Dead people only thanks!
if((M.stat != 2) || (!M.client))
continue
//They need a brain!
if(istype(M, /mob/living/carbon/human))
var/mob/living/carbon/human/H = M
if(H.species.has_organ["brain"] && !H.has_brain())
continue
if(M.ckey == find_key)
selected = M
break
return selected
#define CLONE_BIOMASS 150 #define CLONE_BIOMASS 150
/obj/machinery/clonepod /obj/machinery/clonepod
anchored = 1
name = "cloning pod" name = "cloning pod"
desc = "An electronically-lockable pod for growing organic tissue." desc = "An electronically-lockable pod for growing organic tissue."
density = 1 density = 1
anchored = 1
icon = 'icons/obj/cloning.dmi' icon = 'icons/obj/cloning.dmi'
icon_state = "pod_0" icon_state = "pod_0"
req_access = list(access_genetics) //For premature unlocking. req_access = list(access_genetics) //For premature unlocking.
var/mob/living/occupant var/mob/living/occupant
var/heal_level = 90 //The clone is released once its health reaches this level. var/heal_level = 20 //The clone is released once its health reaches this level.
var/heal_rate = 1
var/notoxin = 0
var/locked = 0 var/locked = 0
var/obj/machinery/computer/cloning/connected = null //So we remember the connected clone machine. var/obj/machinery/computer/cloning/connected = null //So we remember the connected clone machine.
var/mess = 0 //Need to clean out it if it's full of exploded clone. var/mess = 0 //Need to clean out it if it's full of exploded clone.
@@ -22,6 +45,366 @@
var/eject_wait = 0 //Don't eject them as soon as they are created fuckkk var/eject_wait = 0 //Don't eject them as soon as they are created fuckkk
var/biomass = CLONE_BIOMASS * 3 var/biomass = CLONE_BIOMASS * 3
/obj/machinery/clonepod/New()
..()
component_parts = list()
component_parts += new /obj/item/weapon/circuitboard/clonepod(src)
component_parts += new /obj/item/weapon/stock_parts/manipulator(src)
component_parts += new /obj/item/weapon/stock_parts/manipulator(src)
component_parts += new /obj/item/weapon/stock_parts/scanning_module(src)
component_parts += new /obj/item/weapon/stock_parts/scanning_module(src)
component_parts += new /obj/item/weapon/stock_parts/console_screen(src)
component_parts += new /obj/item/stack/cable_coil(src, 2)
RefreshParts()
/obj/machinery/clonepod/attack_ai(mob/user as mob)
add_hiddenprint(user)
return attack_hand(user)
/obj/machinery/clonepod/attack_hand(mob/user as mob)
if((isnull(occupant)) || (stat & NOPOWER))
return
if((!isnull(occupant)) && (occupant.stat != 2))
var/completion = (100 * ((occupant.health + 50) / (heal_level + 100))) // Clones start at -150 health
user << "Current clone cycle is [round(completion)]% complete."
return
//Clonepod
//Start growing a human clone in the pod!
/obj/machinery/clonepod/proc/growclone(var/datum/dna2/record/R)
if(mess || attempting)
return 0
var/datum/mind/clonemind = locate(R.mind)
if(!istype(clonemind, /datum/mind)) //not a mind
return 0
if(clonemind.current && clonemind.current.stat != DEAD) //mind is associated with a non-dead body
return 0
if(clonemind.active) //somebody is using that mind
if(ckey(clonemind.key) != R.ckey)
return 0
else
for(var/mob/dead/observer/G in player_list)
if(G.ckey == R.ckey)
if(G.can_reenter_corpse)
break
else
return 0
attempting = 1 //One at a time!!
locked = 1
eject_wait = 1
spawn(30)
eject_wait = 0
var/mob/living/carbon/human/H = new /mob/living/carbon/human(src, R.dna.species)
occupant = H
if(!R.dna.real_name) //to prevent null names
R.dna.real_name = "clone ([rand(0,999)])"
H.real_name = R.dna.real_name
icon_state = "pod_1"
//Get the clone body ready
H.adjustCloneLoss(150) // New damage var so you can't eject a clone early then stab them to abuse the current damage system --NeoFite
H.adjustBrainLoss(80) // Even if healed to full health, it will have some brain damage
H.Paralyse(4)
//Here let's calculate their health so the pod doesn't immediately eject them!!!
H.updatehealth()
clonemind.transfer_to(H)
H.ckey = R.ckey
H << "<span class='notice'><b>Consciousness slowly creeps over you as your body regenerates.</b><br><i>So this is what cloning feels like?</i></span>"
// -- Mode/mind specific stuff goes here
callHook("clone", list(H))
switch(ticker.mode.name)
if("revolution")
if((H.mind in ticker.mode:revolutionaries) || (H.mind in ticker.mode:head_revolutionaries))
ticker.mode.update_all_rev_icons() //So the icon actually appears
if("mercenary")
if(H.mind in ticker.mode.syndicates)
ticker.mode.update_all_synd_icons()
if("cult")
if(H.mind in ticker.mode.cult)
ticker.mode.add_cultist(occupant.mind)
ticker.mode.update_all_cult_icons() //So the icon actually appears
// -- End mode specific stuff
if(!R.dna)
H.dna = new /datum/dna()
H.dna.real_name = H.real_name
else
H.dna = R.dna
H.UpdateAppearance()
if(heal_level < 60)
randmutb(H) //Sometimes the clones come out wrong.
H.dna.UpdateSE()
H.dna.UpdateUI()
H.set_cloned_appearance()
for(var/datum/language/L in R.languages)
H.add_language(L.name)
H.flavor_texts = R.flavor.Copy()
H.suiciding = 0
attempting = 0
return 1
//Grow clones to maturity then kick them out. FREELOADERS
/obj/machinery/clonepod/process()
if(stat & NOPOWER) //Autoeject if power is lost
if(occupant)
locked = 0
go_out()
return
if((occupant) && (occupant.loc == src))
if((occupant.stat == DEAD) || (occupant.suiciding) || !occupant.key) //Autoeject corpses and suiciding dudes.
locked = 0
go_out()
connected_message("Clone Rejected: Deceased.")
return
else if(occupant.health < heal_level && occupant.getCloneLoss() > 0)
occupant.Paralyse(4)
//Slowly get that clone healed and finished.
occupant.adjustCloneLoss(-2 * heal_rate)
//Premature clones may have brain damage.
occupant.adjustBrainLoss(-1 * heal_rate)
//So clones don't die of oxyloss in a running pod.
if(occupant.reagents.get_reagent_amount("inaprovaline") < 30)
occupant.reagents.add_reagent("inaprovaline", 60)
//So clones will remain asleep for long enough to get them into cryo (Bay RP edit)
if(occupant.reagents.get_reagent_amount("stoxin") < 10)
occupant.reagents.add_reagent("stoxin", 5)
if(occupant.reagents.get_reagent_amount("chloralhydrate") < 1)
occupant.reagents.add_reagent("chloralhydrate", 1)
//Also heal some oxyloss ourselves because inaprovaline is so bad at preventing it!!
occupant.adjustOxyLoss(-4)
if(notoxin)
occupant.adjustToxLoss(-2) // If sufficiently upgraded - remove toxin damage from chloral
use_power(7500) //This might need tweaking.
return
else if((occupant.health >= heal_level) && (!eject_wait))
connected_message("Cloning Process Complete.")
locked = 0
go_out()
return
else if((!occupant) || (occupant.loc != src))
occupant = null
if(locked)
locked = 0
if(!mess)
icon_state = "pod_0"
//use_power(200)
return
return
//Let's unlock this early I guess. Might be too early, needs tweaking.
/obj/machinery/clonepod/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(isnull(occupant))
if(default_deconstruction_screwdriver(user, W))
return
if(default_deconstruction_crowbar(user, W))
return
if(default_part_replacement(user, W))
return
if(istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda))
if(!check_access(W))
user << "<span class='warning'>Access Denied.</span>"
return
if((!locked) || (isnull(occupant)))
return
if((occupant.health < -20) && (occupant.stat != 2))
user << "<span class='warning'>Access Refused.</span>"
return
else
locked = 0
user << "System unlocked."
else if(istype(W, /obj/item/weapon/card/emag))
if(isnull(occupant))
return
user << "You force an emergency ejection."
locked = 0
go_out()
return
else if(istype(W, /obj/item/weapon/reagent_containers/food/snacks/meat))
user << "<span class='notice'>\The [src] processes \the [W].</span>"
biomass += 50
user.drop_item()
del(W)
return
else if(istype(W, /obj/item/weapon/wrench))
if(locked && (anchored || occupant))
user << "<span class='warning'>Can not do that while [src] is in use.</span>"
else
if(anchored)
anchored = 0
connected.pod1 = null
connected = null
else
anchored = 1
playsound(loc, 'sound/items/Ratchet.ogg', 100, 1)
if(anchored)
user.visible_message("[user] secures [src] to the floor.", "You secure [src] to the floor.")
else
user.visible_message("[user] unsecures [src] from the floor.", "You unsecure [src] from the floor.")
else
..()
//Put messages in the connected computer's temp var for display.
/obj/machinery/clonepod/proc/connected_message(var/message)
if((isnull(connected)) || (!istype(connected, /obj/machinery/computer/cloning)))
return 0
if(!message)
return 0
connected.temp = message
connected.updateUsrDialog()
return 1
/obj/machinery/clonepod/RefreshParts()
..()
var/rating = 0
for(var/obj/item/weapon/stock_parts/P in component_parts)
if(istype(P, /obj/item/weapon/stock_parts/scanning_module) || istype(P, /obj/item/weapon/stock_parts/manipulator))
rating += P.rating
heal_level = rating * 10 - 20
heal_rate = round(rating / 4)
if(rating >= 8)
notoxin = 1
else
notoxin = 0
/obj/machinery/clonepod/verb/eject()
set name = "Eject Cloner"
set category = "Object"
set src in oview(1)
if(usr.stat != 0)
return
go_out()
add_fingerprint(usr)
return
/obj/machinery/clonepod/proc/go_out()
if(locked)
return
if(mess) //Clean that mess and dump those gibs!
mess = 0
gibs(loc)
icon_state = "pod_0"
/*
for(var/obj/O in src)
O.loc = loc
*/
return
if(!(occupant))
return
/*
for(var/obj/O in src)
O.loc = loc
*/
if(occupant.client)
occupant.client.eye = occupant.client.mob
occupant.client.perspective = MOB_PERSPECTIVE
occupant.loc = loc
icon_state = "pod_0"
eject_wait = 0 //If it's still set somehow.
domutcheck(occupant) //Waiting until they're out before possible monkeyizing.
// occupant.add_side_effect("Bad Stomach") // Give them an extra side-effect for free.
occupant = null
biomass -= CLONE_BIOMASS
return
/obj/machinery/clonepod/proc/malfunction()
if(occupant)
connected_message("Critical Error!")
mess = 1
icon_state = "pod_g"
occupant.ghostize()
spawn(5)
del(occupant)
return
/obj/machinery/clonepod/relaymove(mob/user as mob)
if(user.stat)
return
go_out()
return
/obj/machinery/clonepod/emp_act(severity)
if(prob(100/severity))
malfunction()
..()
/obj/machinery/clonepod/ex_act(severity)
switch(severity)
if(1.0)
for(var/atom/movable/A as mob|obj in src)
A.loc = loc
ex_act(severity)
del(src)
return
if(2.0)
if(prob(50))
for(var/atom/movable/A as mob|obj in src)
A.loc = loc
ex_act(severity)
del(src)
return
if(3.0)
if(prob(25))
for(var/atom/movable/A as mob|obj in src)
A.loc = loc
ex_act(severity)
del(src)
return
else
return
//Health Tracker Implant
/obj/item/weapon/implant/health
name = "health implant"
var/healthstring = ""
/obj/item/weapon/implant/health/proc/sensehealth()
if(!implanted)
return "ERROR"
else
if(isliving(implanted))
var/mob/living/L = implanted
healthstring = "[round(L.getOxyLoss())] - [round(L.getFireLoss())] - [round(L.getToxLoss())] - [round(L.getBruteLoss())]"
if(!healthstring)
healthstring = "ERROR"
return healthstring
//Disk stuff.
//The return of data disks?? Just for transferring between genetics machine/cloning machine. //The return of data disks?? Just for transferring between genetics machine/cloning machine.
//TO-DO: Make the genetics machine accept them. //TO-DO: Make the genetics machine accept them.
/obj/item/weapon/disk/data /obj/item/weapon/disk/data
@@ -30,7 +413,7 @@
icon_state = "datadisk0" //Gosh I hope syndies don't mistake them for the nuke disk. icon_state = "datadisk0" //Gosh I hope syndies don't mistake them for the nuke disk.
item_state = "card-id" item_state = "card-id"
w_class = 2.0 w_class = 2.0
var/datum/dna2/record/buf=null var/datum/dna2/record/buf = null
var/read_only = 0 //Well,it's still a floppy disk var/read_only = 0 //Well,it's still a floppy disk
/obj/item/weapon/disk/data/proc/initializeDisk() /obj/item/weapon/disk/data/proc/initializeDisk()
@@ -65,363 +448,18 @@
buf.dna.SE=new_SE buf.dna.SE=new_SE
buf.dna.SetSEValueRange(MONKEYBLOCK,0xDAC, 0xFFF) buf.dna.SetSEValueRange(MONKEYBLOCK,0xDAC, 0xFFF)
//Find a dead mob with a brain and client.
/proc/find_dead_player(var/find_key)
if (isnull(find_key))
return
var/mob/selected = null
for(var/mob/living/M in player_list)
//Dead people only thanks!
if ((M.stat != 2) || (!M.client))
continue
//They need a brain!
if(istype(M, /mob/living/carbon/human))
var/mob/living/carbon/human/H = M
if(H.species.has_organ["brain"] && !H.has_brain())
continue
if (M.ckey == find_key)
selected = M
break
return selected
//Disk stuff.
/obj/item/weapon/disk/data/New() /obj/item/weapon/disk/data/New()
..() ..()
var/diskcolor = pick(0,1,2) var/diskcolor = pick(0,1,2)
src.icon_state = "datadisk[diskcolor]" icon_state = "datadisk[diskcolor]"
/obj/item/weapon/disk/data/attack_self(mob/user as mob) /obj/item/weapon/disk/data/attack_self(mob/user as mob)
src.read_only = !src.read_only read_only = !read_only
user << "You flip the write-protect tab to [src.read_only ? "protected" : "unprotected"]." user << "You flip the write-protect tab to [read_only ? "protected" : "unprotected"]."
/obj/item/weapon/disk/data/examine(mob/user) /obj/item/weapon/disk/data/examine(mob/user)
..(user) ..(user)
user << text("The write-protect tab is set to [src.read_only ? "protected" : "unprotected"].") user << text("The write-protect tab is set to [read_only ? "protected" : "unprotected"].")
return
//Health Tracker Implant
/obj/item/weapon/implant/health
name = "health implant"
var/healthstring = ""
/obj/item/weapon/implant/health/proc/sensehealth()
if (!src.implanted)
return "ERROR"
else
if(isliving(src.implanted))
var/mob/living/L = src.implanted
src.healthstring = "[round(L.getOxyLoss())] - [round(L.getFireLoss())] - [round(L.getToxLoss())] - [round(L.getBruteLoss())]"
if (!src.healthstring)
src.healthstring = "ERROR"
return src.healthstring
/obj/machinery/clonepod/attack_ai(mob/user as mob)
src.add_hiddenprint(user)
return attack_hand(user)
/obj/machinery/clonepod/attack_hand(mob/user as mob)
if ((isnull(src.occupant)) || (stat & NOPOWER))
return
if ((!isnull(src.occupant)) && (src.occupant.stat != 2))
var/completion = (100 * ((src.occupant.health + 100) / (src.heal_level + 100)))
user << "Current clone cycle is [round(completion)]% complete."
return
//Clonepod
//Start growing a human clone in the pod!
/obj/machinery/clonepod/proc/growclone(var/datum/dna2/record/R)
if(mess || attempting)
return 0
var/datum/mind/clonemind = locate(R.mind)
if(!istype(clonemind,/datum/mind)) //not a mind
return 0
if( clonemind.current && clonemind.current.stat != DEAD ) //mind is associated with a non-dead body
return 0
if(clonemind.active) //somebody is using that mind
if( ckey(clonemind.key)!=R.ckey )
return 0
else
for(var/mob/dead/observer/G in player_list)
if(G.ckey == R.ckey)
if(G.can_reenter_corpse)
break
else
return 0
src.heal_level = rand(10,40) //Randomizes what health the clone is when ejected
src.attempting = 1 //One at a time!!
src.locked = 1
src.eject_wait = 1
spawn(30)
src.eject_wait = 0
var/mob/living/carbon/human/H = new /mob/living/carbon/human(src, R.dna.species)
occupant = H
if(!R.dna.real_name) //to prevent null names
R.dna.real_name = "clone ([rand(0,999)])"
H.real_name = R.dna.real_name
src.icon_state = "pod_1"
//Get the clone body ready
H.adjustCloneLoss(150) //new damage var so you can't eject a clone early then stab them to abuse the current damage system --NeoFite
H.adjustBrainLoss(src.heal_level + 50 + rand(10, 30)) // The rand(10, 30) will come out as extra brain damage
H.Paralyse(4)
//Here let's calculate their health so the pod doesn't immediately eject them!!!
H.updatehealth()
clonemind.transfer_to(H)
H.ckey = R.ckey
H << "<span class='notice'><b>Consciousness slowly creeps over you as your body regenerates.</b><br><i>So this is what cloning feels like?</i></span>"
// -- Mode/mind specific stuff goes here
callHook("clone", list(H))
switch(ticker.mode.name)
if("revolution")
if((H.mind in ticker.mode:revolutionaries) || (H.mind in ticker.mode:head_revolutionaries))
ticker.mode.update_all_rev_icons() //So the icon actually appears
if("mercenary")
if(H.mind in ticker.mode.syndicates)
ticker.mode.update_all_synd_icons()
if("cult")
if (H.mind in ticker.mode.cult)
ticker.mode.add_cultist(src.occupant.mind)
ticker.mode.update_all_cult_icons() //So the icon actually appears
// -- End mode specific stuff
if(!R.dna)
H.dna = new /datum/dna()
H.dna.real_name = H.real_name
else
H.dna=R.dna
H.UpdateAppearance()
randmutb(H) //Sometimes the clones come out wrong.
H.dna.UpdateSE()
H.dna.UpdateUI()
H.set_cloned_appearance()
for(var/datum/language/L in R.languages)
H.add_language(L.name)
H.flavor_texts = R.flavor.Copy()
H.suiciding = 0
src.attempting = 0
return 1
//Grow clones to maturity then kick them out. FREELOADERS
/obj/machinery/clonepod/process()
if(stat & NOPOWER) //Autoeject if power is lost
if (src.occupant)
src.locked = 0
src.go_out()
return
if((src.occupant) && (src.occupant.loc == src))
if((src.occupant.stat == DEAD) || (src.occupant.suiciding) || !occupant.key) //Autoeject corpses and suiciding dudes.
src.locked = 0
src.go_out()
src.connected_message("Clone Rejected: Deceased.")
return
else if(src.occupant.health < src.heal_level)
src.occupant.Paralyse(4)
//Slowly get that clone healed and finished.
src.occupant.adjustCloneLoss(-2)
//Premature clones may have brain damage.
src.occupant.adjustBrainLoss(-1)
//So clones don't die of oxyloss in a running pod.
if (src.occupant.reagents.get_reagent_amount("inaprovaline") < 30)
src.occupant.reagents.add_reagent("inaprovaline", 60)
//So clones will remain asleep for long enough to get them into cryo (Bay RP edit)
if (src.occupant.reagents.get_reagent_amount("stoxin") < 10)
src.occupant.reagents.add_reagent("stoxin", 5)
if (src.occupant.reagents.get_reagent_amount("chloralhydrate") < 1)
src.occupant.reagents.add_reagent("chloralhydrate", 1)
//Also heal some oxyloss ourselves because inaprovaline is so bad at preventing it!!
src.occupant.adjustOxyLoss(-4)
use_power(7500) //This might need tweaking.
return
else if((src.occupant.health >= src.heal_level) && (!src.eject_wait))
src.connected_message("Cloning Process Complete.")
src.locked = 0
src.go_out()
return
else if ((!src.occupant) || (src.occupant.loc != src))
src.occupant = null
if (src.locked)
src.locked = 0
if (!src.mess)
icon_state = "pod_0"
//use_power(200)
return
return
//Let's unlock this early I guess. Might be too early, needs tweaking.
/obj/machinery/clonepod/attackby(obj/item/weapon/W as obj, mob/user as mob)
if (istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda))
if (!src.check_access(W))
user << "\red Access Denied."
return
if ((!src.locked) || (isnull(src.occupant)))
return
if ((src.occupant.health < -20) && (src.occupant.stat != 2))
user << "\red Access Refused."
return
else
src.locked = 0
user << "System unlocked."
else if (istype(W, /obj/item/weapon/card/emag))
if (isnull(src.occupant))
return
user << "You force an emergency ejection."
src.locked = 0
src.go_out()
return
else if (istype(W, /obj/item/weapon/reagent_containers/food/snacks/meat))
user << "\blue \The [src] processes \the [W]."
biomass += 50
user.drop_item()
del(W)
return
else if (istype(W, /obj/item/weapon/wrench))
if(src.locked && (src.anchored || src.occupant))
user << "\red Can not do that while [src] is in use."
else
if(src.anchored)
src.anchored = 0
connected.pod1 = null
connected = null
else
src.anchored = 1
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
if(anchored)
user.visible_message("[user] secures [src] to the floor.", "You secure [src] to the floor.")
else
user.visible_message("[user] unsecures [src] from the floor.", "You unsecure [src] from the floor.")
else
..()
//Put messages in the connected computer's temp var for display.
/obj/machinery/clonepod/proc/connected_message(var/message)
if ((isnull(src.connected)) || (!istype(src.connected, /obj/machinery/computer/cloning)))
return 0
if (!message)
return 0
src.connected.temp = message
src.connected.updateUsrDialog()
return 1
/obj/machinery/clonepod/verb/eject()
set name = "Eject Cloner"
set category = "Object"
set src in oview(1)
if (usr.stat != 0)
return
src.go_out()
add_fingerprint(usr)
return
/obj/machinery/clonepod/proc/go_out()
if (src.locked)
return
if (src.mess) //Clean that mess and dump those gibs!
src.mess = 0
gibs(src.loc)
src.icon_state = "pod_0"
/*
for(var/obj/O in src)
O.loc = src.loc
*/
return
if (!(src.occupant))
return
/*
for(var/obj/O in src)
O.loc = src.loc
*/
if (src.occupant.client)
src.occupant.client.eye = src.occupant.client.mob
src.occupant.client.perspective = MOB_PERSPECTIVE
src.occupant.loc = src.loc
src.icon_state = "pod_0"
src.eject_wait = 0 //If it's still set somehow.
domutcheck(src.occupant) //Waiting until they're out before possible monkeyizing.
// src.occupant.add_side_effect("Bad Stomach") // Give them an extra side-effect for free.
src.occupant = null
src.biomass -= CLONE_BIOMASS
return
/obj/machinery/clonepod/proc/malfunction()
if(src.occupant)
src.connected_message("Critical Error!")
src.mess = 1
src.icon_state = "pod_g"
src.occupant.ghostize()
spawn(5)
del(src.occupant)
return
/obj/machinery/clonepod/relaymove(mob/user as mob)
if (user.stat)
return
src.go_out()
return
/obj/machinery/clonepod/emp_act(severity)
if(prob(100/severity)) malfunction()
..()
/obj/machinery/clonepod/ex_act(severity)
switch(severity)
if(1.0)
for(var/atom/movable/A as mob|obj in src)
A.loc = src.loc
ex_act(severity)
del(src)
return
if(2.0)
if (prob(50))
for(var/atom/movable/A as mob|obj in src)
A.loc = src.loc
ex_act(severity)
del(src)
return
if(3.0)
if (prob(25))
for(var/atom/movable/A as mob|obj in src)
A.loc = src.loc
ex_act(severity)
del(src)
return
else
return return
/* /*

View File

@@ -19,7 +19,6 @@
var/seconds_electrified = 0; var/seconds_electrified = 0;
var/shoot_inventory = 0 var/shoot_inventory = 0
var/locked = 0 var/locked = 0
var/panel_open = 0 //Hacking a smartfridge
var/scan_id = 1 var/scan_id = 1
var/is_secure = 0 var/is_secure = 0
var/datum/wires/smartfridge/wires = null var/datum/wires/smartfridge/wires = null

View File

@@ -28,6 +28,9 @@ Class Variables:
component_parts (list) component_parts (list)
A list of component parts of machine used by frame based machines. A list of component parts of machine used by frame based machines.
panel_open (num)
Whether the panel is open
uid (num) uid (num)
Unique id of machine across all machines. Unique id of machine across all machines.
@@ -43,9 +46,6 @@ Class Variables:
MAINT:8 -- machine is currently under going maintenance. MAINT:8 -- machine is currently under going maintenance.
EMPED:16 -- temporary broken by EMP pulse EMPED:16 -- temporary broken by EMP pulse
manual (num)
Currently unused.
Class Procs: Class Procs:
New() 'game/machinery/machine.dm' New() 'game/machinery/machine.dm'
@@ -104,13 +104,12 @@ Class Procs:
//2 = run auto, use active //2 = run auto, use active
var/idle_power_usage = 0 var/idle_power_usage = 0
var/active_power_usage = 0 var/active_power_usage = 0
var/power_channel = EQUIP var/power_channel = EQUIP //EQUIP, ENVIRON or LIGHT
//EQUIP,ENVIRON or LIGHT var/list/component_parts = null //list of all the parts used to build it, if made from certain kinds of frames.
var/list/component_parts = list() //list of all the parts used to build it, if made from certain kinds of frames.
var/uid var/uid
var/manual = 0 var/panel_open = 0
var/interact_offline = 0 // Can the machine be interacted with while de-powered.
var/global/gl_uid = 1 var/global/gl_uid = 1
var/interact_offline = 0 // Can the machine be interacted with while de-powered.
/obj/machinery/New(l, d=0) /obj/machinery/New(l, d=0)
..(l) ..(l)
@@ -238,15 +237,15 @@ Class Procs:
gl_uid++ gl_uid++
/obj/machinery/proc/state(var/msg) /obj/machinery/proc/state(var/msg)
for(var/mob/O in hearers(src, null)) for(var/mob/O in hearers(src, null))
O.show_message("\icon[src] <span class = 'notice'>[msg]</span>", 2) O.show_message("\icon[src] <span class = 'notice'>[msg]</span>", 2)
/obj/machinery/proc/ping(text=null) /obj/machinery/proc/ping(text=null)
if (!text) if (!text)
text = "\The [src] pings." text = "\The [src] pings."
state(text, "blue") state(text, "blue")
playsound(src.loc, 'sound/machines/ping.ogg', 50, 0) playsound(src.loc, 'sound/machines/ping.ogg', 50, 0)
/obj/machinery/proc/shock(mob/user, prb) /obj/machinery/proc/shock(mob/user, prb)
if(inoperable()) if(inoperable())
@@ -267,6 +266,54 @@ Class Procs:
else else
return 0 return 0
/obj/machinery/proc/default_deconstruction_crowbar(var/mob/user, var/obj/item/weapon/crowbar/C)
if(!istype(C))
return 0
if(!panel_open)
return 0
. = dismantle()
/obj/machinery/proc/default_deconstruction_screwdriver(var/mob/user, var/obj/item/weapon/screwdriver/S)
if(!istype(S))
return 0
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
panel_open = !panel_open
user << "<span class='notice'>You [panel_open ? "open" : "close"] the maintenance hatch of [src].</span>"
update_icon()
return 1
/obj/machinery/proc/default_part_replacement(var/mob/user, var/obj/item/weapon/storage/part_replacer/R)
if(!istype(R))
return 0
if(!component_parts)
return 0
if(panel_open)
var/obj/item/weapon/circuitboard/CB = locate(/obj/item/weapon/circuitboard) in component_parts
var/P
for(var/obj/item/weapon/stock_parts/A in component_parts)
for(var/D in CB.req_components)
var/T = text2path(D)
if(ispath(A.type, T))
P = T
break
for(var/obj/item/weapon/stock_parts/B in R.contents)
if(istype(B, P) && istype(A, P))
if(B.rating > A.rating)
R.remove_from_storage(B, src)
R.handle_item_insertion(A, 1)
component_parts -= A
component_parts += B
B.loc = null
user << "<span class='notice'>[A.name] replaced with [B.name].</span>"
break
update_icon()
RefreshParts()
else
user << "<span class='notice'>Following parts detected in the machine:</span>"
for(var/var/obj/item/C in component_parts)
user << "<span class='notice'> [C.name]</span>"
return 1
/obj/machinery/proc/dismantle() /obj/machinery/proc/dismantle()
playsound(loc, 'sound/items/Crowbar.ogg', 50, 1) playsound(loc, 'sound/items/Crowbar.ogg', 50, 1)
var/obj/machinery/constructable_frame/machine_frame/M = new /obj/machinery/constructable_frame/machine_frame(loc) var/obj/machinery/constructable_frame/machine_frame/M = new /obj/machinery/constructable_frame/machine_frame(loc)

View File

@@ -3,187 +3,227 @@
icon = 'icons/obj/objects.dmi' icon = 'icons/obj/objects.dmi'
icon_state = "borgcharger0" icon_state = "borgcharger0"
density = 1 density = 1
anchored = 1.0 anchored = 1
use_power = 1 use_power = 1
idle_power_usage = 50 idle_power_usage = 50
active_power_usage = 50 active_power_usage = 50
var/mob/occupant = null var/mob/occupant = null
var/max_internal_charge = 15000 // Two charged borgs in a row with default cell var/obj/item/weapon/cell/cell = null
var/current_internal_charge = 15000 // Starts charged, to prevent power surges on round start //var/max_internal_charge = 15000 // Two charged borgs in a row with default cell
var/charging_cap_active = 25000 // Active Cap - When cyborg is inside //var/current_internal_charge = 15000 // Starts charged, to prevent power surges on round start
var/charging_cap_passive = 2500 // Passive Cap - Recharging internal capacitor when no cyborg is inside var/charging_cap_active = 1000 // Active Cap - When cyborg is inside
var/charging_cap_passive = 250 // Passive Cap - Recharging internal capacitor when no cyborg is inside
var/icon_update_tick = 0 // Used to update icon only once every 10 ticks var/icon_update_tick = 0 // Used to update icon only once every 10 ticks
var/charge_rate = 250 // How much charge is restored per tick
var/weld_rate = 0 // How much brute damage is repaired per tick
var/wire_rate = 0 // How much burn damage is repaired per tick
/obj/machinery/recharge_station/New()
..()
component_parts = list()
component_parts += new /obj/item/weapon/circuitboard/recharge_station(src)
component_parts += new /obj/item/weapon/stock_parts/manipulator(src)
component_parts += new /obj/item/weapon/stock_parts/manipulator(src)
component_parts += new /obj/item/weapon/stock_parts/capacitor(src)
component_parts += new /obj/item/weapon/stock_parts/capacitor(src)
component_parts += new /obj/item/weapon/cell/high(src)
component_parts += new /obj/item/stack/cable_coil(src, 5)
New() build_icon()
..() update_icon()
build_icon()
update_icon()
process() RefreshParts()
if(stat & (BROKEN))
return
if((stat & (NOPOWER)) && !current_internal_charge) // No Power. /obj/machinery/recharge_station/process()
return if(stat & (BROKEN))
var/chargemode = 0
if(src.occupant)
process_occupant()
chargemode = 1
// Power Stuff
if(stat & NOPOWER)
current_internal_charge = max(0, (current_internal_charge - (50 * CELLRATE))) // Internal Circuitry, 50W load. No power - Runs from internal cell
return // No external power = No charging
if(max_internal_charge < current_internal_charge)
current_internal_charge = max_internal_charge// Safety check if varedit adminbus or something screws up
// Calculating amount of power to draw
var/charge_diff = max_internal_charge - current_internal_charge // OK we have charge differences
charge_diff = charge_diff / CELLRATE // Deconvert from Charge to Joules
if(chargemode) // Decide if use passive or active power
charge_diff = between(0, charge_diff, charging_cap_active) // Trim the values to limits
else // We should have load for this tick in Watts
charge_diff = between(0, charge_diff, charging_cap_passive)
charge_diff += 50 // 50W for circuitry
if(idle_power_usage != charge_diff) // Force update, but only when our power usage changed this tick.
idle_power_usage = charge_diff
update_use_power(1,1)
current_internal_charge = min((current_internal_charge + ((charge_diff - 50) * CELLRATE)), max_internal_charge)
if(icon_update_tick >= 10)
update_icon()
icon_update_tick = 0
else
icon_update_tick++
return 1
allow_drop()
return 0
examine(mob/user)
..(user)
user << "The charge meter reads: [round(chargepercentage())]%"
proc/chargepercentage()
return ((current_internal_charge / max_internal_charge) * 100)
relaymove(mob/user as mob)
if(user.stat)
return
src.go_out()
return return
emp_act(severity) if((stat & (NOPOWER)) && (!cell || cell.percent() <= 0)) // No Power.
if(stat & (BROKEN|NOPOWER)) return
..(severity)
return
if(occupant)
occupant.emp_act(severity)
go_out()
..(severity)
update_icon()
..()
overlays.Cut()
switch(round(chargepercentage()))
if(1 to 20)
overlays += image('icons/obj/objects.dmi', "statn_c0")
if(21 to 40)
overlays += image('icons/obj/objects.dmi', "statn_c20")
if(41 to 60)
overlays += image('icons/obj/objects.dmi', "statn_c40")
if(61 to 80)
overlays += image('icons/obj/objects.dmi', "statn_c60")
if(81 to 98)
overlays += image('icons/obj/objects.dmi', "statn_c80")
if(99 to 110)
overlays += image('icons/obj/objects.dmi', "statn_c100")
proc
build_icon()
if(NOPOWER|BROKEN)
if(src.occupant)
icon_state = "borgcharger1"
else
icon_state = "borgcharger0"
else
icon_state = "borgcharger0"
var/chargemode = 0
if(occupant)
process_occupant() process_occupant()
if(src.occupant) chargemode = 1
if (istype(occupant, /mob/living/silicon/robot)) // Power Stuff
var/mob/living/silicon/robot/R = occupant
if(R.module) if(!cell) // Shouldn't be possible, but sanity check
R.module.respawn_consumable(R) return
if(!R.cell)
return if(stat & NOPOWER)
if(!R.cell.fully_charged()) cell.use(50 * CELLRATE) // Internal Circuitry, 50W load. No power - Runs from internal cell
var/diff = min(R.cell.maxcharge - R.cell.charge, 250) // Capped at 250 charge / tick return // No external power = No charging
diff = min(diff, current_internal_charge) // No over-discharging
R.cell.give(diff) // Calculating amount of power to draw
current_internal_charge -= diff var/charge_diff = (chargemode ? charging_cap_active : charging_cap_passive) + 50 // 50W for circuitry
else
update_use_power(1) charge_diff = cell.give(charge_diff)
if(idle_power_usage != charge_diff) // Force update, but only when our power usage changed this tick.
idle_power_usage = charge_diff
update_use_power(1, 1)
if(icon_update_tick >= 10)
update_icon()
icon_update_tick = 0
else
icon_update_tick++
return 1
/obj/machinery/recharge_station/allow_drop()
return 0
/obj/machinery/recharge_station/examine(mob/user)
..(user)
user << "The charge meter reads: [round(chargepercentage())]%"
/obj/machinery/recharge_station/proc/chargepercentage()
if(!cell)
return 0
return cell.percent()
/obj/machinery/recharge_station/relaymove(mob/user as mob)
if(user.stat)
return
go_out()
return
/obj/machinery/recharge_station/emp_act(severity)
if(stat & (BROKEN|NOPOWER))
..(severity)
return
if(occupant)
occupant.emp_act(severity)
go_out() go_out()
if(!( src.occupant )) if(cell)
return cell.emp_act(severity)
//for(var/obj/O in src) ..(severity)
// O.loc = src.loc
if (src.occupant.client) /obj/machinery/recharge_station/attackby(var/obj/item/O as obj, var/mob/user as mob)
src.occupant.client.eye = src.occupant.client.mob if(!occupant)
src.occupant.client.perspective = MOB_PERSPECTIVE if(default_deconstruction_screwdriver(user, O))
src.occupant.loc = src.loc return
src.occupant = null if(default_deconstruction_crowbar(user, O))
build_icon() return
update_use_power(1) if(default_part_replacement(user, O))
return return
..()
verb /obj/machinery/recharge_station/RefreshParts()
move_eject() ..()
set category = "Object" var/man_rating = 0
set src in oview(1) var/cap_rating = 0
if (usr.stat != 0)
return
src.go_out()
add_fingerprint(usr)
return
move_inside() for(var/obj/item/weapon/stock_parts/P in component_parts)
set category = "Object" if(istype(P, /obj/item/weapon/stock_parts/capacitor))
set src in oview(1) cap_rating += P.rating
if (usr.stat == 2) if(istype(P, /obj/item/weapon/stock_parts/manipulator))
//Whoever had it so that a borg with a dead cell can't enter this thing should be shot. --NEO man_rating += P.rating
cell = locate(/obj/item/weapon/cell) in component_parts
charge_rate = 125 * cap_rating
charging_cap_passive = charge_rate
weld_rate = max(0, man_rating - 3)
wire_rate = max(0, man_rating - 5)
/obj/machinery/recharge_station/update_icon()
..()
overlays.Cut()
switch(round(chargepercentage()))
if(1 to 20)
overlays += image('icons/obj/objects.dmi', "statn_c0")
if(21 to 40)
overlays += image('icons/obj/objects.dmi', "statn_c20")
if(41 to 60)
overlays += image('icons/obj/objects.dmi', "statn_c40")
if(61 to 80)
overlays += image('icons/obj/objects.dmi', "statn_c60")
if(81 to 98)
overlays += image('icons/obj/objects.dmi', "statn_c80")
if(99 to 110)
overlays += image('icons/obj/objects.dmi', "statn_c100")
/obj/machinery/recharge_station/proc/build_icon()
if(NOPOWER|BROKEN)
if(occupant)
icon_state = "borgcharger1"
else
icon_state = "borgcharger0"
else
icon_state = "borgcharger0"
/obj/machinery/recharge_station/proc/process_occupant()
if(occupant)
if(istype(occupant, /mob/living/silicon/robot))
var/mob/living/silicon/robot/R = occupant
if(R.module)
R.module.respawn_consumable(R)
if(!R.cell)
return return
if (!(istype(usr, /mob/living/silicon/))) if(!R.cell.fully_charged())
usr << "\blue <B>Only non-organics may enter the recharger!</B>" var/diff = min(R.cell.maxcharge - R.cell.charge, charge_rate) // Capped at charge_rate charge / tick
return if (cell.use(diff))
if (src.occupant) R.cell.give(diff)
usr << "\blue <B>The cell is already occupied!</B>" if(weld_rate && R.getBruteLoss())
return R.adjustBruteLoss(-1)
if (!usr:cell) if(wire_rate && R.getFireLoss())
usr<<"\blue Without a powercell, you can't be recharged." R.adjustFireLoss(-1)
//Make sure they actually HAVE a cell, now that they can get in while powerless. --NEO else
return update_use_power(1)
usr.stop_pulling()
if(usr && usr.client) /obj/machinery/recharge_station/proc/go_out()
usr.client.perspective = EYE_PERSPECTIVE if(!(occupant))
usr.client.eye = src return
usr.loc = src //for(var/obj/O in src)
src.occupant = usr // O.loc = loc
/*for(var/obj/O in src) if(occupant.client)
O.loc = src.loc*/ occupant.client.eye = occupant.client.mob
src.add_fingerprint(usr) occupant.client.perspective = MOB_PERSPECTIVE
build_icon() occupant.loc = loc
update_use_power(1) occupant = null
return build_icon()
update_use_power(1)
return
/obj/machinery/recharge_station/verb/move_eject()
set category = "Object"
set src in oview(1)
if(usr.stat != 0)
return
go_out()
add_fingerprint(usr)
return
/obj/machinery/recharge_station/verb/move_inside()
set category = "Object"
set src in oview(1)
if(usr.stat == 2)
//Whoever had it so that a borg with a dead cell can't enter this thing should be shot. --NEO
return
if(!(istype(usr, /mob/living/silicon/)))
usr << "<span class='notice'>Only non-organics may enter the recharger!</span>"
return
if(occupant)
usr << "<span class='notice'>The cell is already occupied!</span>"
return
if(!usr:cell)
usr << "<span class='notice'>Without a powercell, you can't be recharged.</span>"
//Make sure they actually HAVE a cell, now that they can get in while powerless. --NEO
return
usr.stop_pulling()
if(usr && usr.client)
usr.client.perspective = EYE_PERSPECTIVE
usr.client.eye = src
usr.loc = src
occupant = usr
/*for(var/obj/O in src)
O.loc = loc*/
add_fingerprint(usr)
build_icon()
update_use_power(1)
return

View File

@@ -7,7 +7,6 @@
desc = "Made by Space Amish using traditional space techniques, this heater is guaranteed not to set the station on fire." desc = "Made by Space Amish using traditional space techniques, this heater is guaranteed not to set the station on fire."
var/obj/item/weapon/cell/cell var/obj/item/weapon/cell/cell
var/on = 0 var/on = 0
var/open = 0
var/set_temperature = T0C + 50 //K var/set_temperature = T0C + 50 //K
var/heating_power = 40000 var/heating_power = 40000
@@ -20,14 +19,14 @@
/obj/machinery/space_heater/update_icon() /obj/machinery/space_heater/update_icon()
overlays.Cut() overlays.Cut()
icon_state = "sheater[on]" icon_state = "sheater[on]"
if(open) if(panel_open)
overlays += "sheater-open" overlays += "sheater-open"
/obj/machinery/space_heater/examine(mob/user) /obj/machinery/space_heater/examine(mob/user)
..(user) ..(user)
user << "The heater is [on ? "on" : "off"] and the hatch is [open ? "open" : "closed"]." user << "The heater is [on ? "on" : "off"] and the hatch is [panel_open ? "open" : "closed"]."
if(open) if(panel_open)
user << "The power cell is [cell ? "installed" : "missing"]." user << "The power cell is [cell ? "installed" : "missing"]."
else else
user << "The charge meter reads [cell ? round(cell.percent(),1) : 0]%" user << "The charge meter reads [cell ? round(cell.percent(),1) : 0]%"
@@ -43,7 +42,7 @@
/obj/machinery/space_heater/attackby(obj/item/I, mob/user) /obj/machinery/space_heater/attackby(obj/item/I, mob/user)
if(istype(I, /obj/item/weapon/cell)) if(istype(I, /obj/item/weapon/cell))
if(open) if(panel_open)
if(cell) if(cell)
user << "There is already a power cell inside." user << "There is already a power cell inside."
return return
@@ -61,10 +60,10 @@
user << "The hatch must be open to insert a power cell." user << "The hatch must be open to insert a power cell."
return return
else if(istype(I, /obj/item/weapon/screwdriver)) else if(istype(I, /obj/item/weapon/screwdriver))
open = !open panel_open = !panel_open
user.visible_message("\blue [user] [open ? "opens" : "closes"] the hatch on the [src].", "\blue You [open ? "open" : "close"] the hatch on the [src].") user.visible_message("\blue [user] [panel_open ? "opens" : "closes"] the hatch on the [src].", "\blue You [panel_open ? "open" : "close"] the hatch on the [src].")
update_icon() update_icon()
if(!open && user.machine == src) if(!panel_open && user.machine == src)
user << browse(null, "window=spaceheater") user << browse(null, "window=spaceheater")
user.unset_machine() user.unset_machine()
else else
@@ -77,7 +76,7 @@
/obj/machinery/space_heater/interact(mob/user as mob) /obj/machinery/space_heater/interact(mob/user as mob)
if(open) if(panel_open)
var/dat var/dat
dat = "Power cell: " dat = "Power cell: "
@@ -120,7 +119,7 @@
set_temperature = dd_range(T0C, T0C + 90, set_temperature + value) set_temperature = dd_range(T0C, T0C + 90, set_temperature + value)
if("cellremove") if("cellremove")
if(open && cell && !usr.get_active_hand()) if(panel_open && cell && !usr.get_active_hand())
usr.visible_message("\blue [usr] removes \the [cell] from \the [src].", "\blue You remove \the [cell] from \the [src].") usr.visible_message("\blue [usr] removes \the [cell] from \the [src].", "\blue You remove \the [cell] from \the [src].")
cell.updateicon() cell.updateicon()
usr.put_in_hands(cell) usr.put_in_hands(cell)
@@ -129,7 +128,7 @@
if("cellinstall") if("cellinstall")
if(open && !cell) if(panel_open && !cell)
var/obj/item/weapon/cell/C = usr.get_active_hand() var/obj/item/weapon/cell/C = usr.get_active_hand()
if(istype(C)) if(istype(C))
usr.drop_item() usr.drop_item()

View File

@@ -589,7 +589,6 @@
var/radiation_level = 2 // 1 is removing germs, 2 is removing blood, 3 is removing phoron. var/radiation_level = 2 // 1 is removing germs, 2 is removing blood, 3 is removing phoron.
var/model_text = "" // Some flavour text for the topic box. var/model_text = "" // Some flavour text for the topic box.
var/locked = 1 // If locked, nothing can be taken from or added to the cycler. var/locked = 1 // If locked, nothing can be taken from or added to the cycler.
var/panel_open = 0 // Hacking!
var/can_repair // If set, the cycler can repair voidsuits. var/can_repair // If set, the cycler can repair voidsuits.
var/electrified = 0 var/electrified = 0

View File

@@ -54,7 +54,6 @@
var/shoot_inventory = 0 //Fire items at customers! We're broken! var/shoot_inventory = 0 //Fire items at customers! We're broken!
var/shut_up = 1 //Stop spouting those godawful pitches! var/shut_up = 1 //Stop spouting those godawful pitches!
var/extended_inventory = 0 //can we access the hidden inventory? var/extended_inventory = 0 //can we access the hidden inventory?
var/panel_open = 0 //Hacking that vending machine. Gonna get a free candy bar.
var/scan_id = 1 var/scan_id = 1
var/obj/item/weapon/coin/coin var/obj/item/weapon/coin/coin
var/datum/wires/vending/wires = null var/datum/wires/vending/wires = null

View File

@@ -0,0 +1,13 @@
#ifndef T_BOARD
#error T_BOARD macro is not defined but we need it!
#endif
/obj/item/weapon/circuitboard/biogenerator
name = T_BOARD("biogenerator")
build_path = "/obj/machinery/biogenerator"
board_type = "machine"
origin_tech = "programming=2"
frame_desc = "Requires 1 Manipulator, and 1 Matter Bin."
req_components = list(
"/obj/item/weapon/stock_parts/matter_bin" = 1,
"/obj/item/weapon/stock_parts/manipulator" = 1)

View File

@@ -0,0 +1,15 @@
#ifndef T_BOARD
#error T_BOARD macro is not defined but we need it!
#endif
/obj/item/weapon/circuitboard/recharge_station
name = T_BOARD("cyborg recharging station")
build_path = "/obj/machinery/recharge_station"
board_type = "machine"
origin_tech = "programming=3;engineering=3"
frame_desc = "Requires 2 Manipulator, 2 Capacitor, 1 Cell, and 5 pieces of cable."
req_components = list(
"/obj/item/stack/cable_coil" = 5,
"/obj/item/weapon/stock_parts/capacitor" = 2,
"/obj/item/weapon/stock_parts/manipulator" = 2,
"/obj/item/weapon/cell" = 1)

View File

@@ -11,66 +11,80 @@
var/obj/item/weapon/reagent_containers/glass/beaker = null var/obj/item/weapon/reagent_containers/glass/beaker = null
var/points = 0 var/points = 0
var/menustat = "menu" var/menustat = "menu"
var/build_eff = 1
var/eat_eff = 1
New() /obj/machinery/biogenerator/New()
..() ..()
var/datum/reagents/R = new/datum/reagents(1000) var/datum/reagents/R = new/datum/reagents(1000)
reagents = R reagents = R
R.my_atom = src R.my_atom = src
beaker = new /obj/item/weapon/reagent_containers/glass/beaker/large(src) beaker = new /obj/item/weapon/reagent_containers/glass/bottle(src)
on_reagent_change() //When the reagents change, change the icon as well. component_parts = list()
update_icon() component_parts += new /obj/item/weapon/circuitboard/biogenerator(src)
component_parts += new /obj/item/weapon/stock_parts/matter_bin(src)
component_parts += new /obj/item/weapon/stock_parts/manipulator(src)
RefreshParts()
/obj/machinery/biogenerator/on_reagent_change() //When the reagents change, change the icon as well.
update_icon() update_icon()
if(!src.beaker)
icon_state = "biogen-empty" /obj/machinery/biogenerator/update_icon()
else if(!src.processing) if(!beaker)
icon_state = "biogen-stand" icon_state = "biogen-empty"
else else if(!processing)
icon_state = "biogen-work" icon_state = "biogen-stand"
return else
icon_state = "biogen-work"
return
/obj/machinery/biogenerator/attackby(var/obj/item/O as obj, var/mob/user as mob) /obj/machinery/biogenerator/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(default_deconstruction_screwdriver(user, O))
return
if(default_deconstruction_crowbar(user, O))
return
if(default_part_replacement(user, O))
return
if(istype(O, /obj/item/weapon/reagent_containers/glass)) if(istype(O, /obj/item/weapon/reagent_containers/glass))
if(beaker) if(beaker)
user << "\red The biogenerator is already loaded." user << "<span class='notice'>]The [src] is already loaded.</span>"
else else
user.before_take_item(O) user.before_take_item(O)
O.loc = src O.loc = src
beaker = O beaker = O
updateUsrDialog() updateUsrDialog()
else if(processing) else if(processing)
user << "\red The biogenerator is currently processing." user << "<span class='notice'>\The [src] is currently processing.</span>"
else if(istype(O, /obj/item/weapon/storage/bag/plants)) else if(istype(O, /obj/item/weapon/storage/bag/plants))
var/i = 0 var/i = 0
for(var/obj/item/weapon/reagent_containers/food/snacks/grown/G in contents) for(var/obj/item/weapon/reagent_containers/food/snacks/grown/G in contents)
i++ i++
if(i >= 10) if(i >= 10)
user << "\red The biogenerator is already full! Activate it." user << "<span class='notice'>\The [src] is already full! Activate it.</span>"
else else
for(var/obj/item/weapon/reagent_containers/food/snacks/grown/G in O.contents) for(var/obj/item/weapon/reagent_containers/food/snacks/grown/G in O.contents)
G.loc = src G.loc = src
i++ i++
if(i >= 10) if(i >= 10)
user << "\blue You fill the biogenerator to its capacity." user << "<span class='notice'>You fill \the [src] to its capacity.</span>"
break break
if(i<10) if(i < 10)
user << "\blue You empty the plant bag into the biogenerator." user << "<span class='notice'>You empty \the [O] into \the [src].</span>"
else if(!istype(O, /obj/item/weapon/reagent_containers/food/snacks/grown)) else if(!istype(O, /obj/item/weapon/reagent_containers/food/snacks/grown))
user << "\red You cannot put this in [src.name]" user << "<span class='notice'>You cannot put this in \the [src].</span>"
else else
var/i = 0 var/i = 0
for(var/obj/item/weapon/reagent_containers/food/snacks/grown/G in contents) for(var/obj/item/weapon/reagent_containers/food/snacks/grown/G in contents)
i++ i++
if(i >= 10) if(i >= 10)
user << "\red The biogenerator is full! Activate it." user << "<span class='notice'>\The [src] is full! Activate it.</span>"
else else
user.before_take_item(O) user.before_take_item(O)
O.loc = src O.loc = src
user << "\blue You put [O.name] in [src.name]" user << "<span class='notice'>You put \the [O] in \the [src]</span>"
update_icon() update_icon()
return return
@@ -89,18 +103,18 @@
dat += "<A href='?src=\ref[src];action=activate'>Activate Biogenerator!</A><BR>" dat += "<A href='?src=\ref[src];action=activate'>Activate Biogenerator!</A><BR>"
dat += "<A href='?src=\ref[src];action=detach'>Detach Container</A><BR><BR>" dat += "<A href='?src=\ref[src];action=detach'>Detach Container</A><BR><BR>"
dat += "Food<BR>" dat += "Food<BR>"
dat += "<A href='?src=\ref[src];action=create;item=milk;cost=20'>10 milk</A> <FONT COLOR=blue>(20)</FONT><BR>" dat += "<A href='?src=\ref[src];action=create;item=milk;cost=20'>10 milk</A> <FONT COLOR=blue>([round(20/build_eff)])</FONT><BR>"
dat += "<A href='?src=\ref[src];action=create;item=meat;cost=50'>Slab of meat</A> <FONT COLOR=blue>(50)</FONT><BR>" dat += "<A href='?src=\ref[src];action=create;item=meat;cost=50'>Slab of meat</A> <FONT COLOR=blue>([round(50/build_eff)])</FONT><BR>"
dat += "Nutrient<BR>" dat += "Nutrient<BR>"
dat += "<A href='?src=\ref[src];action=create;item=ez;cost=10'>E-Z-Nutrient</A> <FONT COLOR=blue>(10)</FONT> | <A href='?src=\ref[src];action=create;item=ez5;cost=50'>x5</A><BR>" dat += "<A href='?src=\ref[src];action=create;item=ez;cost=10'>E-Z-Nutrient</A> <FONT COLOR=blue>([round(10/build_eff)])</FONT> | <A href='?src=\ref[src];action=create;item=ez5;cost=50'>x5</A><BR>"
dat += "<A href='?src=\ref[src];action=create;item=l4z;cost=20'>Left 4 Zed</A> <FONT COLOR=blue>(20)</FONT> | <A href='?src=\ref[src];action=create;item=l4z5;cost=100'>x5</A><BR>" dat += "<A href='?src=\ref[src];action=create;item=l4z;cost=20'>Left 4 Zed</A> <FONT COLOR=blue>([round(20/build_eff)])</FONT> | <A href='?src=\ref[src];action=create;item=l4z5;cost=100'>x5</A><BR>"
dat += "<A href='?src=\ref[src];action=create;item=rh;cost=25'>Robust Harvest</A> <FONT COLOR=blue>(25)</FONT> | <A href='?src=\ref[src];action=create;item=rh5;cost=125'>x5</A><BR>" dat += "<A href='?src=\ref[src];action=create;item=rh;cost=25'>Robust Harvest</A> <FONT COLOR=blue>([round(25/build_eff)])</FONT> | <A href='?src=\ref[src];action=create;item=rh5;cost=125'>x5</A><BR>"
dat += "Leather<BR>" dat += "Leather<BR>"
dat += "<A href='?src=\ref[src];action=create;item=wallet;cost=100'>Wallet</A> <FONT COLOR=blue>(100)</FONT><BR>" dat += "<A href='?src=\ref[src];action=create;item=wallet;cost=100'>Wallet</A> <FONT COLOR=blue>([round(100/build_eff)])</FONT><BR>"
dat += "<A href='?src=\ref[src];action=create;item=gloves;cost=250'>Botanical gloves</A> <FONT COLOR=blue>(250)</FONT><BR>" dat += "<A href='?src=\ref[src];action=create;item=gloves;cost=250'>Botanical gloves</A> <FONT COLOR=blue>([round(250/build_eff)])</FONT><BR>"
dat += "<A href='?src=\ref[src];action=create;item=tbelt;cost=300'>Utility belt</A> <FONT COLOR=blue>(300)</FONT><BR>" dat += "<A href='?src=\ref[src];action=create;item=tbelt;cost=300'>Utility belt</A> <FONT COLOR=blue>([round(300/build_eff)])</FONT><BR>"
dat += "<A href='?src=\ref[src];action=create;item=satchel;cost=400'>Leather Satchel</A> <FONT COLOR=blue>(400)</FONT><BR>" dat += "<A href='?src=\ref[src];action=create;item=satchel;cost=400'>Leather Satchel</A> <FONT COLOR=blue>([round(400/build_eff)])</FONT><BR>"
dat += "<A href='?src=\ref[src];action=create;item=cashbag;cost=400'>Cash Bag</A> <FONT COLOR=blue>(400)</FONT><BR>" dat += "<A href='?src=\ref[src];action=create;item=cashbag;cost=400'>Cash Bag</A> <FONT COLOR=blue>([round(400/build_eff)])</FONT><BR>"
//dat += "Other<BR>" //dat += "Other<BR>"
//dat += "<A href='?src=\ref[src];action=create;item=monkey;cost=500'>Monkey</A> <FONT COLOR=blue>(500)</FONT><BR>" //dat += "<A href='?src=\ref[src];action=create;item=monkey;cost=500'>Monkey</A> <FONT COLOR=blue>(500)</FONT><BR>"
else else
@@ -122,34 +136,35 @@
interact(user) interact(user)
/obj/machinery/biogenerator/proc/activate() /obj/machinery/biogenerator/proc/activate()
if (usr.stat != 0) if (usr.stat)
return return
if (src.stat != 0) //NOPOWER etc if (stat) //NOPOWER etc
return return
if(src.processing) if(processing)
usr << "\red The biogenerator is in the process of working." usr << "<span class='notice'>The biogenerator is in the process of working.</span>"
return return
var/S = 0 var/S = 0
for(var/obj/item/weapon/reagent_containers/food/snacks/grown/I in contents) for(var/obj/item/weapon/reagent_containers/food/snacks/grown/I in contents)
S += 5 S += 5
if(I.reagents.get_reagent_amount("nutriment") < 0.1) if(I.reagents.get_reagent_amount("nutriment") < 0.1)
points += 1 points += 1
else points += I.reagents.get_reagent_amount("nutriment")*10 else points += I.reagents.get_reagent_amount("nutriment") * 10 * eat_eff
del(I) del(I)
if(S) if(S)
processing = 1 processing = 1
update_icon() update_icon()
updateUsrDialog() updateUsrDialog()
playsound(src.loc, 'sound/machines/blender.ogg', 50, 1) playsound(src.loc, 'sound/machines/blender.ogg', 50, 1)
use_power(S*30) use_power(S * 30)
sleep(S+15) sleep((S + 15) / eat_eff)
processing = 0 processing = 0
update_icon() update_icon()
else else
menustat = "void" menustat = "void"
return return
/obj/machinery/biogenerator/proc/create_product(var/item,var/cost) /obj/machinery/biogenerator/proc/create_product(var/item, var/cost)
cost = round(cost/build_eff)
if(cost > points) if(cost > points)
menustat = "nopoints" menustat = "nopoints"
return 0 return 0
@@ -160,45 +175,45 @@
sleep(30) sleep(30)
switch(item) switch(item)
if("milk") if("milk")
beaker.reagents.add_reagent("milk",10) beaker.reagents.add_reagent("milk", 10)
if("meat") if("meat")
new/obj/item/weapon/reagent_containers/food/snacks/meat(src.loc) new/obj/item/weapon/reagent_containers/food/snacks/meat(loc)
if("ez") if("ez")
new/obj/item/weapon/reagent_containers/glass/fertilizer/ez(src.loc) new/obj/item/weapon/reagent_containers/glass/fertilizer/ez(loc)
if("l4z") if("l4z")
new/obj/item/weapon/reagent_containers/glass/fertilizer/l4z(src.loc) new/obj/item/weapon/reagent_containers/glass/fertilizer/l4z(loc)
if("rh") if("rh")
new/obj/item/weapon/reagent_containers/glass/fertilizer/rh(src.loc) new/obj/item/weapon/reagent_containers/glass/fertilizer/rh(loc)
if("ez5") //It's not an elegant method, but it's safe and easy. -Cheridan if("ez5") //It's not an elegant method, but it's safe and easy. -Cheridan
new/obj/item/weapon/reagent_containers/glass/fertilizer/ez(src.loc) new/obj/item/weapon/reagent_containers/glass/fertilizer/ez(loc)
new/obj/item/weapon/reagent_containers/glass/fertilizer/ez(src.loc) new/obj/item/weapon/reagent_containers/glass/fertilizer/ez(loc)
new/obj/item/weapon/reagent_containers/glass/fertilizer/ez(src.loc) new/obj/item/weapon/reagent_containers/glass/fertilizer/ez(loc)
new/obj/item/weapon/reagent_containers/glass/fertilizer/ez(src.loc) new/obj/item/weapon/reagent_containers/glass/fertilizer/ez(loc)
new/obj/item/weapon/reagent_containers/glass/fertilizer/ez(src.loc) new/obj/item/weapon/reagent_containers/glass/fertilizer/ez(loc)
if("l4z5") if("l4z5")
new/obj/item/weapon/reagent_containers/glass/fertilizer/l4z(src.loc) new/obj/item/weapon/reagent_containers/glass/fertilizer/l4z(loc)
new/obj/item/weapon/reagent_containers/glass/fertilizer/l4z(src.loc) new/obj/item/weapon/reagent_containers/glass/fertilizer/l4z(loc)
new/obj/item/weapon/reagent_containers/glass/fertilizer/l4z(src.loc) new/obj/item/weapon/reagent_containers/glass/fertilizer/l4z(loc)
new/obj/item/weapon/reagent_containers/glass/fertilizer/l4z(src.loc) new/obj/item/weapon/reagent_containers/glass/fertilizer/l4z(loc)
new/obj/item/weapon/reagent_containers/glass/fertilizer/l4z(src.loc) new/obj/item/weapon/reagent_containers/glass/fertilizer/l4z(loc)
if("rh5") if("rh5")
new/obj/item/weapon/reagent_containers/glass/fertilizer/rh(src.loc) new/obj/item/weapon/reagent_containers/glass/fertilizer/rh(loc)
new/obj/item/weapon/reagent_containers/glass/fertilizer/rh(src.loc) new/obj/item/weapon/reagent_containers/glass/fertilizer/rh(loc)
new/obj/item/weapon/reagent_containers/glass/fertilizer/rh(src.loc) new/obj/item/weapon/reagent_containers/glass/fertilizer/rh(loc)
new/obj/item/weapon/reagent_containers/glass/fertilizer/rh(src.loc) new/obj/item/weapon/reagent_containers/glass/fertilizer/rh(loc)
new/obj/item/weapon/reagent_containers/glass/fertilizer/rh(src.loc) new/obj/item/weapon/reagent_containers/glass/fertilizer/rh(loc)
if("wallet") if("wallet")
new/obj/item/weapon/storage/wallet(src.loc) new/obj/item/weapon/storage/wallet(loc)
if("gloves") if("gloves")
new/obj/item/clothing/gloves/botanic_leather(src.loc) new/obj/item/clothing/gloves/botanic_leather(loc)
if("tbelt") if("tbelt")
new/obj/item/weapon/storage/belt/utility(src.loc) new/obj/item/weapon/storage/belt/utility(loc)
if("satchel") if("satchel")
new/obj/item/weapon/storage/backpack/satchel(src.loc) new/obj/item/weapon/storage/backpack/satchel(loc)
if("cashbag") if("cashbag")
new/obj/item/weapon/storage/bag/cash(src.loc) new/obj/item/weapon/storage/bag/cash(loc)
if("monkey") if("monkey")
new/mob/living/carbon/monkey(src.loc) new/mob/living/carbon/monkey(loc)
processing = 0 processing = 0
menustat = "complete" menustat = "complete"
update_icon() update_icon()
@@ -220,7 +235,21 @@
beaker = null beaker = null
update_icon() update_icon()
if("create") if("create")
create_product(href_list["item"],text2num(href_list["cost"])) create_product(href_list["item"], text2num(href_list["cost"]))
if("menu") if("menu")
menustat = "menu" menustat = "menu"
updateUsrDialog() updateUsrDialog()
/obj/machinery/biogenerator/RefreshParts()
..()
var/man_rating = 0
var/bin_rating = 0
for(var/obj/item/weapon/stock_parts/P in component_parts)
if(istype(P, /obj/item/weapon/stock_parts/matter_bin))
bin_rating += P.rating
if(istype(P, /obj/item/weapon/stock_parts/manipulator))
man_rating += P.rating
build_eff = man_rating
eat_eff = bin_rating

View File

@@ -14,138 +14,136 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis).
var/diamond_amount = 0 var/diamond_amount = 0
var/uranium_amount = 0 var/uranium_amount = 0
var/max_material_amount = 75000.0 var/max_material_amount = 75000.0
var/mat_efficiency = 1
use_power = 1 use_power = 1
idle_power_usage = 30 idle_power_usage = 30
active_power_usage = 2500 active_power_usage = 2500
New() /obj/machinery/r_n_d/circuit_imprinter/New()
..() ..()
component_parts = list() component_parts = list()
component_parts += new /obj/item/weapon/circuitboard/circuit_imprinter(src) component_parts += new /obj/item/weapon/circuitboard/circuit_imprinter(src)
component_parts += new /obj/item/weapon/stock_parts/matter_bin(src) component_parts += new /obj/item/weapon/stock_parts/matter_bin(src)
component_parts += new /obj/item/weapon/stock_parts/manipulator(src) component_parts += new /obj/item/weapon/stock_parts/manipulator(src)
component_parts += new /obj/item/weapon/reagent_containers/glass/beaker(src) component_parts += new /obj/item/weapon/reagent_containers/glass/beaker(src)
component_parts += new /obj/item/weapon/reagent_containers/glass/beaker(src) component_parts += new /obj/item/weapon/reagent_containers/glass/beaker(src)
RefreshParts()
RefreshParts() RefreshParts()
var/T = 0
for(var/obj/item/weapon/reagent_containers/glass/G in component_parts)
T += G.reagents.maximum_volume
var/datum/reagents/R = new/datum/reagents(T) //Holder for the reagents used as materials.
reagents = R
R.my_atom = src
T = 0
for(var/obj/item/weapon/stock_parts/matter_bin/M in component_parts)
T += M.rating
max_material_amount = T * 75000.0
/obj/machinery/r_n_d/circuit_imprinter/RefreshParts()
var/T = 0
for(var/obj/item/weapon/reagent_containers/glass/G in component_parts)
T += G.reagents.maximum_volume
var/datum/reagents/R = new/datum/reagents(T) //Holder for the reagents used as materials.
reagents = R
R.my_atom = src
T = 0
for(var/obj/item/weapon/stock_parts/matter_bin/M in component_parts)
T += M.rating
max_material_amount = T * 75000.0
T = 0
for(var/obj/item/weapon/stock_parts/manipulator/M in component_parts)
T += M.rating
mat_efficiency = 1 - (T - 1) / 4
blob_act() /obj/machinery/r_n_d/circuit_imprinter/update_icon()
if (prob(50)) if(panel_open)
del(src) icon_state = "circuit_imprinter_t"
else
icon_state = "circuit_imprinter"
meteorhit() /obj/machinery/r_n_d/circuit_imprinter/blob_act()
if(prob(50))
del(src) del(src)
/obj/machinery/r_n_d/circuit_imprinter/meteorhit()
del(src)
return
/obj/machinery/r_n_d/circuit_imprinter/proc/TotalMaterials()
return g_amount + gold_amount + diamond_amount + uranium_amount
/obj/machinery/r_n_d/circuit_imprinter/dismantle()
for(var/obj/I in component_parts)
if(istype(I, /obj/item/weapon/reagent_containers/glass/beaker))
reagents.trans_to(I, reagents.total_volume)
if(g_amount >= 3750)
var/obj/item/stack/sheet/glass/G = new /obj/item/stack/sheet/glass(loc)
G.amount = round(g_amount / 3750)
if(gold_amount >= 2000)
var/obj/item/stack/sheet/mineral/gold/G = new /obj/item/stack/sheet/mineral/gold(loc)
G.amount = round(gold_amount / 2000)
if(diamond_amount >= 2000)
var/obj/item/stack/sheet/mineral/diamond/G = new /obj/item/stack/sheet/mineral/diamond(loc)
G.amount = round(diamond_amount / 2000)
if(uranium_amount >= 2000)
var/obj/item/stack/sheet/mineral/uranium/G = new /obj/item/stack/sheet/mineral/uranium(loc)
G.amount = round(uranium_amount / 2000)
..()
/obj/machinery/r_n_d/circuit_imprinter/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(shocked)
shock(user, 50)
if(default_deconstruction_screwdriver(user, O))
if(linked_console)
linked_console.linked_imprinter = null
linked_console = null
return return
if(default_deconstruction_crowbar(user, O))
return
if(default_part_replacement(user, O))
return
if(panel_open)
user << "<span class='notice'>You can't load \the [src] while it's opened.</span>"
return 1
if(disabled)
user << "\The [src] appears to not be working!"
return
if(!linked_console)
user << "\The [src] must be linked to an R&D console first!"
return 1
if(O.is_open_container())
return 0
if(!istype(O, /obj/item/stack/sheet/glass) && !istype(O, /obj/item/stack/sheet/mineral/gold) && !istype(O, /obj/item/stack/sheet/mineral/diamond) && !istype(O, /obj/item/stack/sheet/mineral/uranium))
user << "<span class='notice'>You cannot insert this item into \the [src]!</span>"
return 1
if(stat)
return 1
if(busy)
user << "<span class='notice'>\The [src] is busy. Please wait for completion of previous operation.</span>"
return 1
var/obj/item/stack/sheet/stack = O
if((TotalMaterials() + stack.perunit) > max_material_amount)
user << "<span class='notice'>\The [src] is full. Please remove glass from \the [src] in order to insert more.</span>"
return 1
proc/TotalMaterials() var/amount = round(input("How many sheets do you want to add?") as num)
return g_amount + gold_amount + diamond_amount + uranium_amount if(amount < 0)
amount = 0
if(amount == 0)
return
if(amount > stack.amount)
amount = min(stack.amount, round((max_material_amount - TotalMaterials()) / stack.perunit))
attackby(var/obj/item/O as obj, var/mob/user as mob) busy = 1
if (shocked) use_power(max(1000, (3750 * amount / 10)))
shock(user,50) var/stacktype = stack.type
if (istype(O, /obj/item/weapon/screwdriver)) stack.use(amount)
if (!opened) if(do_after(usr, 16))
opened = 1 user << "<span class='notice'>You add [amount] sheets to \the [src].</span>"
if(linked_console) switch(stacktype)
linked_console.linked_imprinter = null if(/obj/item/stack/sheet/glass)
linked_console = null g_amount += amount * 3750
icon_state = "circuit_imprinter_t" if(/obj/item/stack/sheet/mineral/gold)
user << "You open the maintenance hatch of [src]." gold_amount += amount * 2000
else if(/obj/item/stack/sheet/mineral/diamond)
opened = 0 diamond_amount += amount * 2000
icon_state = "circuit_imprinter" if(/obj/item/stack/sheet/mineral/uranium)
user << "You close the maintenance hatch of [src]." uranium_amount += amount * 2000
return else
if (opened) new stacktype(loc, amount)
if(istype(O, /obj/item/weapon/crowbar)) busy = 0
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1) updateUsrDialog()
var/obj/machinery/constructable_frame/machine_frame/M = new /obj/machinery/constructable_frame/machine_frame(src.loc)
M.state = 2
M.icon_state = "box_1"
for(var/obj/I in component_parts)
if(istype(I, /obj/item/weapon/reagent_containers/glass/beaker))
reagents.trans_to(I, reagents.total_volume)
if(I.reliability != 100 && crit_fail)
I.crit_fail = 1
I.loc = src.loc
if(g_amount >= 3750)
var/obj/item/stack/sheet/glass/G = new /obj/item/stack/sheet/glass(src.loc)
G.amount = round(g_amount / 3750)
if(gold_amount >= 2000)
var/obj/item/stack/sheet/mineral/gold/G = new /obj/item/stack/sheet/mineral/gold(src.loc)
G.amount = round(gold_amount / 2000)
if(diamond_amount >= 2000)
var/obj/item/stack/sheet/mineral/diamond/G = new /obj/item/stack/sheet/mineral/diamond(src.loc)
G.amount = round(diamond_amount / 2000)
if(uranium_amount >= 2000)
var/obj/item/stack/sheet/mineral/uranium/G = new /obj/item/stack/sheet/mineral/uranium(src.loc)
G.amount = round(uranium_amount / 2000)
del(src)
return 1
else
user << "\red You can't load the [src.name] while it's opened."
return 1
if (disabled)
user << "\The [name] appears to not be working!"
return
if (!linked_console)
user << "\The [name] must be linked to an R&D console first!"
return 1
if (O.is_open_container())
return 0
if (!istype(O, /obj/item/stack/sheet/glass) && !istype(O, /obj/item/stack/sheet/mineral/gold) && !istype(O, /obj/item/stack/sheet/mineral/diamond) && !istype(O, /obj/item/stack/sheet/mineral/uranium))
user << "\red You cannot insert this item into the [name]!"
return 1
if (stat)
return 1
if (busy)
user << "\red The [name] is busy. Please wait for completion of previous operation."
return 1
var/obj/item/stack/sheet/stack = O
if ((TotalMaterials() + stack.perunit) > max_material_amount)
user << "\red The [name] is full. Please remove glass from the protolathe in order to insert more."
return 1
var/amount = round(input("How many sheets do you want to add?") as num)
if(amount < 0)
amount = 0
if(amount == 0)
return
if(amount > stack.amount)
amount = min(stack.amount, round((max_material_amount-TotalMaterials())/stack.perunit))
busy = 1
use_power(max(1000, (3750*amount/10)))
var/stacktype = stack.type
stack.use(amount)
if(do_after(usr,16))
user << "\blue You add [amount] sheets to the [src.name]."
switch(stacktype)
if(/obj/item/stack/sheet/glass)
g_amount += amount * 3750
if(/obj/item/stack/sheet/mineral/gold)
gold_amount += amount * 2000
if(/obj/item/stack/sheet/mineral/diamond)
diamond_amount += amount * 2000
if(/obj/item/stack/sheet/mineral/uranium)
uranium_amount += amount * 2000
else
new stacktype(src.loc, amount)
busy = 0
src.updateUsrDialog()
//This is to stop these machines being hackable via clicking. //This is to stop these machines being hackable via clicking.
/obj/machinery/r_n_d/circuit_imprinter/attack_hand(mob/user as mob) /obj/machinery/r_n_d/circuit_imprinter/attack_hand(mob/user as mob)

View File

@@ -760,6 +760,14 @@ datum/design/item/stock_part/AssembleDesignDesc()
if(!desc) if(!desc)
desc = "A stock part used in the construction of various devices." desc = "A stock part used in the construction of various devices."
/datum/design/item/stock_part/RPED
name = "Rapid Part Exchange Device"
desc = "Special mechanical module made to store, sort, and apply standard machine parts."
id = "rped"
req_tech = list("engineering" = 3, "materials" = 3)
materials = list("$metal" = 15000, "$glass" = 5000)
build_path = /obj/item/weapon/storage/part_replacer
datum/design/item/stock_part/basic_capacitor datum/design/item/stock_part/basic_capacitor
build_type = PROTOLATHE | AUTOLATHE build_type = PROTOLATHE | AUTOLATHE
id = "basic_capacitor" id = "basic_capacitor"
@@ -971,6 +979,18 @@ datum/design/circuit/secure_airlock
req_tech = list("programming" = 3) req_tech = list("programming" = 3)
build_path = /obj/item/weapon/airlock_electronics/secure build_path = /obj/item/weapon/airlock_electronics/secure
datum/design/circuit/biogenerator
name = "biogenerator"
id = "biogenerator"
req_tech = list("programming" = 2)
build_path = /obj/item/weapon/circuitboard/biogenerator
datum/design/circuit/recharge_station
name = "cyborg recharge station"
id = "recharge_station"
req_tech = list("programming" = 3, "engineering" = 2)
build_path = /obj/item/weapon/circuitboard/recharge_station
///////////////////////////////////////// /////////////////////////////////////////
////////Power Stuff Circuitboards//////// ////////Power Stuff Circuitboards////////
///////////////////////////////////////// /////////////////////////////////////////

View File

@@ -12,6 +12,7 @@ Note: Must be placed within 3 tiles of the R&D Console
icon_state = "d_analyzer" icon_state = "d_analyzer"
var/obj/item/weapon/loaded_item = null var/obj/item/weapon/loaded_item = null
var/decon_mod = 1 var/decon_mod = 1
var/min_reliability = 90
use_power = 1 use_power = 1
idle_power_usage = 30 idle_power_usage = 30
@@ -29,9 +30,9 @@ Note: Must be placed within 3 tiles of the R&D Console
/obj/machinery/r_n_d/destructive_analyzer/RefreshParts() /obj/machinery/r_n_d/destructive_analyzer/RefreshParts()
var/T = 0 var/T = 0
for(var/obj/item/weapon/stock_parts/S in src) for(var/obj/item/weapon/stock_parts/S in src)
T += S.rating * 0.1 T += S.rating
T = between (0, T, 1) decon_mod = T * 0.1
decon_mod = T min_reliability = 93 - T
/obj/machinery/r_n_d/destructive_analyzer/meteorhit() /obj/machinery/r_n_d/destructive_analyzer/meteorhit()
del(src) del(src)
@@ -43,65 +44,58 @@ Note: Must be placed within 3 tiles of the R&D Console
temp_list[O] = text2num(temp_list[O]) temp_list[O] = text2num(temp_list[O])
return temp_list return temp_list
/obj/machinery/r_n_d/destructive_analyzer/update_icon()
if(panel_open)
icon_state = "d_analyzer_t"
else if(loaded_item)
icon_state = "d_analyzer_l"
else
icon_state = "d_analyzer"
/obj/machinery/r_n_d/destructive_analyzer/attackby(var/obj/O as obj, var/mob/user as mob) /obj/machinery/r_n_d/destructive_analyzer/attackby(var/obj/O as obj, var/mob/user as mob)
if (shocked) if(shocked)
shock(user,50) shock(user, 50)
if (istype(O, /obj/item/weapon/screwdriver)) if(default_deconstruction_screwdriver(user, O))
if (!opened) if(linked_console)
opened = 1 linked_console.linked_destroy = null
if(linked_console) linked_console = null
linked_console.linked_destroy = null
linked_console = null
icon_state = "d_analyzer_t"
user << "You open the maintenance hatch of [src]."
else
opened = 0
icon_state = "d_analyzer"
user << "You close the maintenance hatch of [src]."
return return
if (opened) if(default_deconstruction_crowbar(user, O))
if(istype(O, /obj/item/weapon/crowbar))
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)
var/obj/machinery/constructable_frame/machine_frame/M = new /obj/machinery/constructable_frame/machine_frame(src.loc)
M.state = 2
M.icon_state = "box_1"
for(var/obj/I in component_parts)
I.loc = src.loc
del(src)
return 1
else
user << "\red You can't load the [src.name] while it's opened."
return 1
if (disabled)
return return
if (!linked_console) if(default_part_replacement(user, O))
user << "\red The destructive analyzer must be linked to an R&D console first!"
return return
if (busy) if(panel_open)
user << "\red The destructive analyzer is busy right now." user << "<span class='notice'>You can't load \the [src] while it's opened.</span>"
return 1
if(disabled)
return return
if (istype(O, /obj/item) && !loaded_item) if(!linked_console)
user << "<span class='notice'>\The [src] must be linked to an R&D console first!</span>"
return
if(busy)
user << "<span class='notice'>\The [src] is busy right now.</span>"
return
if(istype(O, /obj/item) && !loaded_item)
if(isrobot(user)) //Don't put your module items in there! if(isrobot(user)) //Don't put your module items in there!
return return
if(!O.origin_tech) if(!O.origin_tech)
user << "\red This doesn't seem to have a tech origin!" user << "<span class='notice'>This doesn't seem to have a tech origin!</span>"
return return
var/list/temp_tech = ConvertReqString2List(O.origin_tech) var/list/temp_tech = ConvertReqString2List(O.origin_tech)
if (temp_tech.len == 0) if(temp_tech.len == 0)
user << "\red You cannot deconstruct this item!" user << "<span class='notice'>You cannot deconstruct this item!</span>"
return return
if(O.reliability < 90 && O.crit_fail == 0) if(O.reliability < min_reliability && O.crit_fail == 0)
usr << "\red Item is neither reliable enough nor broken enough to learn from." usr << "<span class='warning'>Item is neither reliable enough nor broken enough to learn from.</span>"
return return
busy = 1 busy = 1
loaded_item = O loaded_item = O
user.drop_item() user.drop_item()
O.loc = src O.loc = src
user << "\blue You add the [O.name] to the machine!" user << "<span class='notice'>You add \the [O] to \the [src]!</span>"
flick("d_analyzer_la", src) flick("d_analyzer_la", src)
spawn(10) spawn(10)
icon_state = "d_analyzer_l" update_icon()
busy = 0 busy = 0
return 1 return 1
return return

View File

@@ -25,6 +25,8 @@ Note: Must be placed west/left of and R&D console to function.
var/uranium_amount = 0.0 var/uranium_amount = 0.0
var/diamond_amount = 0.0 var/diamond_amount = 0.0
var/mat_efficiency = 1
/obj/machinery/r_n_d/protolathe/New() /obj/machinery/r_n_d/protolathe/New()
..() ..()
component_parts = list() component_parts = list()
@@ -51,80 +53,78 @@ Note: Must be placed west/left of and R&D console to function.
for(var/obj/item/weapon/stock_parts/matter_bin/M in component_parts) for(var/obj/item/weapon/stock_parts/matter_bin/M in component_parts)
T += M.rating T += M.rating
max_material_storage = T * 75000 max_material_storage = T * 75000
T = 0
for(var/obj/item/weapon/stock_parts/manipulator/M in component_parts)
T += M.rating
mat_efficiency = 1 - (T - 2) / 8
/obj/machinery/r_n_d/protolathe/dismantle()
for(var/obj/I in component_parts)
if(istype(I, /obj/item/weapon/reagent_containers/glass/beaker))
reagents.trans_to(I, reagents.total_volume)
if(m_amount >= 3750)
var/obj/item/stack/sheet/metal/G = new /obj/item/stack/sheet/metal(loc)
G.amount = round(m_amount / G.perunit)
if(g_amount >= 3750)
var/obj/item/stack/sheet/glass/G = new /obj/item/stack/sheet/glass(loc)
G.amount = round(g_amount / G.perunit)
if(phoron_amount >= 2000)
var/obj/item/stack/sheet/mineral/phoron/G = new /obj/item/stack/sheet/mineral/phoron(loc)
G.amount = round(phoron_amount / G.perunit)
if(silver_amount >= 2000)
var/obj/item/stack/sheet/mineral/silver/G = new /obj/item/stack/sheet/mineral/silver(loc)
G.amount = round(silver_amount / G.perunit)
if(gold_amount >= 2000)
var/obj/item/stack/sheet/mineral/gold/G = new /obj/item/stack/sheet/mineral/gold(loc)
G.amount = round(gold_amount / G.perunit)
if(uranium_amount >= 2000)
var/obj/item/stack/sheet/mineral/uranium/G = new /obj/item/stack/sheet/mineral/uranium(loc)
G.amount = round(uranium_amount / G.perunit)
if(diamond_amount >= 2000)
var/obj/item/stack/sheet/mineral/diamond/G = new /obj/item/stack/sheet/mineral/diamond(loc)
G.amount = round(diamond_amount / G.perunit)
..()
/obj/machinery/r_n_d/protolathe/update_icon()
if(panel_open)
icon_state = "protolathe_t"
else
icon_state = "protolathe"
/obj/machinery/r_n_d/protolathe/attackby(var/obj/item/O as obj, var/mob/user as mob) /obj/machinery/r_n_d/protolathe/attackby(var/obj/item/O as obj, var/mob/user as mob)
if (shocked) if(shocked)
shock(user,50) shock(user, 50)
if (O.is_open_container()) if(default_deconstruction_screwdriver(user, O))
return 1 if(linked_console)
if (istype(O, /obj/item/weapon/screwdriver)) linked_console.linked_lathe = null
if (!opened) linked_console = null
opened = 1
if(linked_console)
linked_console.linked_lathe = null
linked_console = null
icon_state = "protolathe_t"
user << "You open the maintenance hatch of [src]."
else
opened = 0
icon_state = "protolathe"
user << "You close the maintenance hatch of [src]."
return return
if (opened) if(default_deconstruction_crowbar(user, O))
if(istype(O, /obj/item/weapon/crowbar))
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)
var/obj/machinery/constructable_frame/machine_frame/M = new /obj/machinery/constructable_frame/machine_frame(src.loc)
M.state = 2
M.icon_state = "box_1"
for(var/obj/I in component_parts)
if(istype(I, /obj/item/weapon/reagent_containers/glass/beaker))
reagents.trans_to(I, reagents.total_volume)
if(I.reliability != 100 && crit_fail)
I.crit_fail = 1
I.loc = src.loc
if(m_amount >= 3750)
var/obj/item/stack/sheet/metal/G = new /obj/item/stack/sheet/metal(src.loc)
G.amount = round(m_amount / G.perunit)
if(g_amount >= 3750)
var/obj/item/stack/sheet/glass/G = new /obj/item/stack/sheet/glass(src.loc)
G.amount = round(g_amount / G.perunit)
if(phoron_amount >= 2000)
var/obj/item/stack/sheet/mineral/phoron/G = new /obj/item/stack/sheet/mineral/phoron(src.loc)
G.amount = round(phoron_amount / G.perunit)
if(silver_amount >= 2000)
var/obj/item/stack/sheet/mineral/silver/G = new /obj/item/stack/sheet/mineral/silver(src.loc)
G.amount = round(silver_amount / G.perunit)
if(gold_amount >= 2000)
var/obj/item/stack/sheet/mineral/gold/G = new /obj/item/stack/sheet/mineral/gold(src.loc)
G.amount = round(gold_amount / G.perunit)
if(uranium_amount >= 2000)
var/obj/item/stack/sheet/mineral/uranium/G = new /obj/item/stack/sheet/mineral/uranium(src.loc)
G.amount = round(uranium_amount / G.perunit)
if(diamond_amount >= 2000)
var/obj/item/stack/sheet/mineral/diamond/G = new /obj/item/stack/sheet/mineral/diamond(src.loc)
G.amount = round(diamond_amount / G.perunit)
del(src)
return 1
else
user << "\red You can't load the [src.name] while it's opened."
return 1
if (disabled)
return return
if (!linked_console) if(default_part_replacement(user, O))
user << "\The protolathe must be linked to an R&D console first!" return
if(O.is_open_container())
return 1 return 1
if (busy) if(panel_open)
user << "\red The protolathe is busy. Please wait for completion of previous operation." user << "<span class='notice'>You can't load \the [src] while it's opened.</span>"
return 1 return 1
if (!istype(O, /obj/item/stack/sheet)) if(disabled)
user << "\red You cannot insert this item into the protolathe!" return
if(!linked_console)
user << "<span class='notice'>\The [src] must be linked to an R&D console first!</span>"
return 1 return 1
if (stat) if(busy)
user << "<span class='notice'>\The [src] is busy. Please wait for completion of previous operation.</span>"
return 1
if(!istype(O, /obj/item/stack/sheet))
user << "<span class='notice'>You cannot insert this item into \the [src]!</span>"
return 1
if(stat)
return 1 return 1
if(istype(O,/obj/item/stack/sheet)) if(istype(O,/obj/item/stack/sheet))
var/obj/item/stack/sheet/S = O var/obj/item/stack/sheet/S = O
if (TotalMaterials() + S.perunit > max_material_storage) if(TotalMaterials() + S.perunit > max_material_storage)
user << "\red The protolathe's material bin is full. Please remove material before adding more." user << "<span class='notice'>\The [src]'s material bin is full. Please remove material before adding more.</span>"
return 1 return 1
var/obj/item/stack/sheet/stack = O var/obj/item/stack/sheet/stack = O
@@ -137,20 +137,20 @@ Note: Must be placed west/left of and R&D console to function.
return return
if(amount > stack.get_amount()) if(amount > stack.get_amount())
amount = stack.get_amount() amount = stack.get_amount()
if(max_material_storage - TotalMaterials() < (amount*stack.perunit))//Can't overfill if(max_material_storage - TotalMaterials() < (amount * stack.perunit))//Can't overfill
amount = min(stack.amount, round((max_material_storage-TotalMaterials())/stack.perunit)) amount = min(stack.amount, round((max_material_storage - TotalMaterials()) / stack.perunit))
src.overlays += "protolathe_[stack.name]" overlays += "protolathe_[stack.name]"
sleep(10) sleep(10)
src.overlays -= "protolathe_[stack.name]" overlays -= "protolathe_[stack.name]"
icon_state = "protolathe" icon_state = "protolathe"
busy = 1 busy = 1
use_power(max(1000, (3750*amount/10))) use_power(max(1000, (3750 * amount / 10)))
var/stacktype = stack.type var/stacktype = stack.type
stack.use(amount) stack.use(amount)
if (do_after(user, 16)) if(do_after(user, 16))
user << "\blue You add [amount] sheets to the [src.name]." user << "<span class='notice'>You add [amount] sheets to \the [src].</span>"
icon_state = "protolathe" icon_state = "protolathe"
switch(stacktype) switch(stacktype)
if(/obj/item/stack/sheet/metal) if(/obj/item/stack/sheet/metal)
@@ -168,9 +168,9 @@ Note: Must be placed west/left of and R&D console to function.
if(/obj/item/stack/sheet/mineral/diamond) if(/obj/item/stack/sheet/mineral/diamond)
diamond_amount += amount * 2000 diamond_amount += amount * 2000
else else
new stacktype(src.loc, amount) new stacktype(loc, amount)
busy = 0 busy = 0
src.updateUsrDialog() updateUsrDialog()
return return
//This is to stop these machines being hackable via clicking. //This is to stop these machines being hackable via clicking.

View File

@@ -93,7 +93,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
/obj/machinery/computer/rdconsole/proc/SyncRDevices() //Makes sure it is properly sync'ed up with the devices attached to it (if any). /obj/machinery/computer/rdconsole/proc/SyncRDevices() //Makes sure it is properly sync'ed up with the devices attached to it (if any).
for(var/obj/machinery/r_n_d/D in oview(3,src)) for(var/obj/machinery/r_n_d/D in oview(3,src))
if(D.linked_console != null || D.disabled || D.opened) if(D.linked_console != null || D.disabled || D.panel_open)
continue continue
if(istype(D, /obj/machinery/r_n_d/destructive_analyzer)) if(istype(D, /obj/machinery/r_n_d/destructive_analyzer))
if(linked_destroy == null) if(linked_destroy == null)
@@ -255,7 +255,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
usr <<"\red The destructive analyzer appears to be empty." usr <<"\red The destructive analyzer appears to be empty."
screen = 1.0 screen = 1.0
return return
if(linked_destroy.loaded_item.reliability >= 90) if(linked_destroy.loaded_item.reliability >= linked_destroy.min_reliability)
var/list/temp_tech = linked_destroy.ConvertReqString2List(linked_destroy.loaded_item.origin_tech) var/list/temp_tech = linked_destroy.ConvertReqString2List(linked_destroy.loaded_item.origin_tech)
for(var/T in temp_tech) for(var/T in temp_tech)
files.UpdateTech(T, temp_tech[T]) files.UpdateTech(T, temp_tech[T])
@@ -347,21 +347,21 @@ won't update every console in existence) but it's more of a hassle to do. Also,
for(var/M in being_built.materials) for(var/M in being_built.materials)
switch(M) switch(M)
if("$metal") if("$metal")
linked_lathe.m_amount = max(0, (linked_lathe.m_amount-being_built.materials[M])) linked_lathe.m_amount = max(0, (linked_lathe.m_amount-being_built.materials[M]*linked_lathe.mat_efficiency))
if("$glass") if("$glass")
linked_lathe.g_amount = max(0, (linked_lathe.g_amount-being_built.materials[M])) linked_lathe.g_amount = max(0, (linked_lathe.g_amount-being_built.materials[M]*linked_lathe.mat_efficiency))
if("$gold") if("$gold")
linked_lathe.gold_amount = max(0, (linked_lathe.gold_amount-being_built.materials[M])) linked_lathe.gold_amount = max(0, (linked_lathe.gold_amount-being_built.materials[M]*linked_lathe.mat_efficiency))
if("$silver") if("$silver")
linked_lathe.silver_amount = max(0, (linked_lathe.silver_amount-being_built.materials[M])) linked_lathe.silver_amount = max(0, (linked_lathe.silver_amount-being_built.materials[M]*linked_lathe.mat_efficiency))
if("$phoron") if("$phoron")
linked_lathe.phoron_amount = max(0, (linked_lathe.phoron_amount-being_built.materials[M])) linked_lathe.phoron_amount = max(0, (linked_lathe.phoron_amount-being_built.materials[M]*linked_lathe.mat_efficiency))
if("$uranium") if("$uranium")
linked_lathe.uranium_amount = max(0, (linked_lathe.uranium_amount-being_built.materials[M])) linked_lathe.uranium_amount = max(0, (linked_lathe.uranium_amount-being_built.materials[M]*linked_lathe.mat_efficiency))
if("$diamond") if("$diamond")
linked_lathe.diamond_amount = max(0, (linked_lathe.diamond_amount-being_built.materials[M])) linked_lathe.diamond_amount = max(0, (linked_lathe.diamond_amount-being_built.materials[M]*linked_lathe.mat_efficiency))
else else
linked_lathe.reagents.remove_reagent(M, being_built.materials[M]) linked_lathe.reagents.remove_reagent(M, being_built.materials[M]*linked_lathe.mat_efficiency)
if(being_built.build_path) if(being_built.build_path)
var/obj/new_item = new being_built.build_path(src) var/obj/new_item = new being_built.build_path(src)
@@ -375,6 +375,10 @@ won't update every console in existence) but it's more of a hassle to do. Also,
L.name += " ([new_item.name])"*/ L.name += " ([new_item.name])"*/
else else
new_item.loc = linked_lathe.loc new_item.loc = linked_lathe.loc
if(linked_lathe.mat_efficiency != 1) // No matter out of nowhere
if(new_item.matter && new_item.matter.len > 0)
for(var/i in new_item.matter)
new_item.matter[i] = new_item.matter[i] * linked_lathe.mat_efficiency
linked_lathe.busy = 0 linked_lathe.busy = 0
screen = 3.1 screen = 3.1
errored = 0 errored = 0
@@ -401,15 +405,15 @@ won't update every console in existence) but it's more of a hassle to do. Also,
for(var/M in being_built.materials) for(var/M in being_built.materials)
switch(M) switch(M)
if("$glass") if("$glass")
linked_imprinter.g_amount = max(0, (linked_imprinter.g_amount-being_built.materials[M])) linked_imprinter.g_amount = max(0, (linked_imprinter.g_amount-being_built.materials[M]*linked_imprinter.mat_efficiency))
if("$gold") if("$gold")
linked_imprinter.gold_amount = max(0, (linked_imprinter.gold_amount-being_built.materials[M])) linked_imprinter.gold_amount = max(0, (linked_imprinter.gold_amount-being_built.materials[M]*linked_imprinter.mat_efficiency))
if("$diamond") if("$diamond")
linked_imprinter.diamond_amount = max(0, (linked_imprinter.diamond_amount-being_built.materials[M])) linked_imprinter.diamond_amount = max(0, (linked_imprinter.diamond_amount-being_built.materials[M]*linked_imprinter.mat_efficiency))
if("$uranium") if("$uranium")
linked_imprinter.uranium_amount = max(0, (linked_imprinter.uranium_amount-being_built.materials[M])) linked_imprinter.uranium_amount = max(0, (linked_imprinter.uranium_amount-being_built.materials[M]*linked_imprinter.mat_efficiency))
else else
linked_imprinter.reagents.remove_reagent(M, being_built.materials[M]) linked_imprinter.reagents.remove_reagent(M, being_built.materials[M]*linked_imprinter.mat_efficiency)
var/obj/new_item = new being_built.build_path(src) var/obj/new_item = new being_built.build_path(src)
new_item.reliability = being_built.reliability new_item.reliability = being_built.reliability
if(linked_imprinter.hacked) being_built.reliability = max((reliability / 2), 0) if(linked_imprinter.hacked) being_built.reliability = max((reliability / 2), 0)
@@ -752,6 +756,10 @@ won't update every console in existence) but it's more of a hassle to do. Also,
var/list/temp_tech = linked_destroy.ConvertReqString2List(linked_destroy.loaded_item.origin_tech) var/list/temp_tech = linked_destroy.ConvertReqString2List(linked_destroy.loaded_item.origin_tech)
for(var/T in temp_tech) for(var/T in temp_tech)
dat += "<LI>[CallTechName(T)] [temp_tech[T]]" dat += "<LI>[CallTechName(T)] [temp_tech[T]]"
for(var/datum/tech/F in files.known_tech)
if(F.name == CallTechName(T))
dat += " (Current: [F.level])"
break
dat += "</UL>" dat += "</UL>"
dat += "<HR><A href='?src=\ref[src];deconstruct=1'>Deconstruct Item</A> || " dat += "<HR><A href='?src=\ref[src];deconstruct=1'>Deconstruct Item</A> || "
dat += "<A href='?src=\ref[src];eject_item=1'>Eject Item</A> || " dat += "<A href='?src=\ref[src];eject_item=1'>Eject Item</A> || "
@@ -775,31 +783,33 @@ won't update every console in existence) but it's more of a hassle to do. Also,
var/temp_dat var/temp_dat
var/check_materials = 1 var/check_materials = 1
for(var/M in D.materials) for(var/M in D.materials)
temp_dat += ", [D.materials[M]] [CallMaterialName(M)]" temp_dat += ", [D.materials[M]*linked_lathe.mat_efficiency] [CallMaterialName(M)]"
if(copytext(M, 1, 2) == "$") if(copytext(M, 1, 2) == "$")
switch(M) switch(M)
if("$glass") if("$glass")
if(D.materials[M] > linked_lathe.g_amount) check_materials = 0 if(D.materials[M]*linked_lathe.mat_efficiency > linked_lathe.g_amount) check_materials = 0
if("$metal") if("$metal")
if(D.materials[M] > linked_lathe.m_amount) check_materials = 0 if(D.materials[M]*linked_lathe.mat_efficiency > linked_lathe.m_amount) check_materials = 0
if("$gold") if("$gold")
if(D.materials[M] > linked_lathe.gold_amount) check_materials = 0 if(D.materials[M]*linked_lathe.mat_efficiency > linked_lathe.gold_amount) check_materials = 0
if("$silver") if("$silver")
if(D.materials[M] > linked_lathe.silver_amount) check_materials = 0 if(D.materials[M]*linked_lathe.mat_efficiency > linked_lathe.silver_amount) check_materials = 0
if("$phoron") if("$phoron")
if(D.materials[M] > linked_lathe.phoron_amount) check_materials = 0 if(D.materials[M]*linked_lathe.mat_efficiency > linked_lathe.phoron_amount) check_materials = 0
if("$uranium") if("$uranium")
if(D.materials[M] > linked_lathe.uranium_amount) check_materials = 0 if(D.materials[M]*linked_lathe.mat_efficiency > linked_lathe.uranium_amount) check_materials = 0
if("$diamond") if("$diamond")
if(D.materials[M] > linked_lathe.diamond_amount) check_materials = 0 if(D.materials[M]*linked_lathe.mat_efficiency > linked_lathe.diamond_amount) check_materials = 0
else if (!linked_lathe.reagents.has_reagent(M, D.materials[M])) else if (!linked_lathe.reagents.has_reagent(M, D.materials[M]*linked_lathe.mat_efficiency))
check_materials = 0 check_materials = 0
if(temp_dat) if(temp_dat)
temp_dat = " \[[copytext(temp_dat,3)]\]" temp_dat = " \[[copytext(temp_dat,3)]\]"
if (check_materials) if(check_materials)
dat += "<LI><B><A href='?src=\ref[src];build=[D.id]'>[D.name]</A></B>[temp_dat]" dat += "<LI><B><A href='?src=\ref[src];build=[D.id]'>[D.name]</A></B>[temp_dat]"
else else
dat += "<LI><B>[D.name]</B>[temp_dat]" dat += "<LI><B>[D.name]</B>[temp_dat]"
if(D.reliability < 100)
dat += " (Reliability: [D.reliability])"
dat += "</UL>" dat += "</UL>"
if(3.2) //Protolathe Material Storage Sub-menu if(3.2) //Protolathe Material Storage Sub-menu
@@ -869,18 +879,18 @@ won't update every console in existence) but it's more of a hassle to do. Also,
var/temp_dat var/temp_dat
var/check_materials = 1 var/check_materials = 1
for(var/M in D.materials) for(var/M in D.materials)
temp_dat += ", [D.materials[M]] [CallMaterialName(M)]" temp_dat += ", [D.materials[M]*linked_imprinter.mat_efficiency] [CallMaterialName(M)]"
if(copytext(M, 1, 2) == "$") if(copytext(M, 1, 2) == "$")
switch(M) switch(M)
if("$glass") if("$glass")
if(D.materials[M] > linked_imprinter.g_amount) check_materials = 0 if(D.materials[M]*linked_imprinter.mat_efficiency > linked_imprinter.g_amount) check_materials = 0
if("$gold") if("$gold")
if(D.materials[M] > linked_imprinter.gold_amount) check_materials = 0 if(D.materials[M]*linked_imprinter.mat_efficiency > linked_imprinter.gold_amount) check_materials = 0
if("$diamond") if("$diamond")
if(D.materials[M] > linked_imprinter.diamond_amount) check_materials = 0 if(D.materials[M]*linked_imprinter.mat_efficiency > linked_imprinter.diamond_amount) check_materials = 0
if("$uranium") if("$uranium")
if(D.materials[M] > linked_imprinter.uranium_amount) check_materials = 0 if(D.materials[M]*linked_imprinter.mat_efficiency > linked_imprinter.uranium_amount) check_materials = 0
else if (!linked_imprinter.reagents.has_reagent(M, D.materials[M])) else if (!linked_imprinter.reagents.has_reagent(M, D.materials[M]*linked_imprinter.mat_efficiency))
check_materials = 0 check_materials = 0
if(temp_dat) if(temp_dat)
temp_dat = " \[[copytext(temp_dat,3)]\]" temp_dat = " \[[copytext(temp_dat,3)]\]"
@@ -888,6 +898,8 @@ won't update every console in existence) but it's more of a hassle to do. Also,
dat += "<LI><B><A href='?src=\ref[src];imprint=[D.id]'>[D.name]</A></B>[temp_dat]" dat += "<LI><B><A href='?src=\ref[src];imprint=[D.id]'>[D.name]</A></B>[temp_dat]"
else else
dat += "<LI><B>[D.name]</B>[temp_dat]" dat += "<LI><B>[D.name]</B>[temp_dat]"
if(D.reliability < 100)
dat += " (Reliability: [D.reliability])"
dat += "</UL>" dat += "</UL>"
if(4.2) if(4.2)

View File

@@ -17,7 +17,6 @@
var/hack_wire var/hack_wire
var/disable_wire var/disable_wire
var/shock_wire var/shock_wire
var/opened = 0
var/obj/machinery/computer/rdconsole/linked_console var/obj/machinery/computer/rdconsole/linked_console
/obj/machinery/r_n_d/New() /obj/machinery/r_n_d/New()
@@ -39,7 +38,7 @@
/obj/machinery/r_n_d/attack_hand(mob/user as mob) /obj/machinery/r_n_d/attack_hand(mob/user as mob)
if (shocked) if (shocked)
shock(user,50) shock(user,50)
if(opened) if(panel_open)
var/dat as text var/dat as text
dat += "[src.name] Wires:<BR>" dat += "[src.name] Wires:<BR>"
for(var/wire in src.wires) for(var/wire in src.wires)

View File

@@ -103,7 +103,7 @@
/obj/machinery/r_n_d/server/proc/produce_heat() /obj/machinery/r_n_d/server/proc/produce_heat()
if (!produces_heat) if (!produces_heat)
return return
if (!use_power) if (!use_power)
return return
@@ -118,7 +118,7 @@
if(removed) if(removed)
var/heat_produced = idle_power_usage //obviously can't produce more heat than the machine draws from it's power source var/heat_produced = idle_power_usage //obviously can't produce more heat than the machine draws from it's power source
removed.add_thermal_energy(heat_produced) removed.add_thermal_energy(heat_produced)
env.merge(removed) env.merge(removed)
@@ -129,16 +129,16 @@
if (shocked) if (shocked)
shock(user,50) shock(user,50)
if (istype(O, /obj/item/weapon/screwdriver)) if (istype(O, /obj/item/weapon/screwdriver))
if (!opened) if (!panel_open)
opened = 1 panel_open = 1
icon_state = "server_o" icon_state = "server_o"
user << "You open the maintenance hatch of [src]." user << "You open the maintenance hatch of [src]."
else else
opened = 0 panel_open = 0
icon_state = "server" icon_state = "server"
user << "You close the maintenance hatch of [src]." user << "You close the maintenance hatch of [src]."
return return
if (opened) if (panel_open)
if(istype(O, /obj/item/weapon/crowbar)) if(istype(O, /obj/item/weapon/crowbar))
griefProtection() griefProtection()
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1) playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 KiB

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 KiB

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB