Skip to content

Commit

Permalink
- Ripleys can autoload mined ore. If it has
Browse files Browse the repository at this point in the history
 1. Drill
 2. Hydraulic Clamp.
 3. Ore Box in cargo.
then ore will be moved to ore box.
- Mech fabricator build speed increased.
- Mech fab queue updates through byjax.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1514 316c924e-a436-60f5-8080-3fe189b3f50e
  • Loading branch information
panurgomatic committed May 1, 2011
1 parent 4c5f17d commit 42a7c44
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 31 deletions.
11 changes: 9 additions & 2 deletions code/game/mecha/equipment/tools/tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
/obj/item/mecha_parts/mecha_equipment/tool/drill
name = "Drill"
icon_state = "mecha_drill"
equip_cooldown = 40
energy_drain = 20
equip_cooldown = 30
energy_drain = 10
force = 15

action(atom/target)
Expand All @@ -79,6 +79,7 @@
chassis.cell.use(energy_drain)
chassis.visible_message("<font color='red'><b>[chassis] starts to drill [target]</b></font>", "You hear the drill.")
chassis.occupant_message("<font color='red'><b>You start to drill [target]</b></font>")
chassis.cell.use(energy_drain)
var/T = chassis.loc
if(do_after_cooldown())
if(T == chassis.loc && src == chassis.selected)
Expand All @@ -89,6 +90,12 @@
if(get_dir(chassis,M)&chassis.dir)
M.gets_drilled()
chassis.log_message("Drilled through [target]")
if(locate(/obj/item/mecha_parts/mecha_equipment/tool/hydraulic_clamp) in chassis.equipment)
var/obj/ore_box/ore_box = locate(/obj/ore_box) in chassis:cargo
if(ore_box)
for(var/obj/item/weapon/ore/ore in range(chassis,1))
if(get_dir(chassis,ore)&chassis.dir)
ore.Move(ore_box)
else
chassis.log_message("Drilled through [target]")
target.ex_act(2)
Expand Down
70 changes: 42 additions & 28 deletions code/game/mecha/mech_fabricator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use_power = 1
idle_power_usage = 20
active_power_usage = 5000
var/time_coeff = 2 //can be upgraded with research
var/time_coeff = 1.5 //can be upgraded with research
var/resource_coeff = 1.5 //can be upgraded with research
var/list/resources = list(
"metal"=0,
Expand Down Expand Up @@ -183,15 +183,15 @@
return output

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,0.1)/10]sec"
var/output = "[part.name] (Cost: [output_part_cost(part)]) [get_construction_time_w_coeff(part)/10]sec"
return output

proc/output_part_cost(var/obj/item/mecha_parts/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,1)] [p]"
output += "[i?" | ":null][get_resource_cost_w_coeff(part,p)] [p]"
i++
return output

Expand All @@ -204,13 +204,13 @@
proc/remove_resources(var/obj/item/mecha_parts/part)
for(var/resource in part.construction_cost)
if(resource in src.resources)
src.resources[resource] -= get_resource_cost_w_coeff(part,resource,1)
src.resources[resource] -= get_resource_cost_w_coeff(part,resource)
return

proc/check_resources(var/obj/item/mecha_parts/part)
for(var/resource in part.construction_cost)
if(resource in src.resources)
if(src.resources[resource] < get_resource_cost_w_coeff(part,resource,1))
if(src.resources[resource] < get_resource_cost_w_coeff(part,resource))
return 0
return 1

Expand All @@ -222,7 +222,7 @@
src.icon_state = "mechfab3" //looks better than 'flick'
src.use_power = 2
src.updateUsrDialog()
sleep(get_construction_time_w_coeff(part,0.1))
sleep(get_construction_time_w_coeff(part))
//if(!src) return // you do not need to check it, all sleeping procedires will be terminated when src dies. -- rastaf0
src.use_power = 1
src.icon_state = initial(src.icon_state)
Expand All @@ -234,6 +234,10 @@
src.updateUsrDialog()
return 1

proc/update_queue_on_page()
send_byjax(usr,"mecha_fabricator.browser","queue",src.list_queue())
return

