File restructuring!

This brings down a bunch of defines from /code/defines/obj.dm unto their appropriate files.

I've moved morgue.dm from game/machinery into game/objects/structures since that file contains no machines.

I've reorganized the objects/items/stacks folder and made a 'sheets' and 'tiles' folder to keep things separate

I've separated stool_chair_bed.dm into its own folder which now contains the files: stools.dm, chairs.dm, bed.dm and alien_nests.dm to make it a little easier to go through.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4582 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
johnsonmt88@gmail.com
2012-08-29 18:00:30 +00:00
parent 179ed4c4b9
commit 867b21c7ce
37 changed files with 1412 additions and 1458 deletions

View File

@@ -1,116 +1,36 @@
/* Stack type objects!
* Contains:
* Stacks
* Recipe datum
*/
/*
Base object for stackable items.
Stackable items are:
metal
rmetal
glass
rglass
wood planks
floor tiles
metal rods
*/
* Stacks
*/
/obj/item/stack
origin_tech = "materials=1"
var/list/datum/stack_recipe/recipes
var/singular_name
var/amount = 1
var/max_amount //also see stack recipes initialisation, param "max_res_amount" must be equal to this max_amount
/obj/item/stack/New(var/loc, var/amount=null)
..()
if (amount)
src.amount=amount
return
/obj/item/stack/Del()
if (src && usr && usr.machine==src)
usr << browse(null, "window=stack")
..()
/obj/item/stack/examine()
set src in view(1)
..()
usr << "There are [src.amount] [src.singular_name]\s in the stack."
return
/obj/item/stack/proc/use(var/amount)
src.amount-=amount
if (src.amount<=0)
var/oldsrc = src
src = null //dont kill proc after del()
if(usr)
usr.before_take_item(oldsrc)
del(oldsrc)
return
/obj/item/stack/proc/add_to_stacks(mob/usr as mob)
var/obj/item/stack/oldsrc = src
src = null
for (var/obj/item/stack/item in usr.loc)
if (item==oldsrc)
continue
if (!istype(item, oldsrc.type))
continue
if (item.amount>=item.max_amount)
continue
oldsrc.attackby(item, usr)
usr << "You add new [item.singular_name] to the stack. It now contains [item.amount] [item.singular_name]\s."
if(!oldsrc)
break
/obj/item/stack/attack_hand(mob/user as mob)
if (user.get_inactive_hand() == src)
var/obj/item/stack/F = new src.type( user, amount=1)
F.copy_evidences(src)
user.put_in_hands(F)
src.add_fingerprint(user)
F.add_fingerprint(user)
use(1)
if (src && usr.machine==src)
spawn(0) src.interact(usr)
else
..()
return
/obj/item/stack/attackby(obj/item/W as obj, mob/user as mob)
..()
if (istype(W, src.type))
var/obj/item/stack/S = W
if (S.amount >= max_amount)
return 1
var/to_transfer as num
if (user.get_inactive_hand()==src)
to_transfer = 1
else
to_transfer = min(src.amount, S.max_amount-S.amount)
S.amount+=to_transfer
if (S && usr.machine==S)
spawn(0) S.interact(usr)
src.use(to_transfer)
if (src && usr.machine==src)
spawn(0) src.interact(usr)
else return ..()
/obj/item/stack/proc/copy_evidences(obj/item/stack/from as obj)
src.blood_DNA = from.blood_DNA
src.fingerprints = from.fingerprints
src.fingerprintshidden = from.fingerprintshidden
src.fingerprintslast = from.fingerprintslast
//TODO bloody overlay
/datum/stack_recipe
var/title = "ERROR"
var/result_type
var/req_amount = 1
var/res_amount = 1
var/max_res_amount = 1
var/time = 0
var/one_per_turf = 0
var/on_floor = 0
New(title, result_type, req_amount = 1, res_amount = 1, max_res_amount = 1, time = 0, one_per_turf = 0, on_floor = 0)
src.title = title
src.result_type = result_type
src.req_amount = req_amount
src.res_amount = res_amount
src.max_res_amount = max_res_amount
src.time = time
src.one_per_turf = one_per_turf
src.on_floor = on_floor
/obj/item/stack
var/list/datum/stack_recipe/recipes
origin_tech = "materials=1"
/obj/item/stack/attack_self(mob/user as mob)
interact(user)
@@ -217,7 +137,89 @@
return
return
/obj/item/stack/Del()
if (src && usr && usr.machine==src)
usr << browse(null, "window=stack")
/obj/item/stack/proc/use(var/amount)
src.amount-=amount
if (src.amount<=0)
var/oldsrc = src
src = null //dont kill proc after del()
if(usr)
usr.before_take_item(oldsrc)
del(oldsrc)
return
/obj/item/stack/proc/add_to_stacks(mob/usr as mob)
var/obj/item/stack/oldsrc = src
src = null
for (var/obj/item/stack/item in usr.loc)
if (item==oldsrc)
continue
if (!istype(item, oldsrc.type))
continue
if (item.amount>=item.max_amount)
continue
oldsrc.attackby(item, usr)
usr << "You add new [item.singular_name] to the stack. It now contains [item.amount] [item.singular_name]\s."
if(!oldsrc)
break
/obj/item/stack/attack_hand(mob/user as mob)
if (user.get_inactive_hand() == src)
var/obj/item/stack/F = new src.type( user, amount=1)
F.copy_evidences(src)
user.put_in_hands(F)
src.add_fingerprint(user)
F.add_fingerprint(user)
use(1)
if (src && usr.machine==src)
spawn(0) src.interact(usr)
else
..()
return
/obj/item/stack/attackby(obj/item/W as obj, mob/user as mob)
..()
if (istype(W, src.type))
var/obj/item/stack/S = W
if (S.amount >= max_amount)
return 1
var/to_transfer as num
if (user.get_inactive_hand()==src)
to_transfer = 1
else
to_transfer = min(src.amount, S.max_amount-S.amount)
S.amount+=to_transfer
if (S && usr.machine==S)
spawn(0) S.interact(usr)
src.use(to_transfer)
if (src && usr.machine==src)
spawn(0) src.interact(usr)
else return ..()
/obj/item/stack/proc/copy_evidences(obj/item/stack/from as obj)
src.blood_DNA = from.blood_DNA
src.fingerprints = from.fingerprints
src.fingerprintshidden = from.fingerprintshidden
src.fingerprintslast = from.fingerprintslast
//TODO bloody overlay
/*
* Recipe datum
*/
/datum/stack_recipe
var/title = "ERROR"
var/result_type
var/req_amount = 1
var/res_amount = 1
var/max_res_amount = 1
var/time = 0
var/one_per_turf = 0
var/on_floor = 0
New(title, result_type, req_amount = 1, res_amount = 1, max_res_amount = 1, time = 0, one_per_turf = 0, on_floor = 0)
src.title = title
src.result_type = result_type
src.req_amount = req_amount
src.res_amount = res_amount
src.max_res_amount = max_res_amount
src.time = time
src.one_per_turf = one_per_turf
src.on_floor = on_floor