mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-18 18:44:48 +01:00
switched autocloner and replicator artifacts over to a timer system, made replicator use materials to create items (materials can be anything)
Signed-off-by: Cael Aislinn <cael_aislinn@yahoo.com.au>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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<quantity, i++)
|
||||
var/button_desc = "[pick("a yellow","a purple","a green","a blue","a red","an orange","a white")], "
|
||||
var/button_desc = "a [pick("yellow","purple","green","blue","red","orange","white")], "
|
||||
button_desc += "[pick("round","square","diamond","heart","dog","human")] shaped "
|
||||
button_desc += "[pick("toggle","switch","lever","button","pad","hole")]"
|
||||
var/type = pick(viables)
|
||||
viables.Remove(type)
|
||||
construction[button_desc] = type
|
||||
|
||||
fail_message = "\blue \icon[src] a [pick("loud","soft","sinister","eery","triumphant","depressing","cheerful","angry")] \
|
||||
[pick("horn","beep","bing","bleep","blat","honk","hrumph","ding")] sounds and a \
|
||||
[pick("yellow","purple","green","blue","red","orange","white")] \
|
||||
[pick("light","dial","meter","window","protrusion","knob","antenna","swirly thing")] \
|
||||
[pick("swirls","flashes","whirrs","goes schwing","blinks","flickers","strobes","lights up")] on the \
|
||||
[pick("front","side","top","bottom","rear","inside")] of [src]. A [pick("slot","funnel","chute","tube")] opens up in the \
|
||||
[pick("front","side","top","bottom","rear","inside")]."
|
||||
|
||||
/obj/machinery/replicator/process()
|
||||
if(spawning_types.len && powered())
|
||||
spawn_progress++
|
||||
if(spawn_progress > 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)
|
||||
|
||||
Reference in New Issue
Block a user