proc/add_part_set_to_queue(set_name)
if(set_name in part_sets)
var/list/part_set = part_sets[set_name]
Expand Down Expand Up @@ -317,31 +321,31 @@
proc/sync(silent=null)
if(!silent)
temp = "Updating local R&D database..."
spawn(30)
if(!src) return
for(var/obj/machinery/computer/rdconsole/RDC in get_area(src))
if(!RDC.sync)
continue
for(var/datum/tech/T in RDC.files.known_tech)
files.AddTech2Known(T)
for(var/datum/design/D in RDC.files.known_designs)
files.AddDesign2Known(D)
files.RefreshResearch()
var/i = src.convert_designs()
var/tech_output = update_tech()
if(!silent)
temp = "Processed [i] equipment designs.<br>"
temp += tech_output
temp += "<a href='?src=\ref[src];clear_temp=1'>Return</a>"
src.updateUsrDialog()
src.updateUsrDialog()
sleep(30)
for(var/obj/machinery/computer/rdconsole/RDC in get_area(src))
if(!RDC.sync)
continue
for(var/datum/tech/T in RDC.files.known_tech)
files.AddTech2Known(T)
for(var/datum/design/D in RDC.files.known_designs)
files.AddDesign2Known(D)
files.RefreshResearch()
var/i = src.convert_designs()
var/tech_output = update_tech()
if(!silent)
temp = "Processed [i] equipment designs.<br>"
temp += tech_output
temp += "<a href='?src=\ref[src];clear_temp=1'>Return</a>"
src.updateUsrDialog()
if(i || tech_output)
src.visible_message("<b>[src]</b> beeps, \"Succesfully synchronized with R&D server. New data processed.\".")
return

proc/get_resource_cost_w_coeff(var/obj/item/mecha_parts/part as obj,var/resource as text, var/roundto=null)
roundto = roundto || 0.01
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)

proc/get_construction_time_w_coeff(var/obj/item/mecha_parts/part as obj, var/roundto=null)
roundto = roundto || 0.01
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)


Expand Down Expand Up @@ -382,14 +386,17 @@
html, body {padding: 0px; margin: 0px;}
h1 {font-size: 18px; margin: 5px 0px;}
</style>
<script language='javascript' type='text/javascript'>
[js_byjax]
</script>
</head><body>
<body>
<table style='width: 100%;'>
<tr>
<td style='width: 70%; padding-right: 10px;'>
[left_part]
</td>
<td style='width: 30%; background: #ccc;'>
<td style='width: 30%; background: #ccc;' id='queue'>
[list_queue()]
</td>
<tr>
Expand Down Expand Up @@ -418,21 +425,26 @@
if(href_list["add_to_queue"])
var/part = locate(href_list["add_to_queue"])
add_to_queue(part)
return update_queue_on_page()
if(href_list["remove_from_queue"])
var/index = text2num(href_list["remove_from_queue"])
if(isnum(index))
remove_from_queue(index)
return update_queue_on_page()
if(href_list["partset_to_queue"])
var/part_set = href_list["partset_to_queue"]
add_part_set_to_queue(part_set)
return update_queue_on_page()
if(href_list["process_queue"])
if(processing_queue || being_built)
return 0
processing_queue = 1
process_queue()
processing_queue = 0
/*
if(href_list["list_queue"])
list_queue()
*/
if(href_list["clear_temp"])
temp = null
if(href_list["screen"])
Expand All @@ -443,8 +455,10 @@
if(isnum(index) && isnum(new_index))
if(new_index>0&&new_index<=queue.len)
queue.Swap(index,new_index)
return update_queue_on_page()
if(href_list["clear_queue"])
queue = list()
return update_queue_on_page()
if(href_list["sync"]) //Sync the research holder with all the R&D consoles in the game that aren't sync protected.
src.sync()
if(href_list["auto_sync"])
Expand Down
2 changes: 1 addition & 1 deletion code/game/mecha/mecha_control_console.dm
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
icon = 'device.dmi'
icon_state = "motion2"
origin_tech = "programming=2;magnets=2"
var/construction_time = 30
var/construction_time = 50
var/list/construction_cost = list("metal"=500)

proc/get_mecha_info()
Expand Down

0 comments on commit 42a7c44

Please sign in to comment.