diff --git a/code/modules/research/xenoarchaeology/artifact/artifact_autocloner.dm b/code/modules/research/xenoarchaeology/artifact/artifact_autocloner.dm index e602e4363f6..fb01ee46614 100644 --- a/code/modules/research/xenoarchaeology/artifact/artifact_autocloner.dm +++ b/code/modules/research/xenoarchaeology/artifact/artifact_autocloner.dm @@ -5,8 +5,9 @@ icon = 'icons/obj/cryogenics.dmi' icon_state = "cellold0" var/spawn_type - var/current_ticks_spawning = 0 - var/ticks_required_to_spawn + var/time_spent_spawning = 0 + var/time_per_spawn = 0 + var/last_process= 0 density = 1 var/previous_power_state = 0 @@ -17,7 +18,7 @@ /obj/machinery/auto_cloner/New() ..() - ticks_required_to_spawn = rand(240,1440) + time_per_spawn = rand(1200,3600) //33% chance to spawn nasties if(prob(33)) @@ -53,13 +54,12 @@ src.visible_message("\blue \icon[src] [src] suddenly comes to life!") //slowly grow a mob - current_ticks_spawning++ if(prob(5)) src.visible_message("\blue \icon[src] [src] [pick("gloops","glugs","whirrs","whooshes","hisses","purrs","hums","gushes")].") //if we've finished growing... - if(current_ticks_spawning >= ticks_required_to_spawn) - current_ticks_spawning = 0 + if(time_spent_spawning >= time_per_spawn) + time_spent_spawning = 0 use_power = 1 src.visible_message("\blue \icon[src] [src] pings!") icon_state = "cellold1" @@ -68,7 +68,7 @@ new spawn_type(src.loc) //if we're getting close to finished, kick into overdrive power usage - if(current_ticks_spawning / ticks_required_to_spawn > 0.75) + if(time_spent_spawning / time_per_spawn > 0.75) use_power = 2 icon_state = "cellold2" desc = "It's full of a bubbling viscous liquid, and is lit by a mysterious glow. A dark shape appears to be forming inside..." @@ -76,6 +76,8 @@ use_power = 1 icon_state = "cellold1" desc = "It's full of a bubbling viscous liquid, and is lit by a mysterious glow." + + time_spent_spawning = time_spent_spawning + world.time - last_process else if(previous_power_state) previous_power_state = 0 @@ -83,5 +85,6 @@ src.visible_message("\blue \icon[src] [src] suddenly shuts down.") //cloned mob slowly breaks down - if(current_ticks_spawning > 0) - current_ticks_spawning-- + time_spent_spawning = max(time_spent_spawning + last_process - world.time, 0) + + last_process = world.time diff --git a/code/modules/research/xenoarchaeology/artifact/artifact_replicator.dm b/code/modules/research/xenoarchaeology/artifact/artifact_replicator.dm index 63999f99217..56954dc6dd1 100644 --- a/code/modules/research/xenoarchaeology/artifact/artifact_replicator.dm +++ b/code/modules/research/xenoarchaeology/artifact/artifact_replicator.dm @@ -10,10 +10,15 @@ active_power_usage = 1000 use_power = 1 - var/spawn_progress = 0 - var/max_spawn_ticks = 5 + var/spawn_progress_time = 0 + var/max_spawn_time = 50 + var/last_process_time = 0 + var/list/construction = list() var/list/spawning_types = list() + var/list/stored_materials = list() + + var/fail_message /obj/machinery/replicator/New() ..() @@ -66,32 +71,52 @@ var/quantity = rand(5,15) for(var/i=0, i max_spawn_ticks) + spawn_progress_time += world.time - last_process_time + if(spawn_progress_time > max_spawn_time) src.visible_message("\blue \icon[src] [src] pings!") - var/spawn_type = spawning_types[1] - new spawn_type(src.loc) - spawning_types.Remove(spawning_types[1]) - spawn_progress = 0 - max_spawn_ticks = rand(5,30) + var/obj/source_material = pop(stored_materials) + var/spawn_type = pop(spawning_types) + var/obj/spawned_obj = new spawn_type(src.loc) + if(source_material) + if(lentext(source_material.name) < MAX_MESSAGE_LEN) + spawned_obj.name = "[source_material] " + spawned_obj.name + if(lentext(source_material.desc) < MAX_MESSAGE_LEN * 2) + if(spawned_obj.desc) + spawned_obj.desc += " It is made of [source_material]." + else + spawned_obj.desc = "It is made of [source_material]." + source_material.loc = null - if(!spawning_types.len) + spawn_progress_time = 0 + max_spawn_time = rand(30,100) + + if(!spawning_types.len || !stored_materials.len) use_power = 1 icon_state = "borgcharger0(old)" else if(prob(5)) src.visible_message("\blue \icon[src] [src] [pick("clicks","whizzes","whirrs","whooshes","clanks","clongs","clonks","bangs")].") + last_process_time = world.time + /obj/machinery/replicator/attack_hand(mob/user as mob) interact(user) @@ -103,17 +128,26 @@ user << browse(dat, "window=alien_replicator") +/obj/machinery/replicator/attackby(obj/item/weapon/W as obj, mob/living/user as mob) + user.drop_item() + W.loc = src + stored_materials.Add(W) + src.visible_message("\blue [user] inserts [W] into [src].") + /obj/machinery/replicator/Topic(href, href_list) if(href_list["activate"]) var/index = text2num(href_list["activate"]) if(index > 0 && index <= construction.len) - if(spawning_types.len) - src.visible_message("\blue \icon[src] a [pick("light","dial","display","meter","pad")] on [src]'s front [pick("blinks","flashes")] [pick("red","yellow","blue","orange","purple","green","white")].") - else - src.visible_message("\blue \icon[src] [src]'s front compartment slides shut.") + if(stored_materials.len > spawning_types.len) + if(spawning_types.len) + src.visible_message("\blue \icon[src] a [pick("light","dial","display","meter","pad")] on [src]'s front [pick("blinks","flashes")] [pick("red","yellow","blue","orange","purple","green","white")].") + else + src.visible_message("\blue \icon[src] [src]'s front compartment slides shut.") - spawning_types.Add(construction[construction[index]]) - spawn_progress = 0 - use_power = 2 - icon_state = "borgcharger1(old)" + spawning_types.Add(construction[construction[index]]) + spawn_progress_time = 0 + use_power = 2 + icon_state = "borgcharger1(old)" + else + src.visible_message(fail_message)