Dev merge.

This commit is contained in:
Zuhayr
2015-02-21 19:49:47 +10:30
124 changed files with 3443 additions and 2188 deletions
@@ -0,0 +1,50 @@
/datum/matter_synth
var/name = "Generic Synthesizer"
var/max_energy = 60000
var/recharge_rate = 2000
var/energy
/datum/matter_synth/New(var/store = 0)
if(store)
max_energy = store
energy = max_energy
return
/datum/matter_synth/proc/get_charge()
return energy
/datum/matter_synth/proc/use_charge(var/amount)
if (energy >= amount)
energy -= amount
return 1
return 0
/datum/matter_synth/proc/add_charge(var/amount)
energy = min(energy + amount, max_energy)
/datum/matter_synth/proc/emp_act(var/severity)
use_charge(max_energy * 0.1 / severity)
/datum/matter_synth/medicine
name = "Medicine Synthesizer"
/datum/matter_synth/metal
name = "Metal Synthesizer"
/datum/matter_synth/plasteel
name = "Plasteel Synthesizer"
max_energy = 10000
/datum/matter_synth/glass
name = "Glass Synthesizer"
/datum/matter_synth/wood
name = "Wood Synthesizer"
/datum/matter_synth/plastic
name = "Plastic Synthesizer"
/datum/matter_synth/wire
name = "Wire Synthesizer"
max_energy = 50
recharge_rate = 2
+11 -2
View File
@@ -13,12 +13,21 @@
max_amount = 60
attack_verb = list("hit", "bludgeoned", "whacked")
/obj/item/stack/rods/cyborg
name = "metal rod synthesizer"
desc = "A device that makes metal rods."
gender = NEUTER
matter = null
uses_charge = 1
charge_costs = list(500)
stacktype = /obj/item/stack/rods
/obj/item/stack/rods/attackby(obj/item/W as obj, mob/user as mob)
..()
if (istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if(amount < 2)
if(get_amount() < 2)
user << "\red You need at least two rods to do this."
return
@@ -54,7 +63,7 @@
return 1
else if(!in_use)
if(amount < 2)
if(get_amount() < 2)
user << "\blue You need at least two rods to do this."
return
usr << "\blue Assembling grille..."
+16 -10
View File
@@ -22,12 +22,13 @@
var/list/construction_options = list("One Direction", "Full Window")
/obj/item/stack/sheet/glass/cyborg
name = "glass"
desc = "HOLY SHEET! That is a lot of glass."
singular_name = "glass sheet"
icon_state = "sheet-glass"
name = "glass synthesizer"
desc = "A device that makes glass."
gender = NEUTER
singular_name = "glass"
matter = null
created_window = /obj/structure/window/basic
uses_charge = 1
charge_costs = list(1000)
stacktype = /obj/item/stack/sheet/glass
/obj/item/stack/sheet/glass/attack_self(mob/user as mob)
@@ -69,7 +70,7 @@
if(!user.IsAdvancedToolUser())
return 0
var/title = "Sheet-[name]"
title += " ([src.amount] sheet\s left)"
title += " ([src.get_amount()] sheet\s left)"
switch(input(title, "What would you like to construct?") as null|anything in construction_options)
if("One Direction")
if(!src) return 1
@@ -102,7 +103,7 @@
if("Full Window")
if(!src) return 1
if(src.loc != user) return 1
if(src.amount < 4)
if(src.get_amount() < 4)
user << "\red You need more glass to do that."
return 1
if(locate(/obj/structure/window) in user.loc)
@@ -124,7 +125,7 @@
user << "\red There is already a windoor in that location."
return 1
if(src.amount < 5)
if(src.get_amount() < 5)
user << "\red You need more glass to do that."
return 1
@@ -151,10 +152,15 @@
construction_options = list("One Direction", "Full Window", "Windoor")
/obj/item/stack/sheet/glass/reinforced/cyborg
name = "reinforced glass"
desc = "Glass which has been reinforced with metal rods."
name = "reinforced glass synthesizer"
desc = "A device that makes reinforced glass."
gender = NEUTER
matter = null
uses_charge = 2
charge_costs = list(1000)
singular_name = "reinforced glass sheet"
icon_state = "sheet-rglass"
charge_costs = list(500, 1000)
/*
* Phoron Glass sheets
@@ -137,9 +137,10 @@ obj/item/stack/sheet/mineral/iron/New()
recipes = plastic_recipes
/obj/item/stack/sheet/mineral/plastic/cyborg
name = "plastic sheets"
icon_state = "sheet-plastic"
perunit = 2000
name = "plastic sheets synthesizer"
gender = NEUTER
uses_charge = 1
charge_costs = list(1000)
stacktype = /obj/item/stack/sheet/mineral/plastic
/obj/item/stack/sheet/mineral/gold
@@ -11,20 +11,20 @@
* Metal
*/
var/global/list/datum/stack_recipe/metal_recipes = list ( \
new/datum/stack_recipe("stool", /obj/structure/stool, one_per_turf = 1, on_floor = 1), \
new/datum/stack_recipe("chair", /obj/structure/stool/bed/chair, one_per_turf = 1, on_floor = 1), \
new/datum/stack_recipe("bed", /obj/structure/stool/bed, 2, one_per_turf = 1, on_floor = 1), \
new/datum/stack_recipe("stool", /obj/item/weapon/stool, one_per_turf = 1, on_floor = 1), \
new/datum/stack_recipe("chair", /obj/structure/bed/chair, one_per_turf = 1, on_floor = 1), \
new/datum/stack_recipe("bed", /obj/structure/bed, 2, one_per_turf = 1, on_floor = 1), \
null, \
new/datum/stack_recipe_list("office chairs",list( \
new/datum/stack_recipe("dark office chair", /obj/structure/stool/bed/chair/office/dark, 5, one_per_turf = 1, on_floor = 1), \
new/datum/stack_recipe("light office chair", /obj/structure/stool/bed/chair/office/light, 5, one_per_turf = 1, on_floor = 1), \
new/datum/stack_recipe("dark office chair", /obj/structure/bed/chair/office/dark, 5, one_per_turf = 1, on_floor = 1), \
new/datum/stack_recipe("light office chair", /obj/structure/bed/chair/office/light, 5, one_per_turf = 1, on_floor = 1), \
), 5), \
new/datum/stack_recipe_list("comfy chairs", list( \
new/datum/stack_recipe("beige comfy chair", /obj/structure/stool/bed/chair/comfy/beige, 2, one_per_turf = 1, on_floor = 1), \
new/datum/stack_recipe("black comfy chair", /obj/structure/stool/bed/chair/comfy/black, 2, one_per_turf = 1, on_floor = 1), \
new/datum/stack_recipe("brown comfy chair", /obj/structure/stool/bed/chair/comfy/brown, 2, one_per_turf = 1, on_floor = 1), \
new/datum/stack_recipe("lime comfy chair", /obj/structure/stool/bed/chair/comfy/lime, 2, one_per_turf = 1, on_floor = 1), \
new/datum/stack_recipe("teal comfy chair", /obj/structure/stool/bed/chair/comfy/teal, 2, one_per_turf = 1, on_floor = 1), \
new/datum/stack_recipe("beige comfy chair", /obj/structure/bed/chair/comfy/beige, 2, one_per_turf = 1, on_floor = 1), \
new/datum/stack_recipe("black comfy chair", /obj/structure/bed/chair/comfy/black, 2, one_per_turf = 1, on_floor = 1), \
new/datum/stack_recipe("brown comfy chair", /obj/structure/bed/chair/comfy/brown, 2, one_per_turf = 1, on_floor = 1), \
new/datum/stack_recipe("lime comfy chair", /obj/structure/bed/chair/comfy/lime, 2, one_per_turf = 1, on_floor = 1), \
new/datum/stack_recipe("teal comfy chair", /obj/structure/bed/chair/comfy/teal, 2, one_per_turf = 1, on_floor = 1), \
), 2), \
null, \
new/datum/stack_recipe("table parts", /obj/item/weapon/table_parts, 2), \
@@ -86,12 +86,12 @@ var/global/list/datum/stack_recipe/metal_recipes = list ( \
origin_tech = "materials=1"
/obj/item/stack/sheet/metal/cyborg
name = "metal"
desc = "Sheets made out off metal. It has been dubbed Metal Sheets."
singular_name = "metal sheet"
icon_state = "sheet-metal"
throwforce = 14.0
flags = CONDUCT
name = "metal synthesizer"
desc = "A device that makes metal sheets."
gender = NEUTER
matter = null
uses_charge = 1
charge_costs = list(1000)
stacktype = /obj/item/stack/sheet/metal
/obj/item/stack/sheet/metal/New(var/loc, var/amount=null)
@@ -121,9 +121,19 @@ var/global/list/datum/stack_recipe/plasteel_recipes = list ( \
flags = CONDUCT
origin_tech = "materials=2"
/obj/item/stack/sheet/plasteel/cyborg
name = "plasteel synthesizer"
desc = "A device that makes plasteel sheets."
gender = NEUTER
singular_name = "plasteel sheet"
matter = null
uses_charge = 1
charge_costs = list(1000)
stacktype = /obj/item/stack/sheet/plasteel
/obj/item/stack/sheet/plasteel/New(var/loc, var/amount=null)
recipes = plasteel_recipes
return ..()
recipes = plasteel_recipes
return ..()
/*
* Wood
@@ -132,7 +142,7 @@ var/global/list/datum/stack_recipe/wood_recipes = list ( \
new/datum/stack_recipe("wooden sandals", /obj/item/clothing/shoes/sandal, 1), \
new/datum/stack_recipe("wood floor tile", /obj/item/stack/tile/wood, 1, 4, 20), \
new/datum/stack_recipe("table parts", /obj/item/weapon/table_parts/wood, 2), \
new/datum/stack_recipe("wooden chair", /obj/structure/stool/bed/chair/wood/normal, 3, time = 10, one_per_turf = 1, on_floor = 1), \
new/datum/stack_recipe("wooden chair", /obj/structure/bed/chair/wood/normal, 3, time = 10, one_per_turf = 1, on_floor = 1), \
new/datum/stack_recipe("wooden barricade", /obj/structure/barricade/wooden, 5, time = 50, one_per_turf = 1, on_floor = 1), \
new/datum/stack_recipe("crossbow frame", /obj/item/weapon/crossbowframe, 5, time = 25, one_per_turf = 0, on_floor = 0), \
new/datum/stack_recipe("wooden door", /obj/structure/mineral_door/wood, 10, time = 20, one_per_turf = 1, on_floor = 1), \
@@ -149,10 +159,13 @@ var/global/list/datum/stack_recipe/wood_recipes = list ( \
origin_tech = "materials=1;biotech=1"
/obj/item/stack/sheet/wood/cyborg
name = "wooden plank"
desc = "One can only guess that this is a bunch of wood."
name = "wood synthesizer"
desc = "A device that makes wooden planks."
gender = NEUTER
singular_name = "wood plank"
icon_state = "sheet-wood"
uses_charge = 1
charge_costs = list(1000)
stacktype = /obj/item/stack/sheet/wood
/obj/item/stack/sheet/wood/New(var/loc, var/amount=null)
+71 -22
View File
@@ -17,6 +17,9 @@
var/amount = 1
var/max_amount //also see stack recipes initialisation, param "max_res_amount" must be equal to this max_amount
var/stacktype //determines whether different stack types can merge
var/uses_charge = 0
var/list/charge_costs = null
var/list/datum/matter_synth/synths = null
/obj/item/stack/New(var/loc, var/amount=null)
..()
@@ -27,13 +30,18 @@
return
/obj/item/stack/Del()
if(uses_charge)
return
if (src && usr && usr.machine == src)
usr << browse(null, "window=stack")
..()
/obj/item/stack/examine(mob/user)
if(..(user, 1))
user << "There are [src.amount] [src.singular_name]\s in the stack."
if(!uses_charge)
user << "There are [src.amount] [src.singular_name]\s in the stack."
else
user << "There is enough charge for [get_amount()]."
/obj/item/stack/attack_self(mob/user as mob)
list_recipes(user)
@@ -41,14 +49,14 @@
/obj/item/stack/proc/list_recipes(mob/user as mob, recipes_sublist)
if (!recipes)
return
if (!src || amount<=0)
if (!src || get_amount() <= 0)
user << browse(null, "window=stack")
user.set_machine(src) //for correct work of onclose
var/list/recipe_list = recipes
if (recipes_sublist && recipe_list[recipes_sublist] && istype(recipe_list[recipes_sublist], /datum/stack_recipe_list))
var/datum/stack_recipe_list/srl = recipe_list[recipes_sublist]
recipe_list = srl.recipes
var/t1 = text("<HTML><HEAD><title>Constructions from []</title></HEAD><body><TT>Amount Left: []<br>", src, src.amount)
var/t1 = text("<HTML><HEAD><title>Constructions from []</title></HEAD><body><TT>Amount Left: []<br>", src, src.get_amount())
for(var/i=1;i<=recipe_list.len,i++)
var/E = recipe_list[i]
if (isnull(E))
@@ -60,14 +68,14 @@
if (istype(E, /datum/stack_recipe_list))
var/datum/stack_recipe_list/srl = E
if (src.amount >= srl.req_amount)
if (src.get_amount() >= srl.req_amount)
t1 += "<a href='?src=\ref[src];sublist=[i]'>[srl.title] ([srl.req_amount] [src.singular_name]\s)</a>"
else
t1 += "[srl.title] ([srl.req_amount] [src.singular_name]\s)<br>"
if (istype(E, /datum/stack_recipe))
var/datum/stack_recipe/R = E
var/max_multiplier = round(src.amount / R.req_amount)
var/max_multiplier = round(src.get_amount() / R.req_amount)
var/title as text
var/can_build = 1
can_build = can_build && (max_multiplier>0)
@@ -142,7 +150,7 @@
list_recipes(usr, text2num(href_list["sublist"]))
if (href_list["make"])
if (src.amount < 1) del(src) //Never should happen
if (src.get_amount() < 1) del(src) //Never should happen
var/list/recipes_list = recipes
if (href_list["sublist"])
@@ -165,28 +173,44 @@
//Return 1 if an immediate subsequent call to use() would succeed.
//Ensures that code dealing with stacks uses the same logic
/obj/item/stack/proc/can_use(var/used)
if (amount < used)
if (get_amount() < used)
return 0
return 1
/obj/item/stack/proc/use(var/used)
if (!can_use(used))
return 0
amount -= used
if (amount <= 0)
spawn(0) //delete the empty stack once the current context yields
if (amount <= 0) //check again in case someone transferred stuff to us
if(usr)
usr.before_take_item(src)
del(src)
return 1
if(!uses_charge)
amount -= used
if (amount <= 0)
spawn(0) //delete the empty stack once the current context yields
if (amount <= 0) //check again in case someone transferred stuff to us
if(usr)
usr.before_take_item(src)
del(src)
return 1
else
if(get_amount() < used)
return 0
for(var/i = 1 to uses_charge)
var/datum/matter_synth/S = synths[i]
S.use_charge(charge_costs[i] * used) // Doesn't need to be deleted
return 1
return 0
/obj/item/stack/proc/add(var/extra)
if(amount + extra > max_amount)
if(!uses_charge)
if(amount + extra > get_max_amount())
return 0
else
amount += extra
return 1
else if(!synths || synths.len < uses_charge)
return 0
else
amount += extra
return 1
for(var/i = 1 to uses_charge)
var/datum/matter_synth/S = synths[i]
S.add_charge(charge_costs[i] * extra)
/*
The transfer and split procs work differently than use() and add().
@@ -196,16 +220,16 @@
//attempts to transfer amount to S, and returns the amount actually transferred
/obj/item/stack/proc/transfer_to(obj/item/stack/S, var/tamount=null)
if (!amount)
if (!get_amount())
return 0
if (stacktype != S.stacktype)
return 0
if (isnull(tamount))
tamount = src.amount
tamount = src.get_amount()
var/transfer = max(min(tamount, src.amount, (S.max_amount - S.amount)), 0)
var/transfer = max(min(tamount, src.get_amount(), (S.get_max_amount() - S.get_amount())), 0)
var/orig_amount = src.amount
var/orig_amount = src.get_amount()
if (transfer && src.use(transfer))
S.add(transfer)
if (prob(transfer/orig_amount * 100))
@@ -220,6 +244,8 @@
/obj/item/stack/proc/split(var/tamount)
if (!amount)
return null
if(uses_charge)
return null
var/transfer = max(min(tamount, src.amount, initial(max_amount)), 0)
@@ -234,8 +260,31 @@
return null
/obj/item/stack/proc/get_amount()
if(uses_charge)
if(!synths || synths.len < uses_charge)
return 0
var/datum/matter_synth/S = synths[1]
. = round(S.get_charge() / charge_costs[1])
if(uses_charge > 1)
for(var/i = 2 to uses_charge)
S = synths[i]
. = min(., round(S.get_charge() / charge_costs[i]))
return
return amount
/obj/item/stack/proc/get_max_amount()
if(uses_charge)
if(!synths || synths.len < uses_charge)
return 0
var/datum/matter_synth/S = synths[1]
. = round(S.max_energy / charge_costs[1])
if(uses_charge > 1)
for(var/i = 2 to uses_charge)
S = synths[i]
. = min(., round(S.max_energy / charge_costs[i]))
return
return max_amount
/obj/item/stack/proc/add_to_stacks(mob/usr as mob)
for (var/obj/item/stack/item in usr.loc)
if (item==src)
@@ -3,14 +3,12 @@
singular_name = "floor tile"
desc = "Those could work as a pretty decent throwing weapon"
icon_state = "tile"
w_class = 3.0
force = 6.0
matter = list("metal" = 937.5)
throwforce = 15.0
throw_speed = 5
throw_range = 20
flags = CONDUCT
max_amount = 60
/obj/item/stack/tile/plasteel/New(var/loc, var/amount=null)
..()
@@ -18,6 +16,16 @@
src.pixel_y = rand(1, 14)
return
/obj/item/stack/tile/plasteel/cyborg
name = "floor tile synthesizer"
desc = "A device that makes floor tiles."
gender = NEUTER
matter = null
uses_charge = 1
charge_costs = list(250)
stacktype = /obj/item/stack/tile/plasteel
build_type = /obj/item/stack/tile/plasteel
/*
/obj/item/stack/tile/plasteel/attack_self(mob/user as mob)
if (usr.stat)
@@ -1,9 +1,18 @@
/* Diffrent misc types of tiles
* Contains:
* Prototype
* Grass
* Wood
* Carpet
*/
/obj/item/stack/tile
name = "tile"
singular_name = "tile"
desc = "A non-descript floor tile"
w_class = 3
max_amount = 60
var/build_type = null
/*
* Grass
@@ -13,13 +22,11 @@
singular_name = "grass floor tile"
desc = "A patch of grass like they often use on golf courses."
icon_state = "tile_grass"
w_class = 3.0
force = 1.0
throwforce = 1.0
throw_speed = 5
throw_range = 20
flags = CONDUCT
max_amount = 60
origin_tech = "biotech=1"
/*
@@ -30,13 +37,19 @@
singular_name = "wood floor tile"
desc = "An easy to fit wooden floor tile."
icon_state = "tile-wood"
w_class = 3.0
force = 1.0
throwforce = 1.0
throw_speed = 5
throw_range = 20
flags = CONDUCT
max_amount = 60
/obj/item/stack/tile/wood/cyborg
name = "wood floor tile synthesizer"
desc = "A device that makes wood floor tiles."
uses_charge = 1
charge_costs = list(250)
stacktype = /obj/item/stack/tile/wood
build_type = /obj/item/stack/tile/wood
/*
* Carpets
@@ -46,10 +59,8 @@
singular_name = "carpet"
desc = "A piece of carpet. It is the same size as a normal floor tile!"
icon_state = "tile-carpet"
w_class = 3.0
force = 1.0
throwforce = 1.0
throw_speed = 5
throw_range = 20
flags = CONDUCT
max_amount = 60