From 7a1a22f8fa70aef01ca0ed07e1d36aea0380e3fc Mon Sep 17 00:00:00 2001 From: "sieve32@gmail.com" Date: Mon, 30 Jul 2012 17:32:26 +0000 Subject: [PATCH] -Gets rid of a global list proc that shouldn't be there -Removes the typecasting from mech fabs so they stop spitting out runtimes, at the cost of making them look even uglier. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4237 316c924e-a436-60f5-8080-3fe189b3f50e --- code/game/mecha/mech_fabricator.dm | 218 +++++++++++++++++++++++++--- code/modules/client/client procs.dm | 1 - 2 files changed, 195 insertions(+), 24 deletions(-) diff --git a/code/game/mecha/mech_fabricator.dm b/code/game/mecha/mech_fabricator.dm index 1314953bcf3..c6797be4670 100644 --- a/code/game/mecha/mech_fabricator.dm +++ b/code/game/mecha/mech_fabricator.dm @@ -306,18 +306,84 @@ output += "
[output_part_info(part)]
\[[resources_available?"Build | ":null]Add to queue\]\[?\]
" return output -/obj/machinery/mecha_part_fabricator/proc/output_part_info(var/obj/item/mecha_parts/part) - var/output = "[part.name] (Cost: [output_part_cost(part)]) [get_construction_time_w_coeff(part)/10]sec" - return output +/obj/machinery/mecha_part_fabricator/proc/output_part_info(var/obj/item/part) +//Be SURE to add any new equipment to this switch, but don't be suprised if it spits out children objects + if(istype(part,/obj/item/robot_parts)) + var/obj/item/robot_parts/P = part + var/output = "[P.name] (Cost: [output_part_cost(P)]) [get_construction_time_w_coeff(P)/10]sec" + return output + else if(istype(part,/obj/item/mecha_parts)) + var/obj/item/mecha_parts/P = part + var/output = "[P.name] (Cost: [output_part_cost(P)]) [get_construction_time_w_coeff(P)/10]sec" + return output + else if(istype(part,/obj/item/borg/upgrade)) + var/obj/item/borg/upgrade/P = part + var/output = "[P.name] (Cost: [output_part_cost(P)]) [get_construction_time_w_coeff(P)/10]sec" + return output + else if(istype(part,/obj/item/device/mmi)) + var/obj/item/device/mmi/P = part + var/output = "[P.name] (Cost: [output_part_cost(P)]) [get_construction_time_w_coeff(P)/10]sec" + return output + else if(istype(part,/obj/item/device/flash/synthetic)) + var/obj/item/device/flash/synthetic/P = part + var/output = "[P.name] (Cost: [output_part_cost(P)]) [get_construction_time_w_coeff(P)/10]sec" + return output + else if(istype(part,/obj/item/weapon/cell)) + var/obj/item/weapon/cell/P = part + var/output = "[P.name] (Cost: [output_part_cost(P)]) [get_construction_time_w_coeff(P)/10]sec" + return output + else + return 0 -/obj/machinery/mecha_part_fabricator/proc/output_part_cost(var/obj/item/mecha_parts/part) + +/obj/machinery/mecha_part_fabricator/proc/output_part_cost(var/obj/item/part) var/i = 0 var/output - for(var/p in part.construction_cost) - if(p in resources) - output += "[i?" | ":null][get_resource_cost_w_coeff(part,p)] [p]" - i++ - return output +//Be SURE to add any new equipment to this switch, but don't be suprised if it spits out children objects + if(istype(part,/obj/item/robot_parts)) + var/obj/item/robot_parts/P = part + for(var/c in P.construction_cost) + if(c in resources) + output += "[i?" | ":null][get_resource_cost_w_coeff(P,c)] [c]" + i++ + return output + else if(istype(part,/obj/item/mecha_parts)) + var/obj/item/mecha_parts/P = part + for(var/c in P.construction_cost) + if(c in resources) + output += "[i?" | ":null][get_resource_cost_w_coeff(P,c)] [c]" + i++ + return output + else if(istype(part,/obj/item/borg/upgrade)) + var/obj/item/borg/upgrade/P = part + for(var/c in P.construction_cost) + if(c in resources) + output += "[i?" | ":null][get_resource_cost_w_coeff(P,c)] [c]" + i++ + return output + else if(istype(part,/obj/item/device/mmi)) + var/obj/item/device/mmi/P = part + for(var/c in P.construction_cost) + if(c in resources) + output += "[i?" | ":null][get_resource_cost_w_coeff(P,c)] [c]" + i++ + return output + else if(istype(part,/obj/item/device/flash/synthetic)) + var/obj/item/device/flash/synthetic/P = part + for(var/c in P.construction_cost) + if(c in resources) + output += "[i?" | ":null][get_resource_cost_w_coeff(P,c)] [c]" + i++ + return output + else if(istype(part,/obj/item/weapon/cell)) + var/obj/item/weapon/cell/P = part + for(var/c in P.construction_cost) + if(c in resources) + output += "[i?" | ":null][get_resource_cost_w_coeff(P,c)] [c]" + i++ + return output + else + return 0 /obj/machinery/mecha_part_fabricator/proc/output_available_resources() var/output @@ -329,22 +395,88 @@ output += "
" return output -/obj/machinery/mecha_part_fabricator/proc/remove_resources(var/obj/item/mecha_parts/part) - if(istype(part, /obj/item/robot_parts) || istype(part, /obj/item/mecha_parts)) - for(var/resource in part.construction_cost) +/obj/machinery/mecha_part_fabricator/proc/remove_resources(var/obj/item/part) +//Be SURE to add any new equipment to this switch, but don't be suprised if it spits out children objects + if(istype(part,/obj/item/robot_parts)) + var/obj/item/robot_parts/P = part + for(var/resource in P.construction_cost) if(resource in src.resources) - src.resources[resource] -= get_resource_cost_w_coeff(part,resource) - return + src.resources[resource] -= get_resource_cost_w_coeff(P,resource) + else if(istype(part,/obj/item/mecha_parts)) + var/obj/item/mecha_parts/P = part + for(var/resource in P.construction_cost) + if(resource in src.resources) + src.resources[resource] -= get_resource_cost_w_coeff(P,resource) + else if(istype(part,/obj/item/borg/upgrade)) + var/obj/item/borg/upgrade/P = part + for(var/resource in P.construction_cost) + if(resource in src.resources) + src.resources[resource] -= get_resource_cost_w_coeff(P,resource) + else if(istype(part,/obj/item/device/mmi)) + var/obj/item/device/mmi/P = part + for(var/resource in P.construction_cost) + if(resource in src.resources) + src.resources[resource] -= get_resource_cost_w_coeff(P,resource) + else if(istype(part,/obj/item/device/flash/synthetic)) + var/obj/item/device/flash/synthetic/P = part + for(var/resource in P.construction_cost) + if(resource in src.resources) + src.resources[resource] -= get_resource_cost_w_coeff(P,resource) + else if(istype(part,/obj/item/weapon/cell)) + var/obj/item/weapon/cell/P = part + for(var/resource in P.construction_cost) + if(resource in src.resources) + src.resources[resource] -= get_resource_cost_w_coeff(P,resource) + else + return -/obj/machinery/mecha_part_fabricator/proc/check_resources(var/obj/item/mecha_parts/part) +/obj/machinery/mecha_part_fabricator/proc/check_resources(var/obj/item/part) // if(istype(part, /obj/item/robot_parts) || istype(part, /obj/item/mecha_parts) || istype(part,/obj/item/borg/upgrade)) - if(part.construction_time!=null && part.construction_cost!=null)//Much more efficient way to check the item, since it won't have those vars if it isn't meant to go through the mechfabs -Sieve - for(var/resource in part.construction_cost) +//Be SURE to add any new equipment to this switch, but don't be suprised if it spits out children objects + if(istype(part,/obj/item/robot_parts)) + var/obj/item/robot_parts/P = part + for(var/resource in P.construction_cost) if(resource in src.resources) - if(src.resources[resource] < get_resource_cost_w_coeff(part,resource)) + if(src.resources[resource] < get_resource_cost_w_coeff(P,resource)) return 0 return 1 - return 0 + else if(istype(part,/obj/item/mecha_parts)) + var/obj/item/mecha_parts/P = part + for(var/resource in P.construction_cost) + if(resource in src.resources) + if(src.resources[resource] < get_resource_cost_w_coeff(P,resource)) + return 0 + return 1 + else if(istype(part,/obj/item/borg/upgrade)) + var/obj/item/borg/upgrade/P = part + for(var/resource in P.construction_cost) + if(resource in src.resources) + if(src.resources[resource] < get_resource_cost_w_coeff(P,resource)) + return 0 + return 1 + else if(istype(part,/obj/item/device/mmi)) + var/obj/item/device/mmi/P = part + for(var/resource in P.construction_cost) + if(resource in src.resources) + if(src.resources[resource] < get_resource_cost_w_coeff(P,resource)) + return 0 + return 1 + else if(istype(part,/obj/item/device/flash/synthetic)) + var/obj/item/device/flash/synthetic/P = part + for(var/resource in P.construction_cost) + if(resource in src.resources) + if(src.resources[resource] < get_resource_cost_w_coeff(P,resource)) + return 0 + return 1 + else if(istype(part,/obj/item/weapon/cell)) + var/obj/item/weapon/cell/P = part + for(var/resource in P.construction_cost) + if(resource in src.resources) + if(src.resources[resource] < get_resource_cost_w_coeff(P,resource)) + return 0 + return 1 + else + return 0 /obj/machinery/mecha_part_fabricator/proc/build_part(var/obj/item/part) if(!part) return @@ -490,11 +622,51 @@ src.visible_message("\icon[src] [src] beeps, \"Succesfully synchronized with R&D server. New data processed.\"") return -/obj/machinery/mecha_part_fabricator/proc/get_resource_cost_w_coeff(var/obj/item/mecha_parts/part as obj,var/resource as text, var/roundto=1) - return round(part.construction_cost[resource]*resource_coeff, roundto) +/obj/machinery/mecha_part_fabricator/proc/get_resource_cost_w_coeff(var/obj/item/part as obj,var/resource as text, var/roundto=1) +//Be SURE to add any new equipment to this switch, but don't be suprised if it spits out children objects + if(istype(part,/obj/item/robot_parts)) + var/obj/item/robot_parts/P = part + return round(P.construction_cost[resource]*resource_coeff, roundto) + else if(istype(part,/obj/item/mecha_parts)) + var/obj/item/mecha_parts/P = part + return round(P.construction_cost[resource]*resource_coeff, roundto) + else if(istype(part,/obj/item/borg/upgrade)) + var/obj/item/borg/upgrade/P = part + return round(P.construction_cost[resource]*resource_coeff, roundto) + else if(istype(part,/obj/item/device/mmi)) + var/obj/item/device/mmi/P = part + return round(P.construction_cost[resource]*resource_coeff, roundto) + else if(istype(part,/obj/item/device/flash/synthetic)) + var/obj/item/device/flash/synthetic/P = part + return round(P.construction_cost[resource]*resource_coeff, roundto) + else if(istype(part,/obj/item/weapon/cell)) + var/obj/item/weapon/cell/P = part + return round(P.construction_cost[resource]*resource_coeff, roundto) + else + return 0 -/obj/machinery/mecha_part_fabricator/proc/get_construction_time_w_coeff(var/obj/item/mecha_parts/part as obj, var/roundto=1) - return round(part.construction_time*time_coeff, roundto) +/obj/machinery/mecha_part_fabricator/proc/get_construction_time_w_coeff(var/obj/item/part as obj, var/roundto=1) +//Be SURE to add any new equipment to this switch, but don't be suprised if it spits out children objects + if(istype(part,/obj/item/robot_parts)) + var/obj/item/robot_parts/P = part + return round(P.construction_time*time_coeff, roundto) + else if(istype(part,/obj/item/mecha_parts)) + var/obj/item/mecha_parts/P = part + return round(P.construction_time*time_coeff, roundto) + else if(istype(part,/obj/item/borg/upgrade)) + var/obj/item/borg/upgrade/P = part + return round(P.construction_time*time_coeff, roundto) + else if(istype(part,/obj/item/device/mmi)) + var/obj/item/device/mmi/P = part + return round(P.construction_time*time_coeff, roundto) + else if(istype(part,/obj/item/device/flash/synthetic)) + var/obj/item/device/flash/synthetic/P = part + return round(P.construction_time*time_coeff, roundto) + else if(istype(part,/obj/item/weapon/cell)) + var/obj/item/weapon/cell/P = part + return round(P.construction_time*time_coeff, roundto) + else + return 0 /obj/machinery/mecha_part_fabricator/attack_hand(mob/user as mob) diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 36a6fd8bfd7..deec3507c8c 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -104,7 +104,6 @@ holder = new /obj/admins(src) holder.rank = admins[ckey] update_admins(admins[ckey]) - make_admin_list() admin_memo_show()