mirror of
https://github.com/CHOMPstation/CHOMPstation.git
synced 2026-08-23 12:06:22 +01:00
Adds robot synths
This commit is contained in:
@@ -55,7 +55,7 @@
|
||||
var/uses = 0
|
||||
var/emagged = 0
|
||||
var/failmsg = ""
|
||||
var/charge = 1
|
||||
var/charge = 0
|
||||
|
||||
/obj/item/device/lightreplacer/New()
|
||||
uses = max_uses / 2
|
||||
@@ -122,11 +122,11 @@
|
||||
/obj/item/device/lightreplacer/proc/AddUses(var/amount = 1)
|
||||
uses = min(max(uses + amount, 0), max_uses)
|
||||
|
||||
/obj/item/device/lightreplacer/proc/Charge(var/mob/user)
|
||||
charge += 1
|
||||
if(charge > 7)
|
||||
/obj/item/device/lightreplacer/proc/Charge(var/mob/user, var/amount = 1)
|
||||
charge += amount
|
||||
if(charge > 6)
|
||||
AddUses(1)
|
||||
charge = 1
|
||||
charge = 0
|
||||
|
||||
/obj/item/device/lightreplacer/proc/ReplaceLight(var/obj/machinery/light/target, var/mob/living/U)
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/datum/matter_synth
|
||||
var/name = "Generic Synthesizer"
|
||||
var/max_energy = 50000
|
||||
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
|
||||
@@ -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 = MALE
|
||||
matter = null
|
||||
uses_charge = 1
|
||||
charge_cost = 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..."
|
||||
|
||||
@@ -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 = MALE
|
||||
singular_name = "glass"
|
||||
matter = null
|
||||
created_window = /obj/structure/window/basic
|
||||
uses_charge = 1
|
||||
charge_cost = 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,33 @@
|
||||
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 = MALE
|
||||
matter = null
|
||||
uses_charge = 1
|
||||
charge_cost = 1000
|
||||
singular_name = "reinforced glass sheet"
|
||||
icon_state = "sheet-rglass"
|
||||
var/datum/matter_synth/metal_synth
|
||||
var/datum/matter_synth/glass_synth
|
||||
var/metal_charge = 500
|
||||
var/glass_charge = 1000
|
||||
|
||||
/obj/item/stack/sheet/glass/reinforced/cyborg/get_amount()
|
||||
return min(round(metal_synth.energy / metal_charge), round(glass_synth.energy / glass_charge))
|
||||
|
||||
/obj/item/stack/sheet/glass/reinforced/cyborg/use(var/amount) // Requires special checks, because it uses two storages
|
||||
if(get_amount() < amount)
|
||||
return 0
|
||||
metal_synth.use_charge(amount * metal_charge)
|
||||
glass_synth.use_charge(amount * glass_charge)
|
||||
return 1
|
||||
|
||||
/obj/item/stack/sheet/glass/reinforced/cyborg/add(var/amount)
|
||||
metal_synth.add_charge(amount * metal_charge)
|
||||
glass_synth.add_charge(amount * glass_charge)
|
||||
return
|
||||
|
||||
/*
|
||||
* 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 = MALE
|
||||
uses_charge = 1
|
||||
charge_cost = 1000
|
||||
stacktype = /obj/item/stack/sheet/mineral/plastic
|
||||
|
||||
/obj/item/stack/sheet/mineral/gold
|
||||
|
||||
@@ -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 = MALE
|
||||
matter = null
|
||||
uses_charge = 1
|
||||
charge_cost = 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 = MALE
|
||||
singular_name = "plasteel sheet"
|
||||
matter = null
|
||||
uses_charge = 1
|
||||
charge_cost = 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
|
||||
@@ -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 = MALE
|
||||
singular_name = "wood plank"
|
||||
icon_state = "sheet-wood"
|
||||
uses_charge = 1
|
||||
charge_cost = 1000
|
||||
stacktype = /obj/item/stack/sheet/wood
|
||||
|
||||
/obj/item/stack/sheet/wood/New(var/loc, var/amount=null)
|
||||
|
||||
@@ -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/charge_cost = 1
|
||||
var/datum/matter_synth/synth = 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,39 @@
|
||||
//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(!synth)
|
||||
return 0
|
||||
return synth.use_charge(charge_cost * used) // Doesn't need to be deleted
|
||||
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(!synth)
|
||||
return 0
|
||||
else
|
||||
amount += extra
|
||||
return 1
|
||||
synth.add_charge(charge_cost * extra)
|
||||
|
||||
/*
|
||||
The transfer and split procs work differently than use() and add().
|
||||
@@ -196,16 +215,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 +239,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 +255,19 @@
|
||||
return null
|
||||
|
||||
/obj/item/stack/proc/get_amount()
|
||||
if(uses_charge)
|
||||
if(!synth)
|
||||
return 0
|
||||
return round(synth.get_charge() / charge_cost)
|
||||
return amount
|
||||
|
||||
/obj/item/stack/proc/get_max_amount()
|
||||
if(uses_charge)
|
||||
if(!synth)
|
||||
return 0
|
||||
return round(synth.max_energy / charge_cost)
|
||||
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 = MALE
|
||||
matter = null
|
||||
uses_charge = 1
|
||||
charge_cost = 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_cost = 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
|
||||
|
||||
Reference in New Issue
Block a user