From 8d03d460aa57fa8f2f824f42ac6061cba06d664b Mon Sep 17 00:00:00 2001 From: Ren Erthilo Date: Mon, 26 Mar 2012 23:01:03 +0100 Subject: [PATCH] TG: Moved a batch of unchecked and a few unused files into the unused folder. Remember if your scrolling though the list and something is unchecked it should almost certainly be checked. Simple animals moved over to the actual mob code area and out of the defines. r2868 Also added a bunch of files I forgot. --- baystation12.dme | 17 +- code/game/objects/closets/extinguisher.dm | 87 ++ code/game/objects/closets/fireaxe.dm | 198 +++++ code/game/objects/washing_machine.dm | 12 +- code/modules/food/meat.dm | 23 + .../mob/simple_animal/cat.dm | 50 +- .../mob/simple_animal/corgi.dm | 744 ++++++++-------- .../mob/simple_animal/crab.dm | 70 +- .../mob/simple_animal/life.dm | 576 ++++++------ .../{modules/recycling => unused}/conveyor.dm | 836 +++++++++--------- code/{WorkInProgress => unused}/jobs.dm | 582 ++++++------ .../organs/implants.dm | 24 +- .../organs/organs.dm | 698 +++++++-------- .../powerarmor}/powerarmor.dm | 562 ++++++------ .../powerarmor}/powerarmorcomponents.dm | 492 +++++------ code/{modules/recycling => unused}/scrap.dm | 578 ++++++------ 16 files changed, 2927 insertions(+), 2622 deletions(-) create mode 100644 code/game/objects/closets/extinguisher.dm create mode 100644 code/game/objects/closets/fireaxe.dm create mode 100644 code/modules/food/meat.dm rename code/{defines => modules}/mob/simple_animal/cat.dm (93%) rename code/{defines => modules}/mob/simple_animal/corgi.dm (96%) rename code/{defines => modules}/mob/simple_animal/crab.dm (94%) rename code/{defines => modules}/mob/simple_animal/life.dm (96%) rename code/{modules/recycling => unused}/conveyor.dm (96%) rename code/{WorkInProgress => unused}/jobs.dm (97%) rename code/{WorkInProgress => unused}/organs/implants.dm (94%) rename code/{WorkInProgress => unused}/organs/organs.dm (94%) rename code/{game/objects/items/clothing => unused/powerarmor}/powerarmor.dm (96%) rename code/{game/objects/items/clothing => unused/powerarmor}/powerarmorcomponents.dm (96%) rename code/{modules/recycling => unused}/scrap.dm (95%) diff --git a/baystation12.dme b/baystation12.dme index 86c8206ee1c..4b01bb5b738 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -22,7 +22,6 @@ #define FILE_DIR "code/defines/mob/living" #define FILE_DIR "code/defines/mob/living/carbon" #define FILE_DIR "code/defines/mob/living/silicon" -#define FILE_DIR "code/defines/mob/simple_animal" #define FILE_DIR "code/defines/obj" #define FILE_DIR "code/defines/obj/clothing" #define FILE_DIR "code/defines/procs" @@ -74,7 +73,6 @@ #define FILE_DIR "code/game/objects/devices" #define FILE_DIR "code/game/objects/devices/PDA" #define FILE_DIR "code/game/objects/items" -#define FILE_DIR "code/game/objects/items/clothing" #define FILE_DIR "code/game/objects/items/weapons" #define FILE_DIR "code/game/objects/items/weapons/implants" #define FILE_DIR "code/game/objects/radio" @@ -152,7 +150,9 @@ #define FILE_DIR "code/unused/hivebot" #define FILE_DIR "code/unused/mining" #define FILE_DIR "code/unused/optics" +#define FILE_DIR "code/unused/organs" #define FILE_DIR "code/unused/pda2" +#define FILE_DIR "code/unused/powerarmor" #define FILE_DIR "code/unused/spacecraft" #define FILE_DIR "code/WorkInProgress" #define FILE_DIR "code/WorkInProgress/Apples" @@ -162,7 +162,6 @@ #define FILE_DIR "code/WorkInProgress/mapload" #define FILE_DIR "code/WorkInProgress/Mini" #define FILE_DIR "code/WorkInProgress/Mloc" -#define FILE_DIR "code/WorkInProgress/organs" #define FILE_DIR "code/WorkInProgress/Ported" #define FILE_DIR "code/WorkInProgress/Ported/Abi79" #define FILE_DIR "code/WorkInProgress/Ported/Bureaucracy" @@ -194,7 +193,6 @@ #define FILE_DIR "icons/vending_icons" #define FILE_DIR "interface" #define FILE_DIR "maps" -#define FILE_DIR "maps/backup" #define FILE_DIR "sound" #define FILE_DIR "sound/ambience" #define FILE_DIR "sound/announcer" @@ -316,10 +314,6 @@ #include "code\defines\mob\living\silicon\pai.dm" #include "code\defines\mob\living\silicon\robot.dm" #include "code\defines\mob\living\silicon\silicon.dm" -#include "code\defines\mob\simple_animal\cat.dm" -#include "code\defines\mob\simple_animal\corgi.dm" -#include "code\defines\mob\simple_animal\crab.dm" -#include "code\defines\mob\simple_animal\life.dm" #include "code\defines\obj\closet.dm" #include "code\defines\obj\clothing.dm" #include "code\defines\obj\computer.dm" @@ -689,8 +683,6 @@ #include "code\game\objects\items\shock_kit.dm" #include "code\game\objects\items\tk_grab.dm" #include "code\game\objects\items\trash.dm" -#include "code\game\objects\items\clothing\powerarmor.dm" -#include "code\game\objects\items\clothing\powerarmorcomponents.dm" #include "code\game\objects\items\weapons\AI_modules.dm" #include "code\game\objects\items\weapons\cameras.dm" #include "code\game\objects\items\weapons\cards_ids.dm" @@ -803,6 +795,7 @@ #include "code\modules\assembly\timer.dm" #include "code\modules\chemical\Chemistry-Holder.dm" #include "code\modules\chemical\Chemistry-Machinery.dm" +#include "code\modules\chemical\Chemistry-Readme.dm" #include "code\modules\chemical\Chemistry-Reagents.dm" #include "code\modules\chemical\Chemistry-Recipes.dm" #include "code\modules\chemical\Chemistry-Tools.dm" @@ -993,6 +986,10 @@ #include "code\modules\mob\organ\organ_external.dm" #include "code\modules\mob\organ\organ_internal.dm" #include "code\modules\mob\organ\pain.dm" +#include "code\modules\mob\simple_animal\cat.dm" +#include "code\modules\mob\simple_animal\corgi.dm" +#include "code\modules\mob\simple_animal\crab.dm" +#include "code\modules\mob\simple_animal\life.dm" #include "code\modules\mob\simple_animal\shade.dm" #include "code\modules\power\apc.dm" #include "code\modules\power\cable.dm" diff --git a/code/game/objects/closets/extinguisher.dm b/code/game/objects/closets/extinguisher.dm new file mode 100644 index 00000000000..490ae2c8d37 --- /dev/null +++ b/code/game/objects/closets/extinguisher.dm @@ -0,0 +1,87 @@ + +/obj/structure/closet/extinguisher + name = "extinguisher closet" + desc = "A small wall mounted cabinet designed to hold a fire extinguisher." + icon_state = "extinguisher10" + icon_opened = "extinguisher11" + icon_closed = "extinguisher10" + opened = 1 + anchored = 1 + density = 0 + var/obj/item/weapon/extinguisher/EXTINGUISHER = new/obj/item/weapon/extinguisher + var/localopened = 1 + + open() + return + + close() + return + + attackby(var/obj/item/O as obj, var/mob/user as mob) + if (isrobot(usr)) + return + if (istype(O, /obj/item/weapon/extinguisher)) + if(!EXTINGUISHER) + user.drop_item(O) + src.contents += O + EXTINGUISHER = O + user << "\blue You place the extinguisher in the [src.name]." + else + localopened = !localopened + else + localopened = !localopened + update_icon() + + attack_hand(mob/user as mob) + if(localopened) + if(EXTINGUISHER) + user.put_in_hand(EXTINGUISHER) + EXTINGUISHER = null + user << "\blue You take the extinguisher from the [name]." + else + localopened = !localopened + + else + localopened = !localopened + update_icon() + + verb/toggle_openness() //nice name, huh? HUH?! + set name = "Open/Close" + set category = "Object" + + if (isrobot(usr)) + return + + localopened = !localopened + update_icon() + + verb/remove_extinguisher() + set name = "Remove Extinguisher" + set category = "Object" + + if (isrobot(usr)) + return + + if (localopened) + if(EXTINGUISHER) + usr.put_in_hand(EXTINGUISHER) + EXTINGUISHER = null + usr << "\blue You take the extinguisher from the [name]." + else + usr << "\blue The [name] is empty." + else + usr << "\blue The [name] is closed." + update_icon() + + attack_paw(mob/user as mob) + attack_hand(user) + return + + attack_ai(mob/user as mob) + return + + update_icon() + var/hasextinguisher = 0 + if(EXTINGUISHER) + hasextinguisher = 1 + icon_state = text("extinguisher[][]",hasextinguisher,src.localopened) diff --git a/code/game/objects/closets/fireaxe.dm b/code/game/objects/closets/fireaxe.dm new file mode 100644 index 00000000000..649f2e22406 --- /dev/null +++ b/code/game/objects/closets/fireaxe.dm @@ -0,0 +1,198 @@ +//I still dont think this should be a closet but whatever +/obj/structure/closet/fireaxecabinet + name = "Fire Axe Cabinet" + desc = "There is small label that reads \"For Emergency use only\" along with details for safe use of the axe. As if." + var/obj/item/weapon/fireaxe/fireaxe = new/obj/item/weapon/fireaxe + icon_state = "fireaxe1000" + icon_closed = "fireaxe1000" + icon_opened = "fireaxe1100" + anchored = 1 + density = 0 + var/localopened = 0 //Setting this to keep it from behaviouring like a normal closet and obstructing movement in the map. -Agouri + opened = 1 + var/hitstaken = 0 + var/locked = 1 + var/smashed = 0 + + attackby(var/obj/item/O as obj, var/mob/user as mob) //Marker -Agouri + //..() //That's very useful, Erro + + var/hasaxe = 0 //gonna come in handy later~ + if(fireaxe) + hasaxe = 1 + + if (isrobot(usr) || src.locked) + if(istype(O, /obj/item/device/multitool)) + user << "\red Resetting circuitry..." + playsound(user, 'lockreset.ogg', 50, 1) + sleep(50) // Sleeping time~ + src.locked = 0 + user << "\blue You disable the locking modules." + update_icon() + return + else if(istype(O, /obj/item/weapon)) + var/obj/item/weapon/W = O + if(src.smashed || src.localopened) + if(localopened) + localopened = 0 + icon_state = text("fireaxe[][][][]closing",hasaxe,src.localopened,src.hitstaken,src.smashed) + spawn(10) update_icon() + return + else + playsound(user, 'Glasshit.ogg', 100, 1) //We don't want this playing every time + if(W.force < 15) + user << "\blue The cabinet's protective glass glances off the hit." + else + src.hitstaken++ + if(src.hitstaken == 4) + playsound(user, 'Glassbr3.ogg', 100, 1) //Break cabinet, receive goodies. Cabinet's fucked for life after that. + src.smashed = 1 + src.locked = 0 + src.localopened = 1 + update_icon() + return + if (istype(O, /obj/item/weapon/fireaxe) && src.localopened) + if(!fireaxe) + if(O.wielded) + user << "\red Unwield the axe first." + return + fireaxe = O + user.drop_item(O) + src.contents += O + user << "\blue You place the fire axe back in the [src.name]." + update_icon() + else + if(src.smashed) + return + else + localopened = !localopened + if(localopened) + icon_state = text("fireaxe[][][][]opening",hasaxe,src.localopened,src.hitstaken,src.smashed) + spawn(10) update_icon() + else + icon_state = text("fireaxe[][][][]closing",hasaxe,src.localopened,src.hitstaken,src.smashed) + spawn(10) update_icon() + else + if(src.smashed) + return + if(istype(O, /obj/item/device/multitool)) + if(localopened) + localopened = 0 + icon_state = text("fireaxe[][][][]closing",hasaxe,src.localopened,src.hitstaken,src.smashed) + spawn(10) update_icon() + return + else + user << "\red Resetting circuitry..." + sleep(50) + src.locked = 1 + user << "\blue You re-enable the locking modules." + playsound(user, 'lockenable.ogg', 50, 1) + return + else + localopened = !localopened + if(localopened) + icon_state = text("fireaxe[][][][]opening",hasaxe,src.localopened,src.hitstaken,src.smashed) + spawn(10) update_icon() + else + icon_state = text("fireaxe[][][][]closing",hasaxe,src.localopened,src.hitstaken,src.smashed) + spawn(10) update_icon() + + + + + attack_hand(mob/user as mob) + + var/hasaxe = 0 + if(fireaxe) + hasaxe = 1 + + if(src.locked) + user <<"\red The cabinet won't budge!" + return + if(localopened) + if(fireaxe) + user.put_in_hand(fireaxe) + fireaxe = null + user << "\blue You take the fire axe from the [name]." + src.add_fingerprint(user) + update_icon() + else + if(src.smashed) + return + else + localopened = !localopened + if(localopened) + src.icon_state = text("fireaxe[][][][]opening",hasaxe,src.localopened,src.hitstaken,src.smashed) + spawn(10) update_icon() + else + src.icon_state = text("fireaxe[][][][]closing",hasaxe,src.localopened,src.hitstaken,src.smashed) + spawn(10) update_icon() + + else + localopened = !localopened //I'm pretty sure we don't need an if(src.smashed) in here. In case I'm wrong and it fucks up teh cabinet, **MARKER**. -Agouri + if(localopened) + src.icon_state = text("fireaxe[][][][]opening",hasaxe,src.localopened,src.hitstaken,src.smashed) + spawn(10) update_icon() + else + src.icon_state = text("fireaxe[][][][]closing",hasaxe,src.localopened,src.hitstaken,src.smashed) + spawn(10) update_icon() + + verb/toggle_openness() //nice name, huh? HUH?! -Erro //YEAH -Agouri + set name = "Open/Close" + set category = "Object" + + if (isrobot(usr) || src.locked || src.smashed) + if(src.locked) + usr << "\red The cabinet won't budge!" + else if(src.smashed) + usr << "\blue The protective glass is broken!" + return + + localopened = !localopened + update_icon() + + verb/remove_fire_axe() + set name = "Remove Fire Axe" + set category = "Object" + + if (isrobot(usr)) + return + + if (localopened) + if(fireaxe) + usr.put_in_hand(fireaxe) + fireaxe = null + usr << "\blue You take the Fire axe from the [name]." + else + usr << "\blue The [src.name] is empty." + else + usr << "\blue The [src.name] is closed." + update_icon() + + attack_paw(mob/user as mob) + attack_hand(user) + return + + attack_ai(mob/user as mob) + if(src.smashed) + user << "\red The security of the cabinet is compromised." + return + else + locked = !locked + if(locked) + user << "\red Cabinet locked." + else + user << "\blue Cabinet unlocked." + return + + update_icon() //Template: fireaxe[has fireaxe][is opened][hits taken][is smashed]. If you want the opening or closing animations, add "opening" or "closing" right after the numbers + var/hasaxe = 0 + if(fireaxe) + hasaxe = 1 + icon_state = text("fireaxe[][][][]",hasaxe,src.localopened,src.hitstaken,src.smashed) + + open() + return + + close() + return \ No newline at end of file diff --git a/code/game/objects/washing_machine.dm b/code/game/objects/washing_machine.dm index f4904427c19..327d2690e02 100644 --- a/code/game/objects/washing_machine.dm +++ b/code/game/objects/washing_machine.dm @@ -189,9 +189,9 @@ if ( istype(W,/obj/item/clothing/suit/syndicatefake ) ) user << "This item does not fit." return - if ( istype(W,/obj/item/clothing/suit/powered ) ) - user << "This item does not fit." - return +// if ( istype(W,/obj/item/clothing/suit/powered ) ) +// user << "This item does not fit." +// return if ( istype(W,/obj/item/clothing/suit/cyborg_suit ) ) user << "This item does not fit." return @@ -213,9 +213,9 @@ if ( istype(W,/obj/item/clothing/head/syndicatefake ) ) user << "This item does not fit." return - if ( istype(W,/obj/item/clothing/head/powered ) ) - user << "This item does not fit." - return +// if ( istype(W,/obj/item/clothing/head/powered ) ) +// user << "This item does not fit." +// return if ( istype(W,/obj/item/clothing/head/helmet ) ) user << "This item does not fit." return diff --git a/code/modules/food/meat.dm b/code/modules/food/meat.dm new file mode 100644 index 00000000000..5aca55f3ef5 --- /dev/null +++ b/code/modules/food/meat.dm @@ -0,0 +1,23 @@ +/obj/item/weapon/reagent_containers/food/snacks/meat + name = "meat" + desc = "A slab of meat" + icon_state = "meat" + health = 180 + New() + ..() + reagents.add_reagent("nutriment", 3) + src.bitesize = 3 + + +/obj/item/weapon/reagent_containers/food/snacks/meat/syntiflesh + name = "synthetic meat" + desc = "A synthetic slab of flesh." + +/obj/item/weapon/reagent_containers/food/snacks/meat/human + name = "-meat" + var/subjectname = "" + var/subjectjob = null + + +/obj/item/weapon/reagent_containers/food/snacks/meat/monkey + //same as plain meat \ No newline at end of file diff --git a/code/defines/mob/simple_animal/cat.dm b/code/modules/mob/simple_animal/cat.dm similarity index 93% rename from code/defines/mob/simple_animal/cat.dm rename to code/modules/mob/simple_animal/cat.dm index d5d19f95436..f511699f4cb 100644 --- a/code/defines/mob/simple_animal/cat.dm +++ b/code/modules/mob/simple_animal/cat.dm @@ -1,26 +1,26 @@ -//Cat -/mob/living/simple_animal/cat - name = "cat" - desc = "Kitty!!" - icon = 'mob.dmi' - icon_state = "tempcat" - icon_living = "tempcat" - icon_dead = "catdeath" - speak = list("Meow!","Esp!","Purr!","HSSSSS") - speak_emote = list("purrs", "meows") - emote_hear = list("meows","mews") - emote_see = list("shakes it's head", "shivers") - speak_chance = 1 - turns_per_move = 5 - meat_type = /obj/item/weapon/reagent_containers/food/snacks/sliceable/meat - response_help = "pets the" - response_disarm = "gently pushes aside the" - response_harm = "kicks the" - -//RUNTIME! SQUEEEEEEEE~ -/mob/living/simple_animal/cat/Runtime - name = "Runtime" - desc = "" - response_help = "pets" - response_disarm = "gently pushes aside" +//Cat +/mob/living/simple_animal/cat + name = "cat" + desc = "Kitty!!" + icon = 'mob.dmi' + icon_state = "tempcat" + icon_living = "tempcat" + icon_dead = "catdeath" + speak = list("Meow!","Esp!","Purr!","HSSSSS") + speak_emote = list("purrs", "meows") + emote_hear = list("meows","mews") + emote_see = list("shakes it's head", "shivers") + speak_chance = 1 + turns_per_move = 5 + meat_type = /obj/item/weapon/reagent_containers/food/snacks/sliceable/meat + response_help = "pets the" + response_disarm = "gently pushes aside the" + response_harm = "kicks the" + +//RUNTIME! SQUEEEEEEEE~ +/mob/living/simple_animal/cat/Runtime + name = "Runtime" + desc = "" + response_help = "pets" + response_disarm = "gently pushes aside" response_harm = "kicks" \ No newline at end of file diff --git a/code/defines/mob/simple_animal/corgi.dm b/code/modules/mob/simple_animal/corgi.dm similarity index 96% rename from code/defines/mob/simple_animal/corgi.dm rename to code/modules/mob/simple_animal/corgi.dm index f86729daec0..c2925685f6f 100644 --- a/code/defines/mob/simple_animal/corgi.dm +++ b/code/modules/mob/simple_animal/corgi.dm @@ -1,373 +1,373 @@ -//Corgi -/mob/living/simple_animal/corgi - name = "corgi" - real_name = "corgi" - desc = "Puppy!!" - icon = 'mob.dmi' - icon_state = "corgi" - icon_living = "corgi" - icon_dead = "corgi_dead" - speak = list("YAP", "Woof!", "Bark!", "AUUUUUU") - speak_emote = list("barks", "woofs") - emote_hear = list("barks", "woofs", "yaps","pants") - emote_see = list("shakes it's head", "shivers") - speak_chance = 1 - turns_per_move = 5 - meat_type = /obj/item/weapon/reagent_containers/food/snacks/sliceable/meat/corgi - meat_amount = 3 - response_help = "pets the" - response_disarm = "gently pushes aside the" - response_harm = "kicks the" - var/obj/item/inventory_head - var/obj/item/inventory_back - var/obj/item/inventory_mouth - -/mob/living/simple_animal/corgi/update_clothing() - overlays = list() - - if(inventory_head) - var/head_icon_state = inventory_head.icon_state - if(health <= 0) - head_icon_state += "2" - - var/icon/head_icon = icon('corgi_head.dmi',head_icon_state) - if(head_icon) - overlays += head_icon - - if(inventory_back) - var/back_icon_state = inventory_back.icon_state - if(health <= 0) - back_icon_state += "2" - - var/icon/back_icon = icon('corgi_back.dmi',back_icon_state) - if(back_icon) - overlays += back_icon - return - -/mob/living/simple_animal/corgi/Life() - ..() - update_clothing() - -/mob/living/simple_animal/corgi/show_inv(mob/user as mob) - /* - user.machine = src - - var/dat = "
Inventory of [src]

" - if(inventory_head) - dat += "
Head: [inventory_head] (Remove)" - else - dat += "
Head: Nothing" - if(inventory_back) - dat += "
Back: [inventory_back] (Remove)" - else - dat += "
Back: Nothing" - - user << browse(dat, text("window=mob[];size=325x500", name)) - onclose(user, "mob[name]") - */ - return - -/mob/living/simple_animal/corgi/attackby(var/obj/item/O as obj, var/mob/user as mob) - if(inventory_head && inventory_back) - //helmet and armor = 100% protection - if( istype(inventory_head,/obj/item/clothing/head/helmet) && istype(inventory_back,/obj/item/clothing/suit/armor) ) - if( O.force ) - usr << "\red This animal is wearing too much armor. You can't cause it any damage." - for (var/mob/M in viewers(src, null)) - M.show_message("\red \b [user] hits [src] with the [O], however [src] is too armored.") - else - usr << "\red This animal is wearing too much armor. You can't reach it's skin." - for (var/mob/M in viewers(src, null)) - M.show_message("\red [user] gently taps [src] with the [O]. ") - if(prob(15)) - emote("looks at [user] with [pick("an amused","an annoyed","a confused","a resentful", "a happy", "an excited")] expression on it's face") - return - ..() - -/mob/living/simple_animal/corgi/Topic(href, href_list) - //Removing from inventory - if(href_list["remove_inv"]) - if(get_dist(src,usr) > 1) - return - var/remove_from = href_list["remove_inv"] - switch(remove_from) - if("head") - if(inventory_head) - name = real_name - desc = initial(desc) - speak = list("YAP", "Woof!", "Bark!", "AUUUUUU") - speak_emote = list("barks", "woofs") - emote_hear = list("barks", "woofs", "yaps","pants") - emote_see = list("shakes it's head", "shivers") - desc = "It's a corgi." - src.sd_SetLuminosity(0) - inventory_head.loc = src.loc - inventory_head = null - else - usr << "\red There is nothing on its [remove_from]." - return - if("back") - if(inventory_back) - inventory_back.loc = src.loc - inventory_back = null - else - usr << "\red There is nothing on its [remove_from]." - return - - show_inv(usr) - - //Adding things to inventory - else if(href_list["add_inv"]) - if(get_dist(src,usr) > 1) - return - if(!usr.get_active_hand()) - usr << "\red You have nothing in your active hand to put in the slot." - return - var/add_to = href_list["add_inv"] - switch(add_to) - if("head") - if(inventory_head) - usr << "\red The [inventory_head] is already in this slot." - return - else - var/obj/item/item_to_add = usr.get_active_hand() - if(!item_to_add) - return - - //Corgis are supposed to be simpler, so only a select few objects can actually be put - //to be compatible with them. The objects are below. - //Many hats added, Some will probably be removed, just want to see which ones are popular. - - var/list/allowed_types = list( - /obj/item/clothing/head/helmet, - /obj/item/clothing/glasses/sunglasses, - /obj/item/clothing/head/caphat, - /obj/item/clothing/head/collectable/captain, - /obj/item/clothing/head/that, - /obj/item/clothing/head/helmet/that, - /obj/item/clothing/head/kitty, - /obj/item/clothing/head/collectable/kitty, - /obj/item/clothing/head/rabbitears, - /obj/item/clothing/head/collectable/rabbitears, - /obj/item/clothing/head/beret, - /obj/item/clothing/head/collectable/beret, - /obj/item/clothing/head/det_hat, - /obj/item/clothing/head/nursehat, - /obj/item/clothing/head/pirate, - /obj/item/clothing/head/collectable/pirate, - /obj/item/clothing/head/ushanka, - /obj/item/clothing/head/chefhat, - /obj/item/clothing/head/collectable/chef, - /obj/item/clothing/head/collectable/police, - /obj/item/clothing/head/wizard/fake, - /obj/item/clothing/head/wizard, - /obj/item/clothing/head/collectable/wizard, - /obj/item/clothing/head/helmet/hardhat, - /obj/item/clothing/head/collectable/hardhat, - /obj/item/clothing/head/helmet/hardhat/white, - /obj/item/weapon/bedsheet, - /obj/item/clothing/head/helmet/space/santahat, - /obj/item/clothing/head/collectable/paper - ) - - if( ! ( item_to_add.type in allowed_types ) ) - usr << "\red The corgi doesn't seem too keen on wearing that item." - return - - usr.drop_item() - item_to_add.loc = src - src.inventory_head = item_to_add - update_clothing() - - //Various hats and items (worn on his head) change Ian's behaviour. His attributesare reset when a HAT is removed. - - - switch(inventory_head && inventory_head.type) - if(/obj/item/clothing/head/caphat, /obj/item/clothing/head/collectable/captain) - name = "Captain [real_name]" - desc = "Probably better than the last captain." - if(/obj/item/clothing/head/kitty, /obj/item/clothing/head/collectable/kitty) - name = "Runtime" - emote_see = list("coughs up a furball", "stretches") - emote_hear = list("purrs") - speak = list("Purrr", "Meow!", "MAOOOOOW!", "HISSSSS", "MEEEEEEW") - desc = "It's a cute little kitty-cat! ... wait ... what the hell?" - if(/obj/item/clothing/head/rabbitears, /obj/item/clothing/head/collectable/rabbitears) - name = "Hoppy" - emote_see = list("twitches his nose", "hops around a bit") - desc = "This is hoppy. It's a corgi-...urmm... bunny rabbit" - if(/obj/item/clothing/head/beret, /obj/item/clothing/head/collectable/beret) - name = "Yann" - desc = "mon dieu! C'est un chien!" - speak = list("le woof!", "le bark!", "JAPPE!!") - emote_see = list("cowers in fear", "surrenders", "plays dead") - if(/obj/item/clothing/head/det_hat) - name = "Detective [real_name]" - desc = "[name] sees through your lies..." - emote_see = list("investigates the area","sniffs around for clues","searches for scooby snacks") - if(/obj/item/clothing/head/nursehat) - name = "Nurse [real_name]" - desc = "[name] needs 100cc of beef jerky...STAT!" - if(/obj/item/clothing/head/pirate, /obj/item/clothing/head/collectable/pirate) - name = "'[pick("Ol'","Scurvy","Black","Rum","Gammy","Bloody","Gangrene","Death","Long-John")] [pick("kibbles","leg","beard","tooth","poop-deck","Threepwood","Le Chuck","corsair","Silver","Crusoe")]'" - desc = "Yaarghh!! Thar' be a scurvy dog!" - emote_see = list("hunts for treasure","stares coldly...","gnashes his tiny corgi teeth") - emote_hear = list("growls ferociously", "snarls") - speak = list("Arrrrgh!!","Grrrrrr!") - if(/obj/item/clothing/head/ushanka) - name = "[pick("Comrade","Commissar")] [real_name]" - desc = "A follower of Karl Barx." - emote_see = list("contemplates the failings of the capitalist economic model", "ponders the pros and cons of vangaurdism") - if(/obj/item/clothing/head/collectable/police) - name = "Officer [real_name]" - emote_see = list("drools","looks for donuts") - desc = "Stop right there criminal scum!" - if(/obj/item/clothing/head/wizard/fake, /obj/item/clothing/head/wizard, /obj/item/clothing/head/collectable/wizard) - name = "Grandwizard [real_name]" - speak = list("YAP", "Woof!", "Bark!", "AUUUUUU", "EI NATH!") - if(/obj/item/weapon/bedsheet) - name = "The ghost" - speak = list("WoooOOOooo~","AUUUUUUUUUUUUUUUUUU") - emote_see = list("stumbles around", "shivers") - emote_hear = list("howls","groans") - desc = "Spooky!" - if(/obj/item/clothing/head/helmet/space/santahat) - name = "Rudolph the Red-Nosed Corgi" - emote_hear = list("barks christmas songs", "yaps") - desc = "He has a very shiny nose." - src.sd_SetLuminosity(6) - - if("back") - if(inventory_back) - usr << "\red The [inventory_back] is already in this slot." - return - else - var/obj/item/item_to_add = usr.get_active_hand() - if(!item_to_add) - return - - //Corgis are supposed to be simpler, so only a select few objects can actually be put - //to be compatible with them. The objects are below. - - var/list/allowed_types = list( - /obj/item/clothing/suit/armor/vest, - /obj/item/device/radio - ) - - if( ! ( item_to_add.type in allowed_types ) ) - usr << "\red The object cannot fit on this animal." - return - - usr.drop_item() - item_to_add.loc = src - src.inventory_back = item_to_add - update_clothing() - - //show_inv(usr) //Commented out because changing Ian's name and then calling up his inventory opens a new inventory...which is annoying. - else - ..() - -//IAN! SQUEEEEEEEEE~ -/mob/living/simple_animal/corgi/Ian - name = "Ian" - real_name = "Ian" //Intended to hold the name without altering it. - desc = "It's a corgi." - var/turns_since_scan = 0 - var/obj/movement_target - response_help = "pets" - response_disarm = "gently pushes aside" - response_harm = "kicks" - -/mob/living/simple_animal/corgi/Ian/Life() - ..() - - //Feeding, chasing food, FOOOOODDDD - if(alive && !resting && !buckled) - turns_since_scan++ - if(turns_since_scan > 5) - turns_since_scan = 0 - if((movement_target) && !(isturf(movement_target.loc) || ishuman(movement_target.loc) )) - movement_target = null - stop_automated_movement = 0 - if( !movement_target || !(movement_target.loc in oview(src, 3)) ) - movement_target = null - stop_automated_movement = 0 - for(var/obj/item/weapon/reagent_containers/food/snacks/S in oview(src,3)) - if(isturf(S.loc) || ishuman(S.loc)) - movement_target = S - break - if(movement_target) - stop_automated_movement = 1 - step_to(src,movement_target,1) - sleep(3) - step_to(src,movement_target,1) - sleep(3) - step_to(src,movement_target,1) - - if(movement_target) //Not redundant due to sleeps, Item can be gone in 6 decisecomds - if (movement_target.loc.x < src.x) - dir = WEST - else if (movement_target.loc.x > src.x) - dir = EAST - else if (movement_target.loc.y < src.y) - dir = SOUTH - else if (movement_target.loc.y > src.y) - dir = NORTH - else - dir = SOUTH - - if(isturf(movement_target.loc) ) - movement_target.attack_animal(src) - else if(ishuman(movement_target.loc) ) - if(prob(20)) - emote("stares at the [movement_target] that [movement_target.loc] has with a sad puppy-face") - - if(prob(1)) - emote("dances around") - spawn(0) - for(var/i in list(1,2,4,8,4,2,1,2,4,8,4,2,1,2,4,8,4,2)) - dir = i - sleep(1) - -/obj/item/weapon/reagent_containers/food/snacks/sliceable/meat/corgi - name = "Corgi meat" - desc = "Tastes like... well you know..." - -/mob/living/simple_animal/corgi/Ian/Bump(atom/movable/AM as mob|obj, yes) - - spawn( 0 ) - if ((!( yes ) || now_pushing)) - return - now_pushing = 1 - if(ismob(AM)) - var/mob/tmob = AM - if(istype(tmob, /mob/living/carbon/human) && tmob.mutations & FAT) - if(prob(70)) - for(var/mob/M in viewers(src, null)) - if(M.client) - M << "\red [src] fails to push [tmob]'s fat ass out of the way." - now_pushing = 0 - return - - tmob.LAssailant = src - now_pushing = 0 - ..() - if (!( istype(AM, /atom/movable) )) - return - if (!( now_pushing )) - now_pushing = 1 - if (!( AM.anchored )) - var/t = get_dir(src, AM) - if (istype(AM, /obj/structure/window)) - if(AM:ini_dir == NORTHWEST || AM:ini_dir == NORTHEAST || AM:ini_dir == SOUTHWEST || AM:ini_dir == SOUTHEAST) - for(var/obj/structure/window/win in get_step(AM,t)) - now_pushing = 0 - return - step(AM, t) - now_pushing = null - return - return - -/obj/item/weapon/reagent_containers/food/snacks/sliceable/meat/corgi - name = "Corgi meat" +//Corgi +/mob/living/simple_animal/corgi + name = "corgi" + real_name = "corgi" + desc = "Puppy!!" + icon = 'mob.dmi' + icon_state = "corgi" + icon_living = "corgi" + icon_dead = "corgi_dead" + speak = list("YAP", "Woof!", "Bark!", "AUUUUUU") + speak_emote = list("barks", "woofs") + emote_hear = list("barks", "woofs", "yaps","pants") + emote_see = list("shakes it's head", "shivers") + speak_chance = 1 + turns_per_move = 5 + meat_type = /obj/item/weapon/reagent_containers/food/snacks/sliceable/meat/corgi + meat_amount = 3 + response_help = "pets the" + response_disarm = "gently pushes aside the" + response_harm = "kicks the" + var/obj/item/inventory_head + var/obj/item/inventory_back + var/obj/item/inventory_mouth + +/mob/living/simple_animal/corgi/update_clothing() + overlays = list() + + if(inventory_head) + var/head_icon_state = inventory_head.icon_state + if(health <= 0) + head_icon_state += "2" + + var/icon/head_icon = icon('corgi_head.dmi',head_icon_state) + if(head_icon) + overlays += head_icon + + if(inventory_back) + var/back_icon_state = inventory_back.icon_state + if(health <= 0) + back_icon_state += "2" + + var/icon/back_icon = icon('corgi_back.dmi',back_icon_state) + if(back_icon) + overlays += back_icon + return + +/mob/living/simple_animal/corgi/Life() + ..() + update_clothing() + +/mob/living/simple_animal/corgi/show_inv(mob/user as mob) + /* + user.machine = src + + var/dat = "

Inventory of [src]

" + if(inventory_head) + dat += "
Head: [inventory_head] (Remove)" + else + dat += "
Head: Nothing" + if(inventory_back) + dat += "
Back: [inventory_back] (Remove)" + else + dat += "
Back: Nothing" + + user << browse(dat, text("window=mob[];size=325x500", name)) + onclose(user, "mob[name]") + */ + return + +/mob/living/simple_animal/corgi/attackby(var/obj/item/O as obj, var/mob/user as mob) + if(inventory_head && inventory_back) + //helmet and armor = 100% protection + if( istype(inventory_head,/obj/item/clothing/head/helmet) && istype(inventory_back,/obj/item/clothing/suit/armor) ) + if( O.force ) + usr << "\red This animal is wearing too much armor. You can't cause it any damage." + for (var/mob/M in viewers(src, null)) + M.show_message("\red \b [user] hits [src] with the [O], however [src] is too armored.") + else + usr << "\red This animal is wearing too much armor. You can't reach it's skin." + for (var/mob/M in viewers(src, null)) + M.show_message("\red [user] gently taps [src] with the [O]. ") + if(prob(15)) + emote("looks at [user] with [pick("an amused","an annoyed","a confused","a resentful", "a happy", "an excited")] expression on it's face") + return + ..() + +/mob/living/simple_animal/corgi/Topic(href, href_list) + //Removing from inventory + if(href_list["remove_inv"]) + if(get_dist(src,usr) > 1) + return + var/remove_from = href_list["remove_inv"] + switch(remove_from) + if("head") + if(inventory_head) + name = real_name + desc = initial(desc) + speak = list("YAP", "Woof!", "Bark!", "AUUUUUU") + speak_emote = list("barks", "woofs") + emote_hear = list("barks", "woofs", "yaps","pants") + emote_see = list("shakes it's head", "shivers") + desc = "It's a corgi." + src.sd_SetLuminosity(0) + inventory_head.loc = src.loc + inventory_head = null + else + usr << "\red There is nothing on its [remove_from]." + return + if("back") + if(inventory_back) + inventory_back.loc = src.loc + inventory_back = null + else + usr << "\red There is nothing on its [remove_from]." + return + + show_inv(usr) + + //Adding things to inventory + else if(href_list["add_inv"]) + if(get_dist(src,usr) > 1) + return + if(!usr.get_active_hand()) + usr << "\red You have nothing in your active hand to put in the slot." + return + var/add_to = href_list["add_inv"] + switch(add_to) + if("head") + if(inventory_head) + usr << "\red The [inventory_head] is already in this slot." + return + else + var/obj/item/item_to_add = usr.get_active_hand() + if(!item_to_add) + return + + //Corgis are supposed to be simpler, so only a select few objects can actually be put + //to be compatible with them. The objects are below. + //Many hats added, Some will probably be removed, just want to see which ones are popular. + + var/list/allowed_types = list( + /obj/item/clothing/head/helmet, + /obj/item/clothing/glasses/sunglasses, + /obj/item/clothing/head/caphat, + /obj/item/clothing/head/collectable/captain, + /obj/item/clothing/head/that, + /obj/item/clothing/head/helmet/that, + /obj/item/clothing/head/kitty, + /obj/item/clothing/head/collectable/kitty, + /obj/item/clothing/head/rabbitears, + /obj/item/clothing/head/collectable/rabbitears, + /obj/item/clothing/head/beret, + /obj/item/clothing/head/collectable/beret, + /obj/item/clothing/head/det_hat, + /obj/item/clothing/head/nursehat, + /obj/item/clothing/head/pirate, + /obj/item/clothing/head/collectable/pirate, + /obj/item/clothing/head/ushanka, + /obj/item/clothing/head/chefhat, + /obj/item/clothing/head/collectable/chef, + /obj/item/clothing/head/collectable/police, + /obj/item/clothing/head/wizard/fake, + /obj/item/clothing/head/wizard, + /obj/item/clothing/head/collectable/wizard, + /obj/item/clothing/head/helmet/hardhat, + /obj/item/clothing/head/collectable/hardhat, + /obj/item/clothing/head/helmet/hardhat/white, + /obj/item/weapon/bedsheet, + /obj/item/clothing/head/helmet/space/santahat, + /obj/item/clothing/head/collectable/paper + ) + + if( ! ( item_to_add.type in allowed_types ) ) + usr << "\red The corgi doesn't seem too keen on wearing that item." + return + + usr.drop_item() + item_to_add.loc = src + src.inventory_head = item_to_add + update_clothing() + + //Various hats and items (worn on his head) change Ian's behaviour. His attributesare reset when a HAT is removed. + + + switch(inventory_head && inventory_head.type) + if(/obj/item/clothing/head/caphat, /obj/item/clothing/head/collectable/captain) + name = "Captain [real_name]" + desc = "Probably better than the last captain." + if(/obj/item/clothing/head/kitty, /obj/item/clothing/head/collectable/kitty) + name = "Runtime" + emote_see = list("coughs up a furball", "stretches") + emote_hear = list("purrs") + speak = list("Purrr", "Meow!", "MAOOOOOW!", "HISSSSS", "MEEEEEEW") + desc = "It's a cute little kitty-cat! ... wait ... what the hell?" + if(/obj/item/clothing/head/rabbitears, /obj/item/clothing/head/collectable/rabbitears) + name = "Hoppy" + emote_see = list("twitches his nose", "hops around a bit") + desc = "This is hoppy. It's a corgi-...urmm... bunny rabbit" + if(/obj/item/clothing/head/beret, /obj/item/clothing/head/collectable/beret) + name = "Yann" + desc = "mon dieu! C'est un chien!" + speak = list("le woof!", "le bark!", "JAPPE!!") + emote_see = list("cowers in fear", "surrenders", "plays dead") + if(/obj/item/clothing/head/det_hat) + name = "Detective [real_name]" + desc = "[name] sees through your lies..." + emote_see = list("investigates the area","sniffs around for clues","searches for scooby snacks") + if(/obj/item/clothing/head/nursehat) + name = "Nurse [real_name]" + desc = "[name] needs 100cc of beef jerky...STAT!" + if(/obj/item/clothing/head/pirate, /obj/item/clothing/head/collectable/pirate) + name = "'[pick("Ol'","Scurvy","Black","Rum","Gammy","Bloody","Gangrene","Death","Long-John")] [pick("kibbles","leg","beard","tooth","poop-deck","Threepwood","Le Chuck","corsair","Silver","Crusoe")]'" + desc = "Yaarghh!! Thar' be a scurvy dog!" + emote_see = list("hunts for treasure","stares coldly...","gnashes his tiny corgi teeth") + emote_hear = list("growls ferociously", "snarls") + speak = list("Arrrrgh!!","Grrrrrr!") + if(/obj/item/clothing/head/ushanka) + name = "[pick("Comrade","Commissar")] [real_name]" + desc = "A follower of Karl Barx." + emote_see = list("contemplates the failings of the capitalist economic model", "ponders the pros and cons of vangaurdism") + if(/obj/item/clothing/head/collectable/police) + name = "Officer [real_name]" + emote_see = list("drools","looks for donuts") + desc = "Stop right there criminal scum!" + if(/obj/item/clothing/head/wizard/fake, /obj/item/clothing/head/wizard, /obj/item/clothing/head/collectable/wizard) + name = "Grandwizard [real_name]" + speak = list("YAP", "Woof!", "Bark!", "AUUUUUU", "EI NATH!") + if(/obj/item/weapon/bedsheet) + name = "The ghost" + speak = list("WoooOOOooo~","AUUUUUUUUUUUUUUUUUU") + emote_see = list("stumbles around", "shivers") + emote_hear = list("howls","groans") + desc = "Spooky!" + if(/obj/item/clothing/head/helmet/space/santahat) + name = "Rudolph the Red-Nosed Corgi" + emote_hear = list("barks christmas songs", "yaps") + desc = "He has a very shiny nose." + src.sd_SetLuminosity(6) + + if("back") + if(inventory_back) + usr << "\red The [inventory_back] is already in this slot." + return + else + var/obj/item/item_to_add = usr.get_active_hand() + if(!item_to_add) + return + + //Corgis are supposed to be simpler, so only a select few objects can actually be put + //to be compatible with them. The objects are below. + + var/list/allowed_types = list( + /obj/item/clothing/suit/armor/vest, + /obj/item/device/radio + ) + + if( ! ( item_to_add.type in allowed_types ) ) + usr << "\red The object cannot fit on this animal." + return + + usr.drop_item() + item_to_add.loc = src + src.inventory_back = item_to_add + update_clothing() + + //show_inv(usr) //Commented out because changing Ian's name and then calling up his inventory opens a new inventory...which is annoying. + else + ..() + +//IAN! SQUEEEEEEEEE~ +/mob/living/simple_animal/corgi/Ian + name = "Ian" + real_name = "Ian" //Intended to hold the name without altering it. + desc = "It's a corgi." + var/turns_since_scan = 0 + var/obj/movement_target + response_help = "pets" + response_disarm = "gently pushes aside" + response_harm = "kicks" + +/mob/living/simple_animal/corgi/Ian/Life() + ..() + + //Feeding, chasing food, FOOOOODDDD + if(alive && !resting && !buckled) + turns_since_scan++ + if(turns_since_scan > 5) + turns_since_scan = 0 + if((movement_target) && !(isturf(movement_target.loc) || ishuman(movement_target.loc) )) + movement_target = null + stop_automated_movement = 0 + if( !movement_target || !(movement_target.loc in oview(src, 3)) ) + movement_target = null + stop_automated_movement = 0 + for(var/obj/item/weapon/reagent_containers/food/snacks/S in oview(src,3)) + if(isturf(S.loc) || ishuman(S.loc)) + movement_target = S + break + if(movement_target) + stop_automated_movement = 1 + step_to(src,movement_target,1) + sleep(3) + step_to(src,movement_target,1) + sleep(3) + step_to(src,movement_target,1) + + if(movement_target) //Not redundant due to sleeps, Item can be gone in 6 decisecomds + if (movement_target.loc.x < src.x) + dir = WEST + else if (movement_target.loc.x > src.x) + dir = EAST + else if (movement_target.loc.y < src.y) + dir = SOUTH + else if (movement_target.loc.y > src.y) + dir = NORTH + else + dir = SOUTH + + if(isturf(movement_target.loc) ) + movement_target.attack_animal(src) + else if(ishuman(movement_target.loc) ) + if(prob(20)) + emote("stares at the [movement_target] that [movement_target.loc] has with a sad puppy-face") + + if(prob(1)) + emote("dances around") + spawn(0) + for(var/i in list(1,2,4,8,4,2,1,2,4,8,4,2,1,2,4,8,4,2)) + dir = i + sleep(1) + +/obj/item/weapon/reagent_containers/food/snacks/sliceable/meat/corgi + name = "Corgi meat" + desc = "Tastes like... well you know..." + +/mob/living/simple_animal/corgi/Ian/Bump(atom/movable/AM as mob|obj, yes) + + spawn( 0 ) + if ((!( yes ) || now_pushing)) + return + now_pushing = 1 + if(ismob(AM)) + var/mob/tmob = AM + if(istype(tmob, /mob/living/carbon/human) && tmob.mutations & FAT) + if(prob(70)) + for(var/mob/M in viewers(src, null)) + if(M.client) + M << "\red [src] fails to push [tmob]'s fat ass out of the way." + now_pushing = 0 + return + + tmob.LAssailant = src + now_pushing = 0 + ..() + if (!( istype(AM, /atom/movable) )) + return + if (!( now_pushing )) + now_pushing = 1 + if (!( AM.anchored )) + var/t = get_dir(src, AM) + if (istype(AM, /obj/structure/window)) + if(AM:ini_dir == NORTHWEST || AM:ini_dir == NORTHEAST || AM:ini_dir == SOUTHWEST || AM:ini_dir == SOUTHEAST) + for(var/obj/structure/window/win in get_step(AM,t)) + now_pushing = 0 + return + step(AM, t) + now_pushing = null + return + return + +/obj/item/weapon/reagent_containers/food/snacks/sliceable/meat/corgi + name = "Corgi meat" desc = "Tastes like... well you know..." \ No newline at end of file diff --git a/code/defines/mob/simple_animal/crab.dm b/code/modules/mob/simple_animal/crab.dm similarity index 94% rename from code/defines/mob/simple_animal/crab.dm rename to code/modules/mob/simple_animal/crab.dm index 3fec1a9e5cd..88ad55f0ac3 100644 --- a/code/defines/mob/simple_animal/crab.dm +++ b/code/modules/mob/simple_animal/crab.dm @@ -1,36 +1,36 @@ -//Look Sir, free crabs! -/mob/living/simple_animal/crab - name = "crab" - desc = "Free crabs!" - icon = 'mob.dmi' - icon_state = "crab" - icon_living = "crab" - icon_dead = "crab_dead" - emote_hear = list("clicks") - emote_see = list("clacks") - speak_chance = 1 - turns_per_move = 5 - meat_type = /obj/item/weapon/reagent_containers/food/snacks/sliceable/meat - response_help = "pets the" - response_disarm = "gently pushes aside the" - response_harm = "stomps the" - stop_automated_movement = 1 - friendly = "pinches" - -/mob/living/simple_animal/crab/Life() - ..() - //CRAB movement - if(!ckey) - if(isturf(src.loc) && !resting && !buckled) //This is so it only moves if it's not inside a closet, gentics machine, etc. - turns_since_move++ - if(turns_since_move >= turns_per_move) - Move(get_step(src,pick(4,8))) - turns_since_move = 0 - -//COFFEE! SQUEEEEEEEEE! -/mob/living/simple_animal/crab/Coffee - name = "Coffee" - desc = "It's Coffee, the other pet!" - response_help = "pets" - response_disarm = "gently pushes aside" +//Look Sir, free crabs! +/mob/living/simple_animal/crab + name = "crab" + desc = "Free crabs!" + icon = 'mob.dmi' + icon_state = "crab" + icon_living = "crab" + icon_dead = "crab_dead" + emote_hear = list("clicks") + emote_see = list("clacks") + speak_chance = 1 + turns_per_move = 5 + meat_type = /obj/item/weapon/reagent_containers/food/snacks/sliceable/meat + response_help = "pets the" + response_disarm = "gently pushes aside the" + response_harm = "stomps the" + stop_automated_movement = 1 + friendly = "pinches" + +/mob/living/simple_animal/crab/Life() + ..() + //CRAB movement + if(!ckey) + if(isturf(src.loc) && !resting && !buckled) //This is so it only moves if it's not inside a closet, gentics machine, etc. + turns_since_move++ + if(turns_since_move >= turns_per_move) + Move(get_step(src,pick(4,8))) + turns_since_move = 0 + +//COFFEE! SQUEEEEEEEEE! +/mob/living/simple_animal/crab/Coffee + name = "Coffee" + desc = "It's Coffee, the other pet!" + response_help = "pets" + response_disarm = "gently pushes aside" response_harm = "stomps" \ No newline at end of file diff --git a/code/defines/mob/simple_animal/life.dm b/code/modules/mob/simple_animal/life.dm similarity index 96% rename from code/defines/mob/simple_animal/life.dm rename to code/modules/mob/simple_animal/life.dm index 28479e790a6..292b88406f3 100644 --- a/code/defines/mob/simple_animal/life.dm +++ b/code/modules/mob/simple_animal/life.dm @@ -1,289 +1,289 @@ -/mob/living/simple_animal - name = "animal" - var/icon_living = "" - var/icon_dead = "" - var/max_health = 20 - var/alive = 1 - var/list/speak = list() - var/list/speak_emote = list()// Emotes while speaking IE: Ian [emote], [text] -- Ian barks, "WOOF!". Spoken text is generated from the speak variable. - var/speak_chance = 0 - var/list/emote_hear = list() //EHearable emotes - var/list/emote_see = list() //Unlike speak_emote, the list of things in this variable only show by themselves with no spoken text. IE: Ian barks, Ian yaps - health = 20 - var/turns_per_move = 1 - var/turns_since_move = 0 - universal_speak = 1 - var/meat_amount = 0 - var/meat_type - var/stop_automated_movement = 0 //Use this to temporarely stop random movement or to if you write special movement code for animals. - - //Interaction - var/response_help = "You try to help" - var/response_disarm = "You try to disarm" - var/response_harm = "You try to hurt" - var/harm_intent_damage = 3 - - //Temperature effect - var/minbodytemp = 270 - var/maxbodytemp = 370 - var/heat_damage_per_tick = 3 //amount of damage applied if animal's body temperature is higher than maxbodytemp - var/cold_damage_per_tick = 2 //same as heat_damage_per_tick, only if the bodytemperature it's lower than minbodytemp - - //Atmos effect - Yes, you can make creatures that require plasma or co2 to survive. N2O is a trace gas and handled separately, hence why it isn't here. It'd be hard to add it. Hard and me don't mix (Yes, yes make all the dick jokes you want with that.) - Errorage - var/min_oxy = 5 - var/max_oxy = 0 //Leaving something at 0 means it's off - has no maximum - var/min_tox = 0 - var/max_tox = 1 - var/min_co2 = 0 - var/max_co2 = 5 - var/min_n2 = 0 - var/max_n2 = 0 - var/unsuitable_atoms_damage = 2 //This damage is taken when atmos doesn't fit all the requirements above - - - //LETTING SIMPLE ANIMALS ATTACK? WHAT COULD GO WRONG. Defaults to zero so Ian can still be cuddly - var/melee_damage_lower = 0 - var/melee_damage_upper = 0 - var/attacktext = "attacks" - var/attack_sound = null - var/friendly = "nuzzles" //If the mob does no damage with it's attack - -/mob/living/simple_animal/New() - ..() - verbs -= /mob/verb/observe - -/mob/living/simple_animal/Login() - if(src && src.client) - src.client.screen = null - ..() - -/mob/living/simple_animal/Life() - - //Health - if(!alive) - if(health > 0) - icon_state = icon_living - alive = 1 - stat = 0 //Alive - conscious - density = 1 - return - - if(health < 1) - alive = 0 - icon_state = icon_dead - stat = 2 //Dead - density = 0 - return - - if(health > max_health) - health = max_health - - //Movement - if(!ckey && !stop_automated_movement) - if(isturf(src.loc) && !resting && !buckled) //This is so it only moves if it's not inside a closet, gentics machine, etc. - turns_since_move++ - if(turns_since_move >= turns_per_move) - Move(get_step(src,pick(cardinal))) - turns_since_move = 0 - - //Speaking - if(speak_chance) - if(prob(speak_chance)) - if(speak && (emote_hear || emote_see) ) - var/length = speak.len - if(emote_hear) - length += emote_hear.len - if(emote_see) - length += emote_see.len - var/pick = rand(1,length) - if(pick <= speak.len) - say(pick(speak)) - else - pick -= speak.len - if(emote_see && pick <= emote_see.len) - emote(pick(emote_see),1) - else - emote(pick(emote_hear),2) - if(!speak) - if(!emote_hear && emote_see) - emote(pick(emote_see),1) - if(emote_hear && !emote_see) - emote(pick(emote_hear),2) - if(emote_hear && emote_see) - var/length = emote_hear.len + emote_see.len - var/pick = rand(1,length) - if(pick <= emote_see.len) - emote(pick(emote_see),1) - else - emote(pick(emote_hear),2) - if(speak && !(emote_see || emote_hear)) - say(pick(speak)) - - //Atmos - var/atmos_suitable = 1 - - var/atom/A = src.loc - if(isturf(A)) - var/turf/T = A - var/areatemp = T.temperature - if( abs(areatemp - bodytemperature) > 50 ) - var/diff = areatemp - bodytemperature - diff = diff / 5 - //world << "changed from [bodytemperature] by [diff] to [bodytemperature + diff]" - bodytemperature += diff - - if(istype(T,/turf/simulated)) - var/turf/simulated/ST = T - if(ST.air) - var/tox = ST.air.toxins - var/oxy = ST.air.oxygen - var/n2 = ST.air.nitrogen - var/co2 = ST.air.carbon_dioxide - - if(min_oxy) - if(oxy < min_oxy) - atmos_suitable = 0 - if(max_oxy) - if(oxy > max_oxy) - atmos_suitable = 0 - if(min_tox) - if(tox < min_tox) - atmos_suitable = 0 - if(max_tox) - if(tox > max_tox) - atmos_suitable = 0 - if(min_n2) - if(n2 < min_n2) - atmos_suitable = 0 - if(max_n2) - if(n2 > max_n2) - atmos_suitable = 0 - if(min_co2) - if(co2 < min_co2) - atmos_suitable = 0 - if(max_co2) - if(co2 > max_co2) - atmos_suitable = 0 - - //Atmos effect - if(bodytemperature < minbodytemp) - health -= cold_damage_per_tick - else if(bodytemperature > maxbodytemp) - health -= heat_damage_per_tick - - if(!atmos_suitable) - health -= unsuitable_atoms_damage - -/mob/living/simple_animal/Bumped(AM as mob|obj) - if(!AM) return - if(isturf(src.loc) && !resting && !buckled) - if(ismob(AM)) - var/newamloc = src.loc - src.loc = AM:loc - AM:loc = newamloc - else - ..() - -/mob/living/simple_animal/gib() - if(meat_amount && meat_type) - for(var/i = 0; i < meat_amount; i++) - new meat_type(src.loc) - ..() - -/mob/living/simple_animal/say_quote(var/text) - if(speak_emote) - var/emote = pick(speak_emote) - if(emote) - return "[emote], \"[text]\"" - return "says, \"[text]\""; - -/mob/living/simple_animal/emote(var/act) - if(act) - for (var/mob/O in viewers(src, null)) - O.show_message("[src] [act].") - - -/mob/living/simple_animal/attack_animal(mob/living/simple_animal/M as mob) - if(M.melee_damage_upper == 0) - M.emote("[M.friendly] [src]") - else - for(var/mob/O in viewers(src, null)) - O.show_message("\red [M] [M.attacktext] [src]!", 1) - var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) - health -= damage - -/mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj) - if(!Proj) return - src.health -= Proj.damage - return 0 - -/mob/living/simple_animal/attack_hand(mob/living/carbon/human/M as mob) - ..() - - switch(M.a_intent) - - if ("help") - if (health > 0) - for(var/mob/O in viewers(src, null)) - if ((O.client && !( O.blinded ))) - O.show_message("\blue [M] [response_help] [src]") - - if ("grab") - if (M == src) - return - var/obj/item/weapon/grab/G = new /obj/item/weapon/grab( M ) - G.assailant = M - if (M.hand) - M.l_hand = G - else - M.r_hand = G - G.layer = 20 - G.affecting = src - grabbed_by += G - G.synch() - - LAssailant = M - - for(var/mob/O in viewers(src, null)) - if ((O.client && !( O.blinded ))) - O.show_message(text("\red [] has grabbed [] passively!", M, src), 1) - - if ("hurt") - health -= harm_intent_damage - for(var/mob/O in viewers(src, null)) - if ((O.client && !( O.blinded ))) - O.show_message("\red [M] [response_harm] [src]") - - if ("disarm") - for(var/mob/O in viewers(src, null)) - if ((O.client && !( O.blinded ))) - O.show_message("\blue [M] [response_disarm] [src]") - - return - -/mob/living/simple_animal/attackby(var/obj/item/O as obj, var/mob/user as mob) //Marker -Agouri - if(istype(O, /obj/item/stack/medical)) - if(alive) - var/obj/item/stack/medical/MED = O - if(health < max_health) - if(MED.amount >= 1) - health = min(max_health, health + MED.heal_brute) - MED.amount -= 1 - if(MED.amount <= 0) - del(MED) - for(var/mob/M in viewers(src, null)) - if ((M.client && !( M.blinded ))) - M.show_message("\blue [user] applies the [MED] on [src]") - else - user << "\blue this [src] is dead, medical items won't bring it back to life." - else - if(O.force) - health -= O.force - for(var/mob/M in viewers(src, null)) - if ((M.client && !( M.blinded ))) - M.show_message("\red \b [src] has been attacked with the [O] by [user]. ") - else - usr << "\red This weapon is ineffective, it does no damage." - for(var/mob/M in viewers(src, null)) - if ((M.client && !( M.blinded ))) +/mob/living/simple_animal + name = "animal" + var/icon_living = "" + var/icon_dead = "" + var/max_health = 20 + var/alive = 1 + var/list/speak = list() + var/list/speak_emote = list()// Emotes while speaking IE: Ian [emote], [text] -- Ian barks, "WOOF!". Spoken text is generated from the speak variable. + var/speak_chance = 0 + var/list/emote_hear = list() //EHearable emotes + var/list/emote_see = list() //Unlike speak_emote, the list of things in this variable only show by themselves with no spoken text. IE: Ian barks, Ian yaps + health = 20 + var/turns_per_move = 1 + var/turns_since_move = 0 + universal_speak = 1 + var/meat_amount = 0 + var/meat_type + var/stop_automated_movement = 0 //Use this to temporarely stop random movement or to if you write special movement code for animals. + + //Interaction + var/response_help = "You try to help" + var/response_disarm = "You try to disarm" + var/response_harm = "You try to hurt" + var/harm_intent_damage = 3 + + //Temperature effect + var/minbodytemp = 270 + var/maxbodytemp = 370 + var/heat_damage_per_tick = 3 //amount of damage applied if animal's body temperature is higher than maxbodytemp + var/cold_damage_per_tick = 2 //same as heat_damage_per_tick, only if the bodytemperature it's lower than minbodytemp + + //Atmos effect - Yes, you can make creatures that require plasma or co2 to survive. N2O is a trace gas and handled separately, hence why it isn't here. It'd be hard to add it. Hard and me don't mix (Yes, yes make all the dick jokes you want with that.) - Errorage + var/min_oxy = 5 + var/max_oxy = 0 //Leaving something at 0 means it's off - has no maximum + var/min_tox = 0 + var/max_tox = 1 + var/min_co2 = 0 + var/max_co2 = 5 + var/min_n2 = 0 + var/max_n2 = 0 + var/unsuitable_atoms_damage = 2 //This damage is taken when atmos doesn't fit all the requirements above + + + //LETTING SIMPLE ANIMALS ATTACK? WHAT COULD GO WRONG. Defaults to zero so Ian can still be cuddly + var/melee_damage_lower = 0 + var/melee_damage_upper = 0 + var/attacktext = "attacks" + var/attack_sound = null + var/friendly = "nuzzles" //If the mob does no damage with it's attack + +/mob/living/simple_animal/New() + ..() + verbs -= /mob/verb/observe + +/mob/living/simple_animal/Login() + if(src && src.client) + src.client.screen = null + ..() + +/mob/living/simple_animal/Life() + + //Health + if(!alive) + if(health > 0) + icon_state = icon_living + alive = 1 + stat = 0 //Alive - conscious + density = 1 + return + + if(health < 1) + alive = 0 + icon_state = icon_dead + stat = 2 //Dead + density = 0 + return + + if(health > max_health) + health = max_health + + //Movement + if(!ckey && !stop_automated_movement) + if(isturf(src.loc) && !resting && !buckled) //This is so it only moves if it's not inside a closet, gentics machine, etc. + turns_since_move++ + if(turns_since_move >= turns_per_move) + Move(get_step(src,pick(cardinal))) + turns_since_move = 0 + + //Speaking + if(speak_chance) + if(prob(speak_chance)) + if(speak && (emote_hear || emote_see) ) + var/length = speak.len + if(emote_hear) + length += emote_hear.len + if(emote_see) + length += emote_see.len + var/pick = rand(1,length) + if(pick <= speak.len) + say(pick(speak)) + else + pick -= speak.len + if(emote_see && pick <= emote_see.len) + emote(pick(emote_see),1) + else + emote(pick(emote_hear),2) + if(!speak) + if(!emote_hear && emote_see) + emote(pick(emote_see),1) + if(emote_hear && !emote_see) + emote(pick(emote_hear),2) + if(emote_hear && emote_see) + var/length = emote_hear.len + emote_see.len + var/pick = rand(1,length) + if(pick <= emote_see.len) + emote(pick(emote_see),1) + else + emote(pick(emote_hear),2) + if(speak && !(emote_see || emote_hear)) + say(pick(speak)) + + //Atmos + var/atmos_suitable = 1 + + var/atom/A = src.loc + if(isturf(A)) + var/turf/T = A + var/areatemp = T.temperature + if( abs(areatemp - bodytemperature) > 50 ) + var/diff = areatemp - bodytemperature + diff = diff / 5 + //world << "changed from [bodytemperature] by [diff] to [bodytemperature + diff]" + bodytemperature += diff + + if(istype(T,/turf/simulated)) + var/turf/simulated/ST = T + if(ST.air) + var/tox = ST.air.toxins + var/oxy = ST.air.oxygen + var/n2 = ST.air.nitrogen + var/co2 = ST.air.carbon_dioxide + + if(min_oxy) + if(oxy < min_oxy) + atmos_suitable = 0 + if(max_oxy) + if(oxy > max_oxy) + atmos_suitable = 0 + if(min_tox) + if(tox < min_tox) + atmos_suitable = 0 + if(max_tox) + if(tox > max_tox) + atmos_suitable = 0 + if(min_n2) + if(n2 < min_n2) + atmos_suitable = 0 + if(max_n2) + if(n2 > max_n2) + atmos_suitable = 0 + if(min_co2) + if(co2 < min_co2) + atmos_suitable = 0 + if(max_co2) + if(co2 > max_co2) + atmos_suitable = 0 + + //Atmos effect + if(bodytemperature < minbodytemp) + health -= cold_damage_per_tick + else if(bodytemperature > maxbodytemp) + health -= heat_damage_per_tick + + if(!atmos_suitable) + health -= unsuitable_atoms_damage + +/mob/living/simple_animal/Bumped(AM as mob|obj) + if(!AM) return + if(isturf(src.loc) && !resting && !buckled) + if(ismob(AM)) + var/newamloc = src.loc + src.loc = AM:loc + AM:loc = newamloc + else + ..() + +/mob/living/simple_animal/gib() + if(meat_amount && meat_type) + for(var/i = 0; i < meat_amount; i++) + new meat_type(src.loc) + ..() + +/mob/living/simple_animal/say_quote(var/text) + if(speak_emote) + var/emote = pick(speak_emote) + if(emote) + return "[emote], \"[text]\"" + return "says, \"[text]\""; + +/mob/living/simple_animal/emote(var/act) + if(act) + for (var/mob/O in viewers(src, null)) + O.show_message("[src] [act].") + + +/mob/living/simple_animal/attack_animal(mob/living/simple_animal/M as mob) + if(M.melee_damage_upper == 0) + M.emote("[M.friendly] [src]") + else + for(var/mob/O in viewers(src, null)) + O.show_message("\red [M] [M.attacktext] [src]!", 1) + var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) + health -= damage + +/mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj) + if(!Proj) return + src.health -= Proj.damage + return 0 + +/mob/living/simple_animal/attack_hand(mob/living/carbon/human/M as mob) + ..() + + switch(M.a_intent) + + if ("help") + if (health > 0) + for(var/mob/O in viewers(src, null)) + if ((O.client && !( O.blinded ))) + O.show_message("\blue [M] [response_help] [src]") + + if ("grab") + if (M == src) + return + var/obj/item/weapon/grab/G = new /obj/item/weapon/grab( M ) + G.assailant = M + if (M.hand) + M.l_hand = G + else + M.r_hand = G + G.layer = 20 + G.affecting = src + grabbed_by += G + G.synch() + + LAssailant = M + + for(var/mob/O in viewers(src, null)) + if ((O.client && !( O.blinded ))) + O.show_message(text("\red [] has grabbed [] passively!", M, src), 1) + + if ("hurt") + health -= harm_intent_damage + for(var/mob/O in viewers(src, null)) + if ((O.client && !( O.blinded ))) + O.show_message("\red [M] [response_harm] [src]") + + if ("disarm") + for(var/mob/O in viewers(src, null)) + if ((O.client && !( O.blinded ))) + O.show_message("\blue [M] [response_disarm] [src]") + + return + +/mob/living/simple_animal/attackby(var/obj/item/O as obj, var/mob/user as mob) //Marker -Agouri + if(istype(O, /obj/item/stack/medical)) + if(alive) + var/obj/item/stack/medical/MED = O + if(health < max_health) + if(MED.amount >= 1) + health = min(max_health, health + MED.heal_brute) + MED.amount -= 1 + if(MED.amount <= 0) + del(MED) + for(var/mob/M in viewers(src, null)) + if ((M.client && !( M.blinded ))) + M.show_message("\blue [user] applies the [MED] on [src]") + else + user << "\blue this [src] is dead, medical items won't bring it back to life." + else + if(O.force) + health -= O.force + for(var/mob/M in viewers(src, null)) + if ((M.client && !( M.blinded ))) + M.show_message("\red \b [src] has been attacked with the [O] by [user]. ") + else + usr << "\red This weapon is ineffective, it does no damage." + for(var/mob/M in viewers(src, null)) + if ((M.client && !( M.blinded ))) M.show_message("\red [user] gently taps [src] with the [O]. ") \ No newline at end of file diff --git a/code/modules/recycling/conveyor.dm b/code/unused/conveyor.dm similarity index 96% rename from code/modules/recycling/conveyor.dm rename to code/unused/conveyor.dm index 90600ce7750..274c05de55a 100644 --- a/code/modules/recycling/conveyor.dm +++ b/code/unused/conveyor.dm @@ -1,418 +1,418 @@ -// converyor belt - -// moves items/mobs/movables in set direction every ptick - - -/obj/machinery/conveyor - icon = 'recycling.dmi' - icon_state = "conveyor0" - name = "conveyor belt" - desc = "A conveyor belt." - anchored = 1 - var/operating = 0 // 1 if running forward, -1 if backwards, 0 if off - var/operable = 1 // true if can operate (no broken segments in this belt run) - var/basedir // this is the default (forward) direction, set by the map dir - // note dir var can vary when the direction changes - - var/list/affecting // the list of all items that will be moved this ptick - var/id = "" // the control ID - must match controller ID - // following two only used if a diverter is present - var/divert = 0 // if non-zero, direction to divert items - var/divdir = 0 // if diverting, will be conveyer dir needed to divert (otherwise dense) - - - - // create a conveyor - -/obj/machinery/conveyor/New() - ..() - basedir = dir - setdir() - - // set the dir and target turf depending on the operating direction - -/obj/machinery/conveyor/proc/setdir() - if(operating == -1) - dir = turn(basedir,180) - else - dir = basedir - update() - - - // update the icon depending on the operating condition - -/obj/machinery/conveyor/proc/update() - if(stat & BROKEN) - icon_state = "conveyor-b" - operating = 0 - return - if(!operable) - operating = 0 - icon_state = "conveyor[(operating != 0) && !(stat & NOPOWER)]" - - - // machine process - // move items to the target location -/obj/machinery/conveyor/process() - if(stat & (BROKEN | NOPOWER)) - return - if(!operating) - return - use_power(100) - - var/movedir = dir // base movement dir - if(divert && dir==divdir) // update if diverter present - movedir = divert - - - affecting = loc.contents - src // moved items will be all in loc - spawn(1) // slight delay to prevent infinite propagation due to map order - var/items_moved = 0 - for(var/atom/movable/A in affecting) - if(!A.anchored) - if(isturf(A.loc)) // this is to prevent an ugly bug that forces a player to drop what they're holding if they recently pick it up from the conveyer belt - if(ismob(A)) - var/mob/M = A - if(M.buckled == src) - var/obj/machinery/conveyor/C = locate() in get_step(src, dir) - M.buckled = null - step(M,dir) - if(C) - M.buckled = C - else - new/obj/item/weapon/cable_coil/cut(M.loc) - else - step(M,movedir) - else - step(A,movedir) - items_moved++ - if(items_moved >= 10) - break - -// attack with item, place item on conveyor - -/obj/machinery/conveyor/attackby(var/obj/item/I, mob/user) - if(istype(I, /obj/item/weapon/grab)) // special handling if grabbing a mob - var/obj/item/weapon/grab/G = I - G.affecting.Move(src.loc) - del(G) - return - else if(istype(I, /obj/item/weapon/cable_coil)) // if cable, see if a mob is present - var/mob/M = locate() in src.loc - if(M) - if (M == user) - src.visible_message("\blue [M] ties \himself to the conveyor.") - // note don't check for lying if self-tying - else - if(M.lying) - user.visible_message("\blue [M] has been tied to the conveyor by [user].", "\blue You tie [M] to the converyor!") - else - user << "\blue [M] must be lying down to be tied to the converyor!" - return - M.buckled = src - src.add_fingerprint(user) - I:use(1) - M.lying = 1 - return - - // else if no mob in loc, then allow coil to be placed - - else if(istype(I, /obj/item/weapon/wirecutters)) - var/mob/M = locate() in src.loc - if(M && M.buckled == src) - M.buckled = null - src.add_fingerprint(user) - if (M == user) - src.visible_message("\blue [M] cuts \himself free from the conveyor.") - else - src.visible_message("\blue [M] had been cut free from the conveyor by [user].") - return - - if(isrobot(user)) - return - - // otherwise drop and place on conveyor - user.drop_item() - if(I && I.loc) I.loc = src.loc - return - -// attack with hand, move pulled object onto conveyor - -/obj/machinery/conveyor/attack_hand(mob/user as mob) - if ((!( user.canmove ) || user.restrained() || !( user.pulling ))) - return - if (user.pulling.anchored) - return - if ((user.pulling.loc != user.loc && get_dist(user, user.pulling) > 1)) - return - if (ismob(user.pulling)) - var/mob/M = user.pulling - M.pulling = null - step(user.pulling, get_dir(user.pulling.loc, src)) - user.pulling = null - else - step(user.pulling, get_dir(user.pulling.loc, src)) - user.pulling = null - return - - -// make the conveyor broken -// also propagate inoperability to any connected conveyor with the same ID -/obj/machinery/conveyor/proc/broken() - stat |= BROKEN - update() - - var/obj/machinery/conveyor/C = locate() in get_step(src, basedir) - if(C) - C.set_operable(basedir, id, 0) - - C = locate() in get_step(src, turn(basedir,180)) - if(C) - C.set_operable(turn(basedir,180), id, 0) - - -//set the operable var if ID matches, propagating in the given direction - -/obj/machinery/conveyor/proc/set_operable(stepdir, match_id, op) - - if(id != match_id) - return - operable = op - - update() - var/obj/machinery/conveyor/C = locate() in get_step(src, stepdir) - if(C) - C.set_operable(stepdir, id, op) - -/* -/obj/machinery/conveyor/verb/destroy() - set src in view() - src.broken() -*/ - -/obj/machinery/conveyor/power_change() - ..() - update() - - -// converyor diverter -// extendable arm that can be switched so items on the conveyer are diverted sideways -// situate in same turf as conveyor -// only works if belts is running proper direction -// -// -/obj/machinery/diverter - icon = 'recycling.dmi' - icon_state = "diverter0" - name = "diverter" - desc = "A diverter arm for a conveyor belt." - anchored = 1 - layer = FLY_LAYER - var/obj/machinery/conveyor/conv // the conveyor this diverter works on - var/deployed = 0 // true if diverter arm is extended - var/operating = 0 // true if arm is extending/contracting - var/divert_to // the dir that diverted items will be moved - var/divert_from // the dir items must be moving to divert - - -// create a diverter -// set up divert_to and divert_from directions depending on dir state -/obj/machinery/diverter/New() - - ..() - - switch(dir) - if(NORTH) - divert_to = WEST // stuff will be moved to the west - divert_from = NORTH // if entering from the north - if(SOUTH) - divert_to = EAST - divert_from = NORTH - if(EAST) - divert_to = EAST - divert_from = SOUTH - if(WEST) - divert_to = WEST - divert_from = SOUTH - if(NORTHEAST) - divert_to = NORTH - divert_from = EAST - if(NORTHWEST) - divert_to = NORTH - divert_from = WEST - if(SOUTHEAST) - divert_to = SOUTH - divert_from = EAST - if(SOUTHWEST) - divert_to = SOUTH - divert_from = WEST - spawn(2) - // wait for map load then find the conveyor in this turf - conv = locate() in src.loc - if(conv) // divert_from dir must match possible conveyor movement - if(conv.basedir != divert_from && conv.basedir != turn(divert_from,180) ) - del(src) // if no dir match, then delete self - set_divert() - update() - -// update the icon state depending on whether the diverter is extended -/obj/machinery/diverter/proc/update() - icon_state = "diverter[deployed]" - -// call to set the diversion vars of underlying conveyor -/obj/machinery/diverter/proc/set_divert() - if(conv) - if(deployed) - conv.divert = divert_to - conv.divdir = divert_from - else - conv.divert= 0 - - -// *** TESTING click to toggle -/obj/machinery/diverter/Click() - toggle() - - -// toggle between arm deployed and not deployed, showing animation -// -/obj/machinery/diverter/proc/toggle() - if( stat & (NOPOWER|BROKEN)) - return - - if(operating) - return - - use_power(50) - operating = 1 - if(deployed) - flick("diverter10",src) - icon_state = "diverter0" - sleep(10) - deployed = 0 - else - flick("diverter01",src) - icon_state = "diverter1" - sleep(10) - deployed = 1 - operating = 0 - update() - set_divert() - -// don't allow movement into the 'backwards' direction if deployed -/obj/machinery/diverter/CanPass(atom/movable/O, var/turf/target) - var/direct = get_dir(O, target) - if(direct == divert_to) // prevent movement through body of diverter - return 0 - if(!deployed) - return 1 - return(direct != turn(divert_from,180)) - -// don't allow movement through the arm if deployed -/obj/machinery/diverter/CheckExit(atom/movable/O, var/turf/target) - var/direct = get_dir(O, target) - if(direct == turn(divert_to,180)) // prevent movement through body of diverter - return 0 - if(!deployed) - return 1 - return(direct != divert_from) - - - - - -// the conveyor control switch -// -// - -/obj/machinery/conveyor_switch - - name = "conveyor switch" - desc = "A conveyor control switch." - icon = 'recycling.dmi' - icon_state = "switch-off" - var/position = 0 // 0 off, -1 reverse, 1 forward - var/last_pos = -1 // last direction setting - var/operated = 1 // true if just operated - - var/id = "" // must match conveyor IDs to control them - - var/list/conveyors // the list of converyors that are controlled by this switch - anchored = 1 - - - -/obj/machinery/conveyor_switch/New() - ..() - update() - - spawn(5) // allow map load - conveyors = list() - for(var/obj/machinery/conveyor/C in world) - if(C.id == id) - conveyors += C - -// update the icon depending on the position - -/obj/machinery/conveyor_switch/proc/update() - if(position<0) - icon_state = "switch-rev" - else if(position>0) - icon_state = "switch-fwd" - else - icon_state = "switch-off" - - -// timed process -// if the switch changed, update the linked conveyors - -/obj/machinery/conveyor_switch/process() - if(!operated) - return - operated = 0 - - for(var/obj/machinery/conveyor/C in conveyors) - C.operating = position - C.setdir() - -// attack with hand, switch position -/obj/machinery/conveyor_switch/attack_hand(mob/user) - if(position == 0) - if(last_pos < 0) - position = 1 - last_pos = 0 - else - position = -1 - last_pos = 0 - else - last_pos = position - position = 0 - - operated = 1 - update() - - // find any switches with same id as this one, and set their positions to match us - for(var/obj/machinery/conveyor_switch/S in world) - if(S.id == src.id) - S.position = position - S.update() - - -/obj/machinery/conveyor/turntable - icon = 'recycling.dmi' - icon_state = "conveyor0" - name = "conveyor turntable" - desc = "A conveyor belt turntable." - /* - anchored = 1 - var/operating = 0 // 1 if running forward, -1 if backwards, 0 if off - var/operable = 1 // true if can operate (no broken segments in this belt run) - var/basedir // this is the default (forward) direction, set by the map dir - // note dir var can vary when the direction changes - - var/list/affecting // the list of all items that will be moved this ptick - var/id = "" // the control ID - must match controller ID - // following two only used if a diverter is present - var/divert = 0 // if non-zero, direction to divert items - var/divdir = 0 // if diverting, will be conveyer dir needed to divert (otherwise dense) - */ +// converyor belt + +// moves items/mobs/movables in set direction every ptick + + +/obj/machinery/conveyor + icon = 'recycling.dmi' + icon_state = "conveyor0" + name = "conveyor belt" + desc = "A conveyor belt." + anchored = 1 + var/operating = 0 // 1 if running forward, -1 if backwards, 0 if off + var/operable = 1 // true if can operate (no broken segments in this belt run) + var/basedir // this is the default (forward) direction, set by the map dir + // note dir var can vary when the direction changes + + var/list/affecting // the list of all items that will be moved this ptick + var/id = "" // the control ID - must match controller ID + // following two only used if a diverter is present + var/divert = 0 // if non-zero, direction to divert items + var/divdir = 0 // if diverting, will be conveyer dir needed to divert (otherwise dense) + + + + // create a conveyor + +/obj/machinery/conveyor/New() + ..() + basedir = dir + setdir() + + // set the dir and target turf depending on the operating direction + +/obj/machinery/conveyor/proc/setdir() + if(operating == -1) + dir = turn(basedir,180) + else + dir = basedir + update() + + + // update the icon depending on the operating condition + +/obj/machinery/conveyor/proc/update() + if(stat & BROKEN) + icon_state = "conveyor-b" + operating = 0 + return + if(!operable) + operating = 0 + icon_state = "conveyor[(operating != 0) && !(stat & NOPOWER)]" + + + // machine process + // move items to the target location +/obj/machinery/conveyor/process() + if(stat & (BROKEN | NOPOWER)) + return + if(!operating) + return + use_power(100) + + var/movedir = dir // base movement dir + if(divert && dir==divdir) // update if diverter present + movedir = divert + + + affecting = loc.contents - src // moved items will be all in loc + spawn(1) // slight delay to prevent infinite propagation due to map order + var/items_moved = 0 + for(var/atom/movable/A in affecting) + if(!A.anchored) + if(isturf(A.loc)) // this is to prevent an ugly bug that forces a player to drop what they're holding if they recently pick it up from the conveyer belt + if(ismob(A)) + var/mob/M = A + if(M.buckled == src) + var/obj/machinery/conveyor/C = locate() in get_step(src, dir) + M.buckled = null + step(M,dir) + if(C) + M.buckled = C + else + new/obj/item/weapon/cable_coil/cut(M.loc) + else + step(M,movedir) + else + step(A,movedir) + items_moved++ + if(items_moved >= 10) + break + +// attack with item, place item on conveyor + +/obj/machinery/conveyor/attackby(var/obj/item/I, mob/user) + if(istype(I, /obj/item/weapon/grab)) // special handling if grabbing a mob + var/obj/item/weapon/grab/G = I + G.affecting.Move(src.loc) + del(G) + return + else if(istype(I, /obj/item/weapon/cable_coil)) // if cable, see if a mob is present + var/mob/M = locate() in src.loc + if(M) + if (M == user) + src.visible_message("\blue [M] ties \himself to the conveyor.") + // note don't check for lying if self-tying + else + if(M.lying) + user.visible_message("\blue [M] has been tied to the conveyor by [user].", "\blue You tie [M] to the converyor!") + else + user << "\blue [M] must be lying down to be tied to the converyor!" + return + M.buckled = src + src.add_fingerprint(user) + I:use(1) + M.lying = 1 + return + + // else if no mob in loc, then allow coil to be placed + + else if(istype(I, /obj/item/weapon/wirecutters)) + var/mob/M = locate() in src.loc + if(M && M.buckled == src) + M.buckled = null + src.add_fingerprint(user) + if (M == user) + src.visible_message("\blue [M] cuts \himself free from the conveyor.") + else + src.visible_message("\blue [M] had been cut free from the conveyor by [user].") + return + + if(isrobot(user)) + return + + // otherwise drop and place on conveyor + user.drop_item() + if(I && I.loc) I.loc = src.loc + return + +// attack with hand, move pulled object onto conveyor + +/obj/machinery/conveyor/attack_hand(mob/user as mob) + if ((!( user.canmove ) || user.restrained() || !( user.pulling ))) + return + if (user.pulling.anchored) + return + if ((user.pulling.loc != user.loc && get_dist(user, user.pulling) > 1)) + return + if (ismob(user.pulling)) + var/mob/M = user.pulling + M.pulling = null + step(user.pulling, get_dir(user.pulling.loc, src)) + user.pulling = null + else + step(user.pulling, get_dir(user.pulling.loc, src)) + user.pulling = null + return + + +// make the conveyor broken +// also propagate inoperability to any connected conveyor with the same ID +/obj/machinery/conveyor/proc/broken() + stat |= BROKEN + update() + + var/obj/machinery/conveyor/C = locate() in get_step(src, basedir) + if(C) + C.set_operable(basedir, id, 0) + + C = locate() in get_step(src, turn(basedir,180)) + if(C) + C.set_operable(turn(basedir,180), id, 0) + + +//set the operable var if ID matches, propagating in the given direction + +/obj/machinery/conveyor/proc/set_operable(stepdir, match_id, op) + + if(id != match_id) + return + operable = op + + update() + var/obj/machinery/conveyor/C = locate() in get_step(src, stepdir) + if(C) + C.set_operable(stepdir, id, op) + +/* +/obj/machinery/conveyor/verb/destroy() + set src in view() + src.broken() +*/ + +/obj/machinery/conveyor/power_change() + ..() + update() + + +// converyor diverter +// extendable arm that can be switched so items on the conveyer are diverted sideways +// situate in same turf as conveyor +// only works if belts is running proper direction +// +// +/obj/machinery/diverter + icon = 'recycling.dmi' + icon_state = "diverter0" + name = "diverter" + desc = "A diverter arm for a conveyor belt." + anchored = 1 + layer = FLY_LAYER + var/obj/machinery/conveyor/conv // the conveyor this diverter works on + var/deployed = 0 // true if diverter arm is extended + var/operating = 0 // true if arm is extending/contracting + var/divert_to // the dir that diverted items will be moved + var/divert_from // the dir items must be moving to divert + + +// create a diverter +// set up divert_to and divert_from directions depending on dir state +/obj/machinery/diverter/New() + + ..() + + switch(dir) + if(NORTH) + divert_to = WEST // stuff will be moved to the west + divert_from = NORTH // if entering from the north + if(SOUTH) + divert_to = EAST + divert_from = NORTH + if(EAST) + divert_to = EAST + divert_from = SOUTH + if(WEST) + divert_to = WEST + divert_from = SOUTH + if(NORTHEAST) + divert_to = NORTH + divert_from = EAST + if(NORTHWEST) + divert_to = NORTH + divert_from = WEST + if(SOUTHEAST) + divert_to = SOUTH + divert_from = EAST + if(SOUTHWEST) + divert_to = SOUTH + divert_from = WEST + spawn(2) + // wait for map load then find the conveyor in this turf + conv = locate() in src.loc + if(conv) // divert_from dir must match possible conveyor movement + if(conv.basedir != divert_from && conv.basedir != turn(divert_from,180) ) + del(src) // if no dir match, then delete self + set_divert() + update() + +// update the icon state depending on whether the diverter is extended +/obj/machinery/diverter/proc/update() + icon_state = "diverter[deployed]" + +// call to set the diversion vars of underlying conveyor +/obj/machinery/diverter/proc/set_divert() + if(conv) + if(deployed) + conv.divert = divert_to + conv.divdir = divert_from + else + conv.divert= 0 + + +// *** TESTING click to toggle +/obj/machinery/diverter/Click() + toggle() + + +// toggle between arm deployed and not deployed, showing animation +// +/obj/machinery/diverter/proc/toggle() + if( stat & (NOPOWER|BROKEN)) + return + + if(operating) + return + + use_power(50) + operating = 1 + if(deployed) + flick("diverter10",src) + icon_state = "diverter0" + sleep(10) + deployed = 0 + else + flick("diverter01",src) + icon_state = "diverter1" + sleep(10) + deployed = 1 + operating = 0 + update() + set_divert() + +// don't allow movement into the 'backwards' direction if deployed +/obj/machinery/diverter/CanPass(atom/movable/O, var/turf/target) + var/direct = get_dir(O, target) + if(direct == divert_to) // prevent movement through body of diverter + return 0 + if(!deployed) + return 1 + return(direct != turn(divert_from,180)) + +// don't allow movement through the arm if deployed +/obj/machinery/diverter/CheckExit(atom/movable/O, var/turf/target) + var/direct = get_dir(O, target) + if(direct == turn(divert_to,180)) // prevent movement through body of diverter + return 0 + if(!deployed) + return 1 + return(direct != divert_from) + + + + + +// the conveyor control switch +// +// + +/obj/machinery/conveyor_switch + + name = "conveyor switch" + desc = "A conveyor control switch." + icon = 'recycling.dmi' + icon_state = "switch-off" + var/position = 0 // 0 off, -1 reverse, 1 forward + var/last_pos = -1 // last direction setting + var/operated = 1 // true if just operated + + var/id = "" // must match conveyor IDs to control them + + var/list/conveyors // the list of converyors that are controlled by this switch + anchored = 1 + + + +/obj/machinery/conveyor_switch/New() + ..() + update() + + spawn(5) // allow map load + conveyors = list() + for(var/obj/machinery/conveyor/C in world) + if(C.id == id) + conveyors += C + +// update the icon depending on the position + +/obj/machinery/conveyor_switch/proc/update() + if(position<0) + icon_state = "switch-rev" + else if(position>0) + icon_state = "switch-fwd" + else + icon_state = "switch-off" + + +// timed process +// if the switch changed, update the linked conveyors + +/obj/machinery/conveyor_switch/process() + if(!operated) + return + operated = 0 + + for(var/obj/machinery/conveyor/C in conveyors) + C.operating = position + C.setdir() + +// attack with hand, switch position +/obj/machinery/conveyor_switch/attack_hand(mob/user) + if(position == 0) + if(last_pos < 0) + position = 1 + last_pos = 0 + else + position = -1 + last_pos = 0 + else + last_pos = position + position = 0 + + operated = 1 + update() + + // find any switches with same id as this one, and set their positions to match us + for(var/obj/machinery/conveyor_switch/S in world) + if(S.id == src.id) + S.position = position + S.update() + + +/obj/machinery/conveyor/turntable + icon = 'recycling.dmi' + icon_state = "conveyor0" + name = "conveyor turntable" + desc = "A conveyor belt turntable." + /* + anchored = 1 + var/operating = 0 // 1 if running forward, -1 if backwards, 0 if off + var/operable = 1 // true if can operate (no broken segments in this belt run) + var/basedir // this is the default (forward) direction, set by the map dir + // note dir var can vary when the direction changes + + var/list/affecting // the list of all items that will be moved this ptick + var/id = "" // the control ID - must match controller ID + // following two only used if a diverter is present + var/divert = 0 // if non-zero, direction to divert items + var/divdir = 0 // if diverting, will be conveyer dir needed to divert (otherwise dense) + */ diff --git a/code/WorkInProgress/jobs.dm b/code/unused/jobs.dm similarity index 97% rename from code/WorkInProgress/jobs.dm rename to code/unused/jobs.dm index 157982a274f..dc9fc0babbb 100644 --- a/code/WorkInProgress/jobs.dm +++ b/code/unused/jobs.dm @@ -1,291 +1,291 @@ -//WORK IN PROGRESS CONTENT - -//Project coder: Errorage - -//Readme: As part of the UI upgrade project, the intention here is for each job to have -//somewhat customizable loadouts. Players will be able to pick between jumpsuits, shoes, -//and other items. This datum will be used for all jobs and code will reference it. -//adding new jobs will be a matter of adding this datum.to a list of jobs. - -#define VITAL_PRIORITY_JOB 5 -#define HIGH_PRIORITY_JOB 4 -#define PRIORITY_JOB 3 -#define LOW_PRIORITY_JOB 2 -#define ASSISTANT_PRIORITY_JOB 1 -#define NO_PRIORITY_JOB 0 - -/datum/job - //Basic information - var/title = "Untitled" //The main (default) job title/name - var/list/alternative_titles = list() //Alternative job titles/names (alias) - var/job_number_at_round_start = 0 //Number of jobs that can be assigned at round start - var/job_number_total = 0 //Number of jobs that can be assigned total - var/list/bosses = list() //List of jobs which have authority over this job by default. - var/admin_only = 0 //If this is set to 1, the job is not available on the spawn screen - var/description = "" //A description of the job to be displayed when requested on the spawn screen - var/guides = "" //A string with links to relevent guides (likely the wiki) - var/department = "" //This is used to group jobs into departments, which means that if you don't get your desired jobs, you get another job from the same department - var/job_type = "SS13" //SS13, NT or ANTAGONIST - var/can_be_traitor = 1 - var/can_be_changeling = 1 - var/can_be_wizard = 1 - var/can_be_cultist = 1 - var/can_be_rev_head = 1 - var/is_head_position = 0 - - //Job conditions - var/change_to_mob = "Human" //The type of mob which this job will change you to (alien,cyborg,human...) - var/change_to_mutantrace = "" //What mutantrace you will be once you get this job - - //Random job assignment priority - var/assignment_priority = NO_PRIORITY_JOB //This variable determins the priority of assignment - //VITAL_PRIORITY_JOB = Absolutely vital (Someone will get assigned every round) - Use VERY, VERY lightly - //HIGH_PRIORITY_JOB = High priority - Assibned before the other jobs, candidates compete on equal terms - //PRIORITY_JOB = Priorized (Standard priority) - Candidates compete by virtue of priority (choice 1 > choice 2 > choice 3...) - //LOW_PRIORITY_JOB = Low priority (Low-priority (librarian)) - //ASSISTANT_PRIORITY_JOB = Assistant-level (Only filled when all the other jobs have been assigned) - //NO_PRIORITY_JOB = Skipped om assignment (Admin-only jobs should have this level) - - - - //Available equipment - The first thing listed is understood as the default setup. - var/list/equipment_ears = list() //list of possible ear-wear items - var/list/equipment_glasses = list() //list of possible glasses - var/list/equipment_gloves = list() //list of possible gloves - var/list/equipment_head = list() //list of possible headgear/helmets/hats - var/list/equipment_mask = list() //list of possible masks - var/list/equipment_shoes = list() //list of possible shoes - var/list/equipment_suit = list() //list of possible suits - var/list/equipment_under = list() //list of possible jumpsuits - var/list/equipment_belt = list() //list of possible belt-slot items - var/list/equipment_back = list() //list of possible back-slot items - var/obj/equipment_pda //default pda type - var/obj/equipment_id //default id type - - New(var/param_title, var/list/param_alternative_titles = list(), var/param_jobs_at_round_start = 0, var/param_global_max = 0, var/list/param_bosses = list(), var/param_admin_only = 0) - title = param_title - alternative_titles = param_alternative_titles - job_number_at_round_start = param_jobs_at_round_start - job_number_total = param_global_max - bosses = param_bosses - admin_only = param_admin_only - - //This proc tests to see if the given alias (job title/alternative job title) corresponds to this job. - //Returns 1 if it is, else returns 0 - proc/is_job_alias(var/alias) - if(alias == title) - return 1 - if(alias in alternative_titles) - return 1 - return 0 - -/datum/jobs - var/list/datum/job/all_jobs = list() - - proc/get_all_jobs() - return all_jobs - - //This proc returns all the jobs which are NOT admin only - proc/get_normal_jobs() - var/list/datum/job/normal_jobs = list() - for(var/datum/job/J in all_jobs) - if(!J.admin_only) - normal_jobs += J - return normal_jobs - - //This proc returns all the jobs which are admin only - proc/get_admin_jobs() - var/list/datum/job/admin_jobs = list() - for(var/datum/job/J in all_jobs) - if(J.admin_only) - admin_jobs += J - return admin_jobs - - //This proc returns the job datum of the job with the alias or job title given as the argument. Returns an empty string otherwise. - proc/get_job(var/alias) - for(var/datum/job/J in all_jobs) - if(J.is_job_alias(alias)) - return J - return "" - - //This proc returns a string with the default job title for the job with the given alias. Returns an empty string otherwise. - proc/get_job_title(var/alias) - for(var/datum/job/J in all_jobs) - if(J.is_job_alias(alias)) - return J.title - return "" - - //This proc returns all the job datums of the workers whose boss has the alias provided. (IE Engineer under Chief Engineer, etc.) - proc/get_jobs_under(var/boss_alias) - var/boss_title = get_job_title(boss_alias) - var/list/datum/job/employees = list() - for(var/datum/job/J in all_jobs) - if(boss_title in J.bosses) - employees += J - return employees - - //This proc returns the chosen vital and high priority jobs that the person selected. It goes from top to bottom of the list, until it finds a job which does not have such priority. - //Example: Choosing (in this order): CE, Captain, Engineer, RD will only return CE and Captain, as RD is assumed as being an unwanted choice. - //This proc is used in the allocation algorithm when deciding vital and high priority jobs. - proc/get_prefered_high_priority_jobs() - var/list/datum/job/hp_jobs = list() - for(var/datum/job/J in all_jobs) - if(J.assignment_priority == HIGH_PRIORITY_JOB || J.assignment_priority == VITAL_PRIORITY_JOB) - hp_jobs += J - else - break - return hp_jobs - - //If only priority is given, it will return the jobs of only that priority, if end_priority is set it will return the jobs with their priority higher or equal to var/priority and lower or equal to end_priority. end_priority must be higher than 0. - proc/get_jobs_by_priority(var/priority, var/end_priority = 0) - var/list/datum/job/priority_jobs = list() - if(end_priority) - if(end_priority < priority) - return - for(var/datum/job/J in all_jobs) - if(J.assignment_priority >= priority && J.assignment_priority <= end_priority) - priority_jobs += J - else - for(var/datum/job/J in all_jobs) - if(J.assignment_priority == priority) - priority_jobs += J - return priority_jobs - -//This datum is used in the plb allocation algorithm to make life easier, not used anywhere else. -/datum/player_jobs - var/mob/new_player/player - var/datum/jobs/selected_jobs - -var/datum/jobs/jobs = new/datum/jobs() - -proc/setup_jobs() - var/datum/job/JOB - - JOB = new/datum/job("Station Engineer") - JOB.alternative_titles = list("Structural Engineer","Engineer","Student of Engineering") - JOB.job_number_at_round_start = 5 - JOB.job_number_total = 5 - JOB.bosses = list("Chief Engineer") - JOB.admin_only = 0 - JOB.description = "Engineers are tasked with the maintenance of the station. Be it maintaining the power grid or rebuilding damaged sections." - JOB.guides = "" - JOB.equipment_ears = list(/obj/item/device/radio/headset/headset_eng) - JOB.equipment_glasses = list() - JOB.equipment_gloves = list() - JOB.equipment_head = list(/obj/item/clothing/head/helmet/hardhat) - JOB.equipment_mask = list() - JOB.equipment_shoes = list(/obj/item/clothing/shoes/orange,/obj/item/clothing/shoes/brown,/obj/item/clothing/shoes/black) - JOB.equipment_suit = list(/obj/item/clothing/suit/hazardvest) - JOB.equipment_under = list(/obj/item/clothing/under/rank/engineer,/obj/item/clothing/under/color/yellow) - JOB.equipment_belt = list(/obj/item/weapon/storage/belt/utility/full) - JOB.equipment_back = list(/obj/item/weapon/storage/backpack/industrial,/obj/item/weapon/storage/backpack) - JOB.equipment_pda = /obj/item/device/pda/engineering - JOB.equipment_id = /obj/item/weapon/card/id - - jobs.all_jobs += JOB - -//This proc will dress the mob (employee) in the default way for the specified job title/job alias -proc/dress_for_job_default(var/mob/living/carbon/human/employee as mob, var/job_alias) - if(!ishuman(employee)) - return - - //TODO ERRORAGE - UNFINISHED - var/datum/job/JOB = jobs.get_job(job_alias) - if(JOB) - var/item = JOB.equipment_ears[1] - employee.equip_if_possible(new item(employee), employee.slot_ears) - item = JOB.equipment_under[1] - employee.equip_if_possible(new item(employee), employee.slot_w_uniform) - - - /* - src.equip_if_possible(new /obj/item/weapon/storage/backpack/industrial (src), slot_back) - src.equip_if_possible(new /obj/item/weapon/storage/box/engineer(src), slot_in_backpack) - src.equip_if_possible(new /obj/item/device/radio/headset/headset_eng (src), slot_ears) // -- TLE - src.equip_if_possible(new /obj/item/device/pda/engineering(src), slot_belt) - src.equip_if_possible(new /obj/item/clothing/under/rank/engineer(src), slot_w_uniform) - src.equip_if_possible(new /obj/item/clothing/shoes/orange(src), slot_shoes) - src.equip_if_possible(new /obj/item/clothing/head/helmet/hardhat(src), slot_head) - src.equip_if_possible(new /obj/item/weapon/storage/utilitybelt/full(src), slot_l_hand) //currently spawns in hand due to traitor assignment requiring a PDA to be on the belt. --Errorage - //src.equip_if_possible(new /obj/item/clothing/gloves/yellow(src), slot_gloves) removed as part of Dangercon 2011, approved by Urist_McDorf --Errorage - src.equip_if_possible(new /obj/item/device/t_scanner(src), slot_r_store) - */ - - -//This algorithm works in 5 steps: -//1: Assignment of wizard / nuke members (if appropriate game mode) -//2: Assignment of jobs based on preferenes -// 2.1: Assignment of vital and high priority jobs. Candidates compete on equal terms. If the vital jobs are not filled, a random candidate is chosen to fill them, -// 2.2: Assignment of the rest of the jobs based on player preference, -//3: Assignment of remaining jobs for remaining players based on chosen departments -//4: Random assignment of remaining jobs for remaining players based on assignment priority -//5: Assignment of traitor / changeling to assigned roles (if appropriate game mode) -proc/assignment_algorithm(var/list/mob/new_player/players) - for(var/mob/new_player/PLAYER in players) - if(!PLAYER.client) - players -= PLAYER - continue - if(!PLAYER.ready) - players -= PLAYER - continue - - var/list/datum/job/vital_jobs = list() - var/list/datum/job/high_priority_jobs = list() - var/list/datum/job/priority_jobs = list() - var/list/datum/job/low_priority_jobs = list() - var/list/datum/job/assistant_jobs = list() - var/list/datum/job/not_assigned_jobs = list() - - for(var/datum/job/J in jobs) - switch(J.assignment_priority) - if(5) - vital_jobs += J - if(4) - high_priority_jobs += J - if(3) - priority_jobs += J - if(2) - low_priority_jobs += J - if(1) - assistant_jobs += J - if(0) - not_assigned_jobs += J - - var/list/datum/player_jobs/player_jobs = list() //This datum only holds a mob/new_player and a datum/jobs. The first is the player, the 2nd is the player's selected jobs, from the preferences datum. - - for(var/mob/new_player/NP in players) - var/datum/player_jobs/PJ = new/datum/player_jobs - PJ.player = NP - PJ.selected_jobs = NP.preferences.wanted_jobs - player_jobs += PJ - - //At this point we have the player_jobs list filled. Next up we have to assign all vital and high priority positions. - - var/list/datum/job/hp_jobs = jobs.get_jobs_by_priority( HIGH_PRIORITY_JOB, VITAL_PRIORITY_JOB ) - - for(var/datum/job/J in hp_jobs) - var/list/mob/new_player/candidates = list() - for(var/datum/player_jobs/PJ in player_jobs) - if(J in PJ.selected_jobs) - candidates += PJ.player - var/mob/new_player/chosen_player - if(candidates) - chosen_player = pick(candidates) - else - if(J.assignment_priority == VITAL_PRIORITY_JOB) - if(players) //Just in case there are more vital jobs than there are players. - chosen_player = pick(players) - if(chosen_player) - chosen_player.mind.assigned_job = J - players -= chosen_player - //TODO ERRORAGE - add capability for hp jobs with more than one slots. - - - - - //1: vital and high priority jobs, assigned on equal terms - - //TODO ERRORAGE - UNFINISHED - - -//END OF WORK IN PROGRESS CONTENT +//WORK IN PROGRESS CONTENT + +//Project coder: Errorage + +//Readme: As part of the UI upgrade project, the intention here is for each job to have +//somewhat customizable loadouts. Players will be able to pick between jumpsuits, shoes, +//and other items. This datum will be used for all jobs and code will reference it. +//adding new jobs will be a matter of adding this datum.to a list of jobs. + +#define VITAL_PRIORITY_JOB 5 +#define HIGH_PRIORITY_JOB 4 +#define PRIORITY_JOB 3 +#define LOW_PRIORITY_JOB 2 +#define ASSISTANT_PRIORITY_JOB 1 +#define NO_PRIORITY_JOB 0 + +/datum/job + //Basic information + var/title = "Untitled" //The main (default) job title/name + var/list/alternative_titles = list() //Alternative job titles/names (alias) + var/job_number_at_round_start = 0 //Number of jobs that can be assigned at round start + var/job_number_total = 0 //Number of jobs that can be assigned total + var/list/bosses = list() //List of jobs which have authority over this job by default. + var/admin_only = 0 //If this is set to 1, the job is not available on the spawn screen + var/description = "" //A description of the job to be displayed when requested on the spawn screen + var/guides = "" //A string with links to relevent guides (likely the wiki) + var/department = "" //This is used to group jobs into departments, which means that if you don't get your desired jobs, you get another job from the same department + var/job_type = "SS13" //SS13, NT or ANTAGONIST + var/can_be_traitor = 1 + var/can_be_changeling = 1 + var/can_be_wizard = 1 + var/can_be_cultist = 1 + var/can_be_rev_head = 1 + var/is_head_position = 0 + + //Job conditions + var/change_to_mob = "Human" //The type of mob which this job will change you to (alien,cyborg,human...) + var/change_to_mutantrace = "" //What mutantrace you will be once you get this job + + //Random job assignment priority + var/assignment_priority = NO_PRIORITY_JOB //This variable determins the priority of assignment + //VITAL_PRIORITY_JOB = Absolutely vital (Someone will get assigned every round) - Use VERY, VERY lightly + //HIGH_PRIORITY_JOB = High priority - Assibned before the other jobs, candidates compete on equal terms + //PRIORITY_JOB = Priorized (Standard priority) - Candidates compete by virtue of priority (choice 1 > choice 2 > choice 3...) + //LOW_PRIORITY_JOB = Low priority (Low-priority (librarian)) + //ASSISTANT_PRIORITY_JOB = Assistant-level (Only filled when all the other jobs have been assigned) + //NO_PRIORITY_JOB = Skipped om assignment (Admin-only jobs should have this level) + + + + //Available equipment - The first thing listed is understood as the default setup. + var/list/equipment_ears = list() //list of possible ear-wear items + var/list/equipment_glasses = list() //list of possible glasses + var/list/equipment_gloves = list() //list of possible gloves + var/list/equipment_head = list() //list of possible headgear/helmets/hats + var/list/equipment_mask = list() //list of possible masks + var/list/equipment_shoes = list() //list of possible shoes + var/list/equipment_suit = list() //list of possible suits + var/list/equipment_under = list() //list of possible jumpsuits + var/list/equipment_belt = list() //list of possible belt-slot items + var/list/equipment_back = list() //list of possible back-slot items + var/obj/equipment_pda //default pda type + var/obj/equipment_id //default id type + + New(var/param_title, var/list/param_alternative_titles = list(), var/param_jobs_at_round_start = 0, var/param_global_max = 0, var/list/param_bosses = list(), var/param_admin_only = 0) + title = param_title + alternative_titles = param_alternative_titles + job_number_at_round_start = param_jobs_at_round_start + job_number_total = param_global_max + bosses = param_bosses + admin_only = param_admin_only + + //This proc tests to see if the given alias (job title/alternative job title) corresponds to this job. + //Returns 1 if it is, else returns 0 + proc/is_job_alias(var/alias) + if(alias == title) + return 1 + if(alias in alternative_titles) + return 1 + return 0 + +/datum/jobs + var/list/datum/job/all_jobs = list() + + proc/get_all_jobs() + return all_jobs + + //This proc returns all the jobs which are NOT admin only + proc/get_normal_jobs() + var/list/datum/job/normal_jobs = list() + for(var/datum/job/J in all_jobs) + if(!J.admin_only) + normal_jobs += J + return normal_jobs + + //This proc returns all the jobs which are admin only + proc/get_admin_jobs() + var/list/datum/job/admin_jobs = list() + for(var/datum/job/J in all_jobs) + if(J.admin_only) + admin_jobs += J + return admin_jobs + + //This proc returns the job datum of the job with the alias or job title given as the argument. Returns an empty string otherwise. + proc/get_job(var/alias) + for(var/datum/job/J in all_jobs) + if(J.is_job_alias(alias)) + return J + return "" + + //This proc returns a string with the default job title for the job with the given alias. Returns an empty string otherwise. + proc/get_job_title(var/alias) + for(var/datum/job/J in all_jobs) + if(J.is_job_alias(alias)) + return J.title + return "" + + //This proc returns all the job datums of the workers whose boss has the alias provided. (IE Engineer under Chief Engineer, etc.) + proc/get_jobs_under(var/boss_alias) + var/boss_title = get_job_title(boss_alias) + var/list/datum/job/employees = list() + for(var/datum/job/J in all_jobs) + if(boss_title in J.bosses) + employees += J + return employees + + //This proc returns the chosen vital and high priority jobs that the person selected. It goes from top to bottom of the list, until it finds a job which does not have such priority. + //Example: Choosing (in this order): CE, Captain, Engineer, RD will only return CE and Captain, as RD is assumed as being an unwanted choice. + //This proc is used in the allocation algorithm when deciding vital and high priority jobs. + proc/get_prefered_high_priority_jobs() + var/list/datum/job/hp_jobs = list() + for(var/datum/job/J in all_jobs) + if(J.assignment_priority == HIGH_PRIORITY_JOB || J.assignment_priority == VITAL_PRIORITY_JOB) + hp_jobs += J + else + break + return hp_jobs + + //If only priority is given, it will return the jobs of only that priority, if end_priority is set it will return the jobs with their priority higher or equal to var/priority and lower or equal to end_priority. end_priority must be higher than 0. + proc/get_jobs_by_priority(var/priority, var/end_priority = 0) + var/list/datum/job/priority_jobs = list() + if(end_priority) + if(end_priority < priority) + return + for(var/datum/job/J in all_jobs) + if(J.assignment_priority >= priority && J.assignment_priority <= end_priority) + priority_jobs += J + else + for(var/datum/job/J in all_jobs) + if(J.assignment_priority == priority) + priority_jobs += J + return priority_jobs + +//This datum is used in the plb allocation algorithm to make life easier, not used anywhere else. +/datum/player_jobs + var/mob/new_player/player + var/datum/jobs/selected_jobs + +var/datum/jobs/jobs = new/datum/jobs() + +proc/setup_jobs() + var/datum/job/JOB + + JOB = new/datum/job("Station Engineer") + JOB.alternative_titles = list("Structural Engineer","Engineer","Student of Engineering") + JOB.job_number_at_round_start = 5 + JOB.job_number_total = 5 + JOB.bosses = list("Chief Engineer") + JOB.admin_only = 0 + JOB.description = "Engineers are tasked with the maintenance of the station. Be it maintaining the power grid or rebuilding damaged sections." + JOB.guides = "" + JOB.equipment_ears = list(/obj/item/device/radio/headset/headset_eng) + JOB.equipment_glasses = list() + JOB.equipment_gloves = list() + JOB.equipment_head = list(/obj/item/clothing/head/helmet/hardhat) + JOB.equipment_mask = list() + JOB.equipment_shoes = list(/obj/item/clothing/shoes/orange,/obj/item/clothing/shoes/brown,/obj/item/clothing/shoes/black) + JOB.equipment_suit = list(/obj/item/clothing/suit/hazardvest) + JOB.equipment_under = list(/obj/item/clothing/under/rank/engineer,/obj/item/clothing/under/color/yellow) + JOB.equipment_belt = list(/obj/item/weapon/storage/belt/utility/full) + JOB.equipment_back = list(/obj/item/weapon/storage/backpack/industrial,/obj/item/weapon/storage/backpack) + JOB.equipment_pda = /obj/item/device/pda/engineering + JOB.equipment_id = /obj/item/weapon/card/id + + jobs.all_jobs += JOB + +//This proc will dress the mob (employee) in the default way for the specified job title/job alias +proc/dress_for_job_default(var/mob/living/carbon/human/employee as mob, var/job_alias) + if(!ishuman(employee)) + return + + //TODO ERRORAGE - UNFINISHED + var/datum/job/JOB = jobs.get_job(job_alias) + if(JOB) + var/item = JOB.equipment_ears[1] + employee.equip_if_possible(new item(employee), employee.slot_ears) + item = JOB.equipment_under[1] + employee.equip_if_possible(new item(employee), employee.slot_w_uniform) + + + /* + src.equip_if_possible(new /obj/item/weapon/storage/backpack/industrial (src), slot_back) + src.equip_if_possible(new /obj/item/weapon/storage/box/engineer(src), slot_in_backpack) + src.equip_if_possible(new /obj/item/device/radio/headset/headset_eng (src), slot_ears) // -- TLE + src.equip_if_possible(new /obj/item/device/pda/engineering(src), slot_belt) + src.equip_if_possible(new /obj/item/clothing/under/rank/engineer(src), slot_w_uniform) + src.equip_if_possible(new /obj/item/clothing/shoes/orange(src), slot_shoes) + src.equip_if_possible(new /obj/item/clothing/head/helmet/hardhat(src), slot_head) + src.equip_if_possible(new /obj/item/weapon/storage/utilitybelt/full(src), slot_l_hand) //currently spawns in hand due to traitor assignment requiring a PDA to be on the belt. --Errorage + //src.equip_if_possible(new /obj/item/clothing/gloves/yellow(src), slot_gloves) removed as part of Dangercon 2011, approved by Urist_McDorf --Errorage + src.equip_if_possible(new /obj/item/device/t_scanner(src), slot_r_store) + */ + + +//This algorithm works in 5 steps: +//1: Assignment of wizard / nuke members (if appropriate game mode) +//2: Assignment of jobs based on preferenes +// 2.1: Assignment of vital and high priority jobs. Candidates compete on equal terms. If the vital jobs are not filled, a random candidate is chosen to fill them, +// 2.2: Assignment of the rest of the jobs based on player preference, +//3: Assignment of remaining jobs for remaining players based on chosen departments +//4: Random assignment of remaining jobs for remaining players based on assignment priority +//5: Assignment of traitor / changeling to assigned roles (if appropriate game mode) +proc/assignment_algorithm(var/list/mob/new_player/players) + for(var/mob/new_player/PLAYER in players) + if(!PLAYER.client) + players -= PLAYER + continue + if(!PLAYER.ready) + players -= PLAYER + continue + + var/list/datum/job/vital_jobs = list() + var/list/datum/job/high_priority_jobs = list() + var/list/datum/job/priority_jobs = list() + var/list/datum/job/low_priority_jobs = list() + var/list/datum/job/assistant_jobs = list() + var/list/datum/job/not_assigned_jobs = list() + + for(var/datum/job/J in jobs) + switch(J.assignment_priority) + if(5) + vital_jobs += J + if(4) + high_priority_jobs += J + if(3) + priority_jobs += J + if(2) + low_priority_jobs += J + if(1) + assistant_jobs += J + if(0) + not_assigned_jobs += J + + var/list/datum/player_jobs/player_jobs = list() //This datum only holds a mob/new_player and a datum/jobs. The first is the player, the 2nd is the player's selected jobs, from the preferences datum. + + for(var/mob/new_player/NP in players) + var/datum/player_jobs/PJ = new/datum/player_jobs + PJ.player = NP + PJ.selected_jobs = NP.preferences.wanted_jobs + player_jobs += PJ + + //At this point we have the player_jobs list filled. Next up we have to assign all vital and high priority positions. + + var/list/datum/job/hp_jobs = jobs.get_jobs_by_priority( HIGH_PRIORITY_JOB, VITAL_PRIORITY_JOB ) + + for(var/datum/job/J in hp_jobs) + var/list/mob/new_player/candidates = list() + for(var/datum/player_jobs/PJ in player_jobs) + if(J in PJ.selected_jobs) + candidates += PJ.player + var/mob/new_player/chosen_player + if(candidates) + chosen_player = pick(candidates) + else + if(J.assignment_priority == VITAL_PRIORITY_JOB) + if(players) //Just in case there are more vital jobs than there are players. + chosen_player = pick(players) + if(chosen_player) + chosen_player.mind.assigned_job = J + players -= chosen_player + //TODO ERRORAGE - add capability for hp jobs with more than one slots. + + + + + //1: vital and high priority jobs, assigned on equal terms + + //TODO ERRORAGE - UNFINISHED + + +//END OF WORK IN PROGRESS CONTENT diff --git a/code/WorkInProgress/organs/implants.dm b/code/unused/organs/implants.dm similarity index 94% rename from code/WorkInProgress/organs/implants.dm rename to code/unused/organs/implants.dm index 98350ee7f9a..c8f83bc6a3a 100644 --- a/code/WorkInProgress/organs/implants.dm +++ b/code/unused/organs/implants.dm @@ -1,13 +1,13 @@ -/*------ -SPELL IMPLANTS - + Most diverse effects - - Limited charges, failure rate - -CYBERNETIC IMPLANTS - + Easiest to make - - Require power - -GRAFTS (includes basic human bodyparts) - + Permanent effects - - Horrible side effects +/*------ +SPELL IMPLANTS + + Most diverse effects + - Limited charges, failure rate + +CYBERNETIC IMPLANTS + + Easiest to make + - Require power + +GRAFTS (includes basic human bodyparts) + + Permanent effects + - Horrible side effects */ \ No newline at end of file diff --git a/code/WorkInProgress/organs/organs.dm b/code/unused/organs/organs.dm similarity index 94% rename from code/WorkInProgress/organs/organs.dm rename to code/unused/organs/organs.dm index de845f1dfeb..607a22e4338 100644 --- a/code/WorkInProgress/organs/organs.dm +++ b/code/unused/organs/organs.dm @@ -1,350 +1,350 @@ -/obj/organstructure //used obj for the "contents" var - name = "organs" - - var/species = "mob" //for speaking in unknown languages purposes - - var/obj/organ/limb/arms/arms = null - var/obj/organ/limb/legs/legs = null - var/obj/organ/torso/torso = null - var/obj/organ/head/head = null - - - proc/GetSpeciesName() - var/list/speciesPresent = list() - - for(var/obj/organ/organ in src) //only external organs count, since it's judging by the appearance - if(speciesPresent[organ.species]) - speciesPresent[organ.species]++ - else - speciesPresent[organ.species] = 1 //not sure, but I think it's not initialised before that, so can't ++ - - var/list/dominantSpecies = list() - - for(var/speciesName in speciesPresent) - if(!dominantSpecies.len) - dominantSpecies += speciesName - else - if(speciesPresent[dominantSpecies[1]] == speciesPresent[speciesName]) - dominantSpecies += speciesName - else if(speciesPresent[dominantSpecies[1]] < speciesPresent[speciesName]) - dominantSpecies = list(speciesName) - - if(!dominantSpecies.len) - species = "mob" - else - species = pick(dominantSpecies) - - return species - - proc/RecalculateStructure() - var/list/organs = GetAllContents() - - arms = locate(/obj/organ/limb/arms) in organs - legs = locate(/obj/organ/limb/legs) in organs - torso = locate(/obj/organ/torso) in organs - head = locate(/obj/organ/head) in organs - - GetSpeciesName() - - return - - proc/ProcessOrgans() - set background = 1 - - var/list/organs = GetAllContents() - for(var/name in organs) - var/obj/organ/organ = organs[name] - organ.ProcessOrgan() - - return - - New() - ..() - RecalculateStructure() - -/obj/organstructure/human - name = "human organs" - - New() - new /obj/organ/torso/human(src) - ..() - -/obj/organstructure/alien - name = "alien organs" - - New() - new /obj/organ/torso/alien(src) - ..() - -/obj/organ - name = "organ" - - //All types - var/organType = 0 //CYBER and SPELL go here - var/species = "mob" - var/obj/organstructure/rootOrganStructure = null - - New(location) - ..() - - rootOrganStructure = FindRootStructure() - - proc/FindRootStructure() - if(istype(loc,/obj/organ)) - var/obj/organ/parent = loc - return parent.FindRootStructure() - else if(istype(loc,/obj/organstructure)) - return loc - return null - - proc/ProcessOrgan() - return - -/obj/organ/torso - name = "torso" - var/maxHealth = 50 //right now, the mob's (only humans for now) health depends only on it. Will be fixed later - -/obj/organ/torso/human - name = "human torso" - species = "human" - maxHealth = 100 - - New() - ..() - new /obj/organ/limb/arms/human(src) - new /obj/organ/limb/legs/human(src) - new /obj/organ/head/human(src) -/obj/organ/torso/alien - name = "alien torso" - species = "alien" - maxHealth = 100 - - New() - ..() - new /obj/organ/limb/arms/alien(src) - new /obj/organ/limb/legs/alien(src) - new /obj/organ/head/alien(src) - - -/obj/organ/limb - name = "limb" - -/obj/organ/limb/arms - name = "arms" - - var/minDamage = 5 //punching damage - var/maxDamage = 5 - -/obj/organ/limb/arms/alien - name = "alien arms" - species = "alien" - minDamage = 5 - maxDamage = 15 - - -/obj/organ/limb/arms/human - name = "human arms" - species = "human" - minDamage = 1 - maxDamage = 9 - -/obj/organ/limb/legs - name = "legs" - -/obj/organ/limb/legs/human - name = "human legs" - species = "human" - -/obj/organ/limb/legs/alien - name = "alien legs" - species = "alien" - - -/obj/organ/head - name = "head" - -/obj/organ/head/human - name = "human head" - species = "human" - -/obj/organ/head/alien - name = "alien head" - species = "alien" - -/obj/organ/limb/arms/alien - name = "alien arms" - species = "alien" - minDamage = 5 - maxDamage = 15 - -/obj/organ/limb/legs/alien - name = "alien legs" - species = "alien" - -/obj/organ/head/alien - name = "alien head" - species = "alien" - -// ++++STUB ORGAN STRUCTURE. THIS IS THE DEFAULT STRUCTURE. USED TO PREVENT EXCEPTIONS++++ -/obj/organstructure/stub - name = "stub organs" - - New() - new /obj/organ/torso/stub(src) - ..() - -/obj/organ/torso/stub - name = "stub torso" - species = "stub" - maxHealth = 100 - - New() - ..() - new /obj/organ/limb/arms/stub(src) - new /obj/organ/limb/legs/stub(src) - new /obj/organ/head/stub(src) - -/obj/organ/limb/arms/stub - name = "stub arms" - species = "stub" - -/obj/organ/limb/legs/stub - name = "stub legs" - species = "stub" - -/obj/organ/head/stub - name = "stub head" - species = "stub" - -// ++++STUB ORGAN STRUCTURE. END++++ - - -// ++++MONKEY++++ - -/obj/organstructure/monkey - name = "monkey organs" - - New() - new /obj/organ/torso/monkey(src) - ..() - -/obj/organ/torso/monkey - name = "monkey torso" - species = "monkey" - maxHealth = 100 - - New() - ..() - new /obj/organ/limb/arms/monkey(src) - new /obj/organ/limb/legs/monkey(src) - new /obj/organ/head/monkey(src) - -/obj/organ/limb/arms/monkey - name = "monkey arms" - species = "monkey" - -/obj/organ/limb/legs/monkey - name = "monkey legs" - species = "monkey" - -/obj/organ/head/monkey - name = "monkey head" - species = "monkey" - - -// +++++CYBORG+++++ -/obj/organstructure/cyborg - name = "cyborg organs" - - New() - new /obj/organ/torso/cyborg(src) - ..() - -/obj/organ/torso/cyborg - name = "cyborg torso" - species = "cyborg" - maxHealth = 100 - - New() - ..() - new /obj/organ/limb/arms/cyborg(src) - new /obj/organ/limb/legs/cyborg(src) - new /obj/organ/head/cyborg(src) - -/obj/organ/limb/arms/cyborg - name = "cyborg arms" - species = "cyborg" - -/obj/organ/limb/legs/cyborg - name = "cyborg legs" - species = "cyborg" - -/obj/organ/head/cyborg - name = "cyborg head" - species = "cyborg" - -// +++++AI++++++ -/obj/organstructure/AI - name = "AI organs" - - New() - new /obj/organ/torso/AI(src) - ..() - -/obj/organ/torso/AI - name = "AI torso" - species = "AI" - maxHealth = 100 - - New() - ..() - new /obj/organ/limb/arms/AI(src) - new /obj/organ/limb/legs/AI(src) - new /obj/organ/head/AI(src) - -/obj/organ/limb/arms/AI - name = "AI arms" - species = "AI" - -/obj/organ/limb/legs/AI - name = "AI legs" - species = "AI" - -/obj/organ/head/AI - name = "AI head" - species = "AI" - -/* New organ structure template - - -/obj/organstructure/template - name = "template organs" - - New() - new /obj/organ/torso/template(src) - ..() - -/obj/organ/torso/template - name = "template torso" - species = "template" - maxHealth = 100 - - New() - ..() - new /obj/organ/limb/arms/template(src) - new /obj/organ/limb/legs/template(src) - new /obj/organ/head/template(src) - -/obj/organ/limb/arms/template - name = "template arms" - species = "template" - -/obj/organ/limb/legs/template - name = "template legs" - species = "template" - -/obj/organ/head/template - name = "template head" - species = "template" - +/obj/organstructure //used obj for the "contents" var + name = "organs" + + var/species = "mob" //for speaking in unknown languages purposes + + var/obj/organ/limb/arms/arms = null + var/obj/organ/limb/legs/legs = null + var/obj/organ/torso/torso = null + var/obj/organ/head/head = null + + + proc/GetSpeciesName() + var/list/speciesPresent = list() + + for(var/obj/organ/organ in src) //only external organs count, since it's judging by the appearance + if(speciesPresent[organ.species]) + speciesPresent[organ.species]++ + else + speciesPresent[organ.species] = 1 //not sure, but I think it's not initialised before that, so can't ++ + + var/list/dominantSpecies = list() + + for(var/speciesName in speciesPresent) + if(!dominantSpecies.len) + dominantSpecies += speciesName + else + if(speciesPresent[dominantSpecies[1]] == speciesPresent[speciesName]) + dominantSpecies += speciesName + else if(speciesPresent[dominantSpecies[1]] < speciesPresent[speciesName]) + dominantSpecies = list(speciesName) + + if(!dominantSpecies.len) + species = "mob" + else + species = pick(dominantSpecies) + + return species + + proc/RecalculateStructure() + var/list/organs = GetAllContents() + + arms = locate(/obj/organ/limb/arms) in organs + legs = locate(/obj/organ/limb/legs) in organs + torso = locate(/obj/organ/torso) in organs + head = locate(/obj/organ/head) in organs + + GetSpeciesName() + + return + + proc/ProcessOrgans() + set background = 1 + + var/list/organs = GetAllContents() + for(var/name in organs) + var/obj/organ/organ = organs[name] + organ.ProcessOrgan() + + return + + New() + ..() + RecalculateStructure() + +/obj/organstructure/human + name = "human organs" + + New() + new /obj/organ/torso/human(src) + ..() + +/obj/organstructure/alien + name = "alien organs" + + New() + new /obj/organ/torso/alien(src) + ..() + +/obj/organ + name = "organ" + + //All types + var/organType = 0 //CYBER and SPELL go here + var/species = "mob" + var/obj/organstructure/rootOrganStructure = null + + New(location) + ..() + + rootOrganStructure = FindRootStructure() + + proc/FindRootStructure() + if(istype(loc,/obj/organ)) + var/obj/organ/parent = loc + return parent.FindRootStructure() + else if(istype(loc,/obj/organstructure)) + return loc + return null + + proc/ProcessOrgan() + return + +/obj/organ/torso + name = "torso" + var/maxHealth = 50 //right now, the mob's (only humans for now) health depends only on it. Will be fixed later + +/obj/organ/torso/human + name = "human torso" + species = "human" + maxHealth = 100 + + New() + ..() + new /obj/organ/limb/arms/human(src) + new /obj/organ/limb/legs/human(src) + new /obj/organ/head/human(src) +/obj/organ/torso/alien + name = "alien torso" + species = "alien" + maxHealth = 100 + + New() + ..() + new /obj/organ/limb/arms/alien(src) + new /obj/organ/limb/legs/alien(src) + new /obj/organ/head/alien(src) + + +/obj/organ/limb + name = "limb" + +/obj/organ/limb/arms + name = "arms" + + var/minDamage = 5 //punching damage + var/maxDamage = 5 + +/obj/organ/limb/arms/alien + name = "alien arms" + species = "alien" + minDamage = 5 + maxDamage = 15 + + +/obj/organ/limb/arms/human + name = "human arms" + species = "human" + minDamage = 1 + maxDamage = 9 + +/obj/organ/limb/legs + name = "legs" + +/obj/organ/limb/legs/human + name = "human legs" + species = "human" + +/obj/organ/limb/legs/alien + name = "alien legs" + species = "alien" + + +/obj/organ/head + name = "head" + +/obj/organ/head/human + name = "human head" + species = "human" + +/obj/organ/head/alien + name = "alien head" + species = "alien" + +/obj/organ/limb/arms/alien + name = "alien arms" + species = "alien" + minDamage = 5 + maxDamage = 15 + +/obj/organ/limb/legs/alien + name = "alien legs" + species = "alien" + +/obj/organ/head/alien + name = "alien head" + species = "alien" + +// ++++STUB ORGAN STRUCTURE. THIS IS THE DEFAULT STRUCTURE. USED TO PREVENT EXCEPTIONS++++ +/obj/organstructure/stub + name = "stub organs" + + New() + new /obj/organ/torso/stub(src) + ..() + +/obj/organ/torso/stub + name = "stub torso" + species = "stub" + maxHealth = 100 + + New() + ..() + new /obj/organ/limb/arms/stub(src) + new /obj/organ/limb/legs/stub(src) + new /obj/organ/head/stub(src) + +/obj/organ/limb/arms/stub + name = "stub arms" + species = "stub" + +/obj/organ/limb/legs/stub + name = "stub legs" + species = "stub" + +/obj/organ/head/stub + name = "stub head" + species = "stub" + +// ++++STUB ORGAN STRUCTURE. END++++ + + +// ++++MONKEY++++ + +/obj/organstructure/monkey + name = "monkey organs" + + New() + new /obj/organ/torso/monkey(src) + ..() + +/obj/organ/torso/monkey + name = "monkey torso" + species = "monkey" + maxHealth = 100 + + New() + ..() + new /obj/organ/limb/arms/monkey(src) + new /obj/organ/limb/legs/monkey(src) + new /obj/organ/head/monkey(src) + +/obj/organ/limb/arms/monkey + name = "monkey arms" + species = "monkey" + +/obj/organ/limb/legs/monkey + name = "monkey legs" + species = "monkey" + +/obj/organ/head/monkey + name = "monkey head" + species = "monkey" + + +// +++++CYBORG+++++ +/obj/organstructure/cyborg + name = "cyborg organs" + + New() + new /obj/organ/torso/cyborg(src) + ..() + +/obj/organ/torso/cyborg + name = "cyborg torso" + species = "cyborg" + maxHealth = 100 + + New() + ..() + new /obj/organ/limb/arms/cyborg(src) + new /obj/organ/limb/legs/cyborg(src) + new /obj/organ/head/cyborg(src) + +/obj/organ/limb/arms/cyborg + name = "cyborg arms" + species = "cyborg" + +/obj/organ/limb/legs/cyborg + name = "cyborg legs" + species = "cyborg" + +/obj/organ/head/cyborg + name = "cyborg head" + species = "cyborg" + +// +++++AI++++++ +/obj/organstructure/AI + name = "AI organs" + + New() + new /obj/organ/torso/AI(src) + ..() + +/obj/organ/torso/AI + name = "AI torso" + species = "AI" + maxHealth = 100 + + New() + ..() + new /obj/organ/limb/arms/AI(src) + new /obj/organ/limb/legs/AI(src) + new /obj/organ/head/AI(src) + +/obj/organ/limb/arms/AI + name = "AI arms" + species = "AI" + +/obj/organ/limb/legs/AI + name = "AI legs" + species = "AI" + +/obj/organ/head/AI + name = "AI head" + species = "AI" + +/* New organ structure template + + +/obj/organstructure/template + name = "template organs" + + New() + new /obj/organ/torso/template(src) + ..() + +/obj/organ/torso/template + name = "template torso" + species = "template" + maxHealth = 100 + + New() + ..() + new /obj/organ/limb/arms/template(src) + new /obj/organ/limb/legs/template(src) + new /obj/organ/head/template(src) + +/obj/organ/limb/arms/template + name = "template arms" + species = "template" + +/obj/organ/limb/legs/template + name = "template legs" + species = "template" + +/obj/organ/head/template + name = "template head" + species = "template" + */ \ No newline at end of file diff --git a/code/game/objects/items/clothing/powerarmor.dm b/code/unused/powerarmor/powerarmor.dm similarity index 96% rename from code/game/objects/items/clothing/powerarmor.dm rename to code/unused/powerarmor/powerarmor.dm index 9df4e5242be..7a7eca200f6 100644 --- a/code/game/objects/items/clothing/powerarmor.dm +++ b/code/unused/powerarmor/powerarmor.dm @@ -1,281 +1,281 @@ -/obj/item/clothing/suit/powered - name = "Powered armor" - desc = "Not for rookies." - icon_state = "swat" - item_state = "swat" - w_class = 4//bulky item - - protective_temperature = 1000 - flags = FPRINT | TABLEPASS - body_parts_covered = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS - armor = list(melee = 40, bullet = 30, laser = 20,energy = 15, bomb = 25, bio = 10, rad = 10) - allowed = list(/obj/item/device/flashlight,/obj/item/weapon/gun,/obj/item/weapon/handcuffs,/obj/item/weapon/tank/emergency_oxygen) - slowdown = 9 - var/fuel = 0 - - var/list/togglearmor = list(melee = 90, bullet = 70, laser = 60,energy = 40, bomb = 75, bio = 75, rad = 75) - var/active = 0 - - var/helmrequired = 1 - var/obj/item/clothing/head/powered/helm - - var/glovesrequired = 0 - var/obj/item/clothing/gloves/powered/gloves - - var/shoesrequired = 0 - var/obj/item/clothing/shoes/powered/shoes - //Adding gloves and shoes as possible armor components. --NEO - - var/obj/item/powerarmor/servos/servos - var/obj/item/powerarmor/reactive/reactive - var/obj/item/powerarmor/atmoseal/atmoseal - var/obj/item/powerarmor/power/power - - New() - verbs += /obj/item/clothing/suit/powered/proc/poweron - - proc/poweron() - set category = "Object" - set name = "Activate armor systems" - - var/mob/living/carbon/human/user = usr - - if(user.stat) - return //if you're unconscious or dead, no dicking with your armor. --NEO - - if(!istype(user)) - user << "\red This suit was engineered for human use only." - return - - if(user.wear_suit!=src) - user << "\red The suit functions best if you are inside of it." - return - - if(helmrequired && !istype(user.head, /obj/item/clothing/head/powered)) - user << "\red Helmet missing, unable to initiate power-on procedure." - return - - if(glovesrequired && !istype(user.gloves, /obj/item/clothing/gloves/powered)) - user << "\red Gloves missing, unable to initiate power-on procedure." - return - - if(shoesrequired && !istype(user.shoes, /obj/item/clothing/shoes/powered)) - user << "\red Shoes missing, unable to initiate power-on procedure." - return - - if(active) - user << "\red The suit is already on, you can't turn it on twice." - return - - if(!power || !power.checkpower()) - user << "\red Powersource missing or depleted." - return - - verbs -= /obj/item/clothing/suit/powered/proc/poweron - - user << "\blue Suit interlocks engaged." - if(helmrequired) - helm = user.head - helm.canremove = 0 - if(glovesrequired) - gloves = user.gloves - gloves.canremove = 0 - if(shoesrequired) - shoes = user.shoes - shoes.canremove = 0 - canremove = 0 - sleep(20) - - if(atmoseal) - atmoseal.toggle() - sleep(20) - - if(reactive) - reactive.toggle() - sleep(20) - - if(servos) - servos.toggle() - sleep(20) - - user << "\blue All systems online." - active = 1 - power.process() - - verbs += /obj/item/clothing/suit/powered/proc/poweroff - - - proc/poweroff() - set category = "Object" - set name = "Deactivate armor systems" - powerdown() //BYOND doesn't seem to like it if you try using a proc with vars in it as a verb, hence this. --NEO - - proc/powerdown(sudden = 0) - - var/delay = sudden?0:20 - - var/mob/living/carbon/human/user = usr - - if(user.stat && !sudden) - return //if you're unconscious or dead, no dicking with your armor. --NEO - - if(!active) - return - - verbs -= /obj/item/clothing/suit/powered/proc/poweroff - - if(sudden) - user << "\red Your armor loses power!" - - if(servos) - servos.toggle(sudden) - sleep(delay) - - if(reactive) - reactive.toggle(sudden) - sleep(delay) - - if(atmoseal) - if(istype(atmoseal, /obj/item/powerarmor/atmoseal/optional) && helm) - atmoseal:helmtoggle(sudden) - atmoseal.toggle(sudden) - - sleep(delay) - - if(!sudden) - usr << "\blue Suit interlocks disengaged." - if(helm) - helm.canremove = 1 - helm = null - if(gloves) - gloves.canremove = 1 - gloves = null - if(shoes) - shoes.canremove = 1 - gloves = null - canremove = 1 - //Not a tabbing error, the thing only unlocks if you intentionally power-down the armor. --NEO - sleep(delay) - - if(!sudden) - usr << "\blue All systems disengaged." - - active = 0 - verbs += /obj/item/clothing/suit/powered/proc/poweron - - - - attackby(obj/item/weapon/W as obj, mob/user as mob) - if(power && istype(power,/obj/item/powerarmor/power/plasma)) - switch(W.type) - if(/obj/item/stack/sheet/plasma) - if(fuel < 50) - user << "\blue You feed some refined plasma into the armor's generator." - power:fuel += 25 - W:amount-- - if (W:amount <= 0) - del(W) - return - else - user << "\red The generator already has plenty of plasma." - return - - if(/obj/item/weapon/ore/plasma) //raw plasma has impurities, so it doesn't provide as much fuel. --NEO - if(fuel < 50) - user << "\blue You feed some plasma into the armor's generator." - power:fuel += 15 - del(W) - return - else - user << "\red The generator already has plenty of plasma." - return - - ..() - -/obj/item/clothing/head/powered - name = "Powered armor" - icon_state = "swat" - desc = "Not for rookies." - flags = FPRINT | TABLEPASS | HEADCOVERSEYES | HEADCOVERSMOUTH - see_face = 0.0 - item_state = "swat" - armor = list(melee = 40, bullet = 30, laser = 20,energy = 15, bomb = 25, bio = 10, rad = 10) - var/obj/item/clothing/suit/powered/parent - - proc/atmotoggle() - set category = "Object" - set name = "Toggle helmet seals" - - var/mob/living/carbon/human/user = usr - - if(!istype(user)) - user << "\red This helmet is not rated for nonhuman use." - return - - if(user.head != src) - user << "\red Can't engage the seals without wearing the helmet." - return - - if(!user.wear_suit || !istype(user.wear_suit,/obj/item/clothing/suit/powered)) - user << "\red This helmet can only couple with powered armor." - return - - var/obj/item/clothing/suit/powered/armor = user.wear_suit - - if(!armor.atmoseal || !istype(armor.atmoseal, /obj/item/powerarmor/atmoseal/optional)) - user << "\red This armor's atmospheric seals are missing or incompatible." - return - - armor.atmoseal:helmtoggle(0,1) - - - - -/obj/item/clothing/gloves/powered - name = "Powered armor" - icon_state = "swat" - desc = "Not for rookies." - flags = FPRINT | TABLEPASS - item_state = "swat" - armor = list(melee = 40, bullet = 30, laser = 20,energy = 15, bomb = 25, bio = 10, rad = 10) - -/obj/item/clothing/shoes/powered - name = "Powered armor" - icon_state = "swat" - desc = "Not for rookies." - flags = FPRINT | TABLEPASS - item_state = "swat" - armor = list(melee = 40, bullet = 30, laser = 20,energy = 15, bomb = 25, bio = 10, rad = 10) - - -obj/item/clothing/suit/powered/spawnable/badmin - New() - servos = new /obj/item/powerarmor/servos(src) - servos.parent = src - reactive = new /obj/item/powerarmor/reactive(src) - reactive.parent = src - atmoseal = new /obj/item/powerarmor/atmoseal/optional/adminbus(src) - atmoseal.parent = src - power = new /obj/item/powerarmor/power(src) - power.parent = src - - verbs += /obj/item/clothing/suit/powered/proc/poweron - - var/obj/item/clothing/head/powered/helm = new /obj/item/clothing/head/powered(src.loc) - helm.verbs += /obj/item/clothing/head/powered/proc/atmotoggle - -obj/item/clothing/suit/powered/spawnable/regular - New() - servos = new /obj/item/powerarmor/servos(src) - servos.parent = src - reactive = new /obj/item/powerarmor/reactive/centcomm(src) - reactive.parent = src - atmoseal = new /obj/item/powerarmor/atmoseal/optional/adminbus(src) - atmoseal.parent = src - power = new /obj/item/powerarmor/power(src) - power.parent = src - - verbs += /obj/item/clothing/suit/powered/proc/poweron - - var/obj/item/clothing/head/powered/helm = new /obj/item/clothing/head/powered(src.loc) - helm.verbs += /obj/item/clothing/head/powered/proc/atmotoggle +/obj/item/clothing/suit/powered + name = "Powered armor" + desc = "Not for rookies." + icon_state = "swat" + item_state = "swat" + w_class = 4//bulky item + + protective_temperature = 1000 + flags = FPRINT | TABLEPASS + body_parts_covered = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS + armor = list(melee = 40, bullet = 30, laser = 20,energy = 15, bomb = 25, bio = 10, rad = 10) + allowed = list(/obj/item/device/flashlight,/obj/item/weapon/gun,/obj/item/weapon/handcuffs,/obj/item/weapon/tank/emergency_oxygen) + slowdown = 9 + var/fuel = 0 + + var/list/togglearmor = list(melee = 90, bullet = 70, laser = 60,energy = 40, bomb = 75, bio = 75, rad = 75) + var/active = 0 + + var/helmrequired = 1 + var/obj/item/clothing/head/powered/helm + + var/glovesrequired = 0 + var/obj/item/clothing/gloves/powered/gloves + + var/shoesrequired = 0 + var/obj/item/clothing/shoes/powered/shoes + //Adding gloves and shoes as possible armor components. --NEO + + var/obj/item/powerarmor/servos/servos + var/obj/item/powerarmor/reactive/reactive + var/obj/item/powerarmor/atmoseal/atmoseal + var/obj/item/powerarmor/power/power + + New() + verbs += /obj/item/clothing/suit/powered/proc/poweron + + proc/poweron() + set category = "Object" + set name = "Activate armor systems" + + var/mob/living/carbon/human/user = usr + + if(user.stat) + return //if you're unconscious or dead, no dicking with your armor. --NEO + + if(!istype(user)) + user << "\red This suit was engineered for human use only." + return + + if(user.wear_suit!=src) + user << "\red The suit functions best if you are inside of it." + return + + if(helmrequired && !istype(user.head, /obj/item/clothing/head/powered)) + user << "\red Helmet missing, unable to initiate power-on procedure." + return + + if(glovesrequired && !istype(user.gloves, /obj/item/clothing/gloves/powered)) + user << "\red Gloves missing, unable to initiate power-on procedure." + return + + if(shoesrequired && !istype(user.shoes, /obj/item/clothing/shoes/powered)) + user << "\red Shoes missing, unable to initiate power-on procedure." + return + + if(active) + user << "\red The suit is already on, you can't turn it on twice." + return + + if(!power || !power.checkpower()) + user << "\red Powersource missing or depleted." + return + + verbs -= /obj/item/clothing/suit/powered/proc/poweron + + user << "\blue Suit interlocks engaged." + if(helmrequired) + helm = user.head + helm.canremove = 0 + if(glovesrequired) + gloves = user.gloves + gloves.canremove = 0 + if(shoesrequired) + shoes = user.shoes + shoes.canremove = 0 + canremove = 0 + sleep(20) + + if(atmoseal) + atmoseal.toggle() + sleep(20) + + if(reactive) + reactive.toggle() + sleep(20) + + if(servos) + servos.toggle() + sleep(20) + + user << "\blue All systems online." + active = 1 + power.process() + + verbs += /obj/item/clothing/suit/powered/proc/poweroff + + + proc/poweroff() + set category = "Object" + set name = "Deactivate armor systems" + powerdown() //BYOND doesn't seem to like it if you try using a proc with vars in it as a verb, hence this. --NEO + + proc/powerdown(sudden = 0) + + var/delay = sudden?0:20 + + var/mob/living/carbon/human/user = usr + + if(user.stat && !sudden) + return //if you're unconscious or dead, no dicking with your armor. --NEO + + if(!active) + return + + verbs -= /obj/item/clothing/suit/powered/proc/poweroff + + if(sudden) + user << "\red Your armor loses power!" + + if(servos) + servos.toggle(sudden) + sleep(delay) + + if(reactive) + reactive.toggle(sudden) + sleep(delay) + + if(atmoseal) + if(istype(atmoseal, /obj/item/powerarmor/atmoseal/optional) && helm) + atmoseal:helmtoggle(sudden) + atmoseal.toggle(sudden) + + sleep(delay) + + if(!sudden) + usr << "\blue Suit interlocks disengaged." + if(helm) + helm.canremove = 1 + helm = null + if(gloves) + gloves.canremove = 1 + gloves = null + if(shoes) + shoes.canremove = 1 + gloves = null + canremove = 1 + //Not a tabbing error, the thing only unlocks if you intentionally power-down the armor. --NEO + sleep(delay) + + if(!sudden) + usr << "\blue All systems disengaged." + + active = 0 + verbs += /obj/item/clothing/suit/powered/proc/poweron + + + + attackby(obj/item/weapon/W as obj, mob/user as mob) + if(power && istype(power,/obj/item/powerarmor/power/plasma)) + switch(W.type) + if(/obj/item/stack/sheet/plasma) + if(fuel < 50) + user << "\blue You feed some refined plasma into the armor's generator." + power:fuel += 25 + W:amount-- + if (W:amount <= 0) + del(W) + return + else + user << "\red The generator already has plenty of plasma." + return + + if(/obj/item/weapon/ore/plasma) //raw plasma has impurities, so it doesn't provide as much fuel. --NEO + if(fuel < 50) + user << "\blue You feed some plasma into the armor's generator." + power:fuel += 15 + del(W) + return + else + user << "\red The generator already has plenty of plasma." + return + + ..() + +/obj/item/clothing/head/powered + name = "Powered armor" + icon_state = "swat" + desc = "Not for rookies." + flags = FPRINT | TABLEPASS | HEADCOVERSEYES | HEADCOVERSMOUTH + see_face = 0.0 + item_state = "swat" + armor = list(melee = 40, bullet = 30, laser = 20,energy = 15, bomb = 25, bio = 10, rad = 10) + var/obj/item/clothing/suit/powered/parent + + proc/atmotoggle() + set category = "Object" + set name = "Toggle helmet seals" + + var/mob/living/carbon/human/user = usr + + if(!istype(user)) + user << "\red This helmet is not rated for nonhuman use." + return + + if(user.head != src) + user << "\red Can't engage the seals without wearing the helmet." + return + + if(!user.wear_suit || !istype(user.wear_suit,/obj/item/clothing/suit/powered)) + user << "\red This helmet can only couple with powered armor." + return + + var/obj/item/clothing/suit/powered/armor = user.wear_suit + + if(!armor.atmoseal || !istype(armor.atmoseal, /obj/item/powerarmor/atmoseal/optional)) + user << "\red This armor's atmospheric seals are missing or incompatible." + return + + armor.atmoseal:helmtoggle(0,1) + + + + +/obj/item/clothing/gloves/powered + name = "Powered armor" + icon_state = "swat" + desc = "Not for rookies." + flags = FPRINT | TABLEPASS + item_state = "swat" + armor = list(melee = 40, bullet = 30, laser = 20,energy = 15, bomb = 25, bio = 10, rad = 10) + +/obj/item/clothing/shoes/powered + name = "Powered armor" + icon_state = "swat" + desc = "Not for rookies." + flags = FPRINT | TABLEPASS + item_state = "swat" + armor = list(melee = 40, bullet = 30, laser = 20,energy = 15, bomb = 25, bio = 10, rad = 10) + + +obj/item/clothing/suit/powered/spawnable/badmin + New() + servos = new /obj/item/powerarmor/servos(src) + servos.parent = src + reactive = new /obj/item/powerarmor/reactive(src) + reactive.parent = src + atmoseal = new /obj/item/powerarmor/atmoseal/optional/adminbus(src) + atmoseal.parent = src + power = new /obj/item/powerarmor/power(src) + power.parent = src + + verbs += /obj/item/clothing/suit/powered/proc/poweron + + var/obj/item/clothing/head/powered/helm = new /obj/item/clothing/head/powered(src.loc) + helm.verbs += /obj/item/clothing/head/powered/proc/atmotoggle + +obj/item/clothing/suit/powered/spawnable/regular + New() + servos = new /obj/item/powerarmor/servos(src) + servos.parent = src + reactive = new /obj/item/powerarmor/reactive/centcomm(src) + reactive.parent = src + atmoseal = new /obj/item/powerarmor/atmoseal/optional/adminbus(src) + atmoseal.parent = src + power = new /obj/item/powerarmor/power(src) + power.parent = src + + verbs += /obj/item/clothing/suit/powered/proc/poweron + + var/obj/item/clothing/head/powered/helm = new /obj/item/clothing/head/powered(src.loc) + helm.verbs += /obj/item/clothing/head/powered/proc/atmotoggle diff --git a/code/game/objects/items/clothing/powerarmorcomponents.dm b/code/unused/powerarmor/powerarmorcomponents.dm similarity index 96% rename from code/game/objects/items/clothing/powerarmorcomponents.dm rename to code/unused/powerarmor/powerarmorcomponents.dm index 03848b6a25d..8d09536f9c1 100644 --- a/code/game/objects/items/clothing/powerarmorcomponents.dm +++ b/code/unused/powerarmor/powerarmorcomponents.dm @@ -1,246 +1,246 @@ -/obj/item/powerarmor - name = "Generic power armor component" - desc = "This is the base object, you should never see one." - var/obj/item/clothing/suit/powered/parent //so the component knows which armor it belongs to. - var/slowdown = 0 //how much the component slows down the wearer - - proc/toggle() - return - //The child objects will use this proc - - - -/obj/item/powerarmor/power - name = "Adminbus power armor power source" - desc = "Runs on the rare Badminium molecule." - - process() - return - - proc/checkpower() - return 1 - - plasma - name = "Miniaturized plasma generator" - desc = "Runs on plasma." - slowdown = 1 - var/fuel = 0 - - process() - if (fuel > 0 && parent.active) - fuel-- - spawn(50) - process() - return - else if (parent.active) - parent.powerdown(1) - return - - checkpower() - return fuel - - powercell - name = "Powercell interface" - desc = "Boring, but reliable." - var/obj/item/weapon/cell/cell - slowdown = 0.5 - - process() - if (cell && cell.charge > 0 && parent.active) - cell.use(50) - spawn(50) - process() - return - else if (parent.active) - parent.powerdown(1) - return - - checkpower() - return max(cell.charge, 0) - - nuclear - name = "Miniaturized nuclear generator" - desc = "For all your radioactive needs." - slowdown = 1.5 - - process() - if(!crit_fail) - if (prob(src.reliability)) return 1 //No failure - if (prob(src.reliability)) - for (var/mob/M in range(0,src.parent)) //Only a minor failure, enjoy your radiation. - if (src.parent in M.contents) - M << "\red Your armor feels pleasantly warm for a moment." - else - M << "\red You feel a warm sensation." - M.radiation += rand(1,40) - else - for (var/mob/M in range(rand(1,4),src.parent)) //Big failure, TIME FOR RADIATION BITCHES - if (src.parent in M.contents) - M << "\red Your armor's reactor overloads!" - M << "\red You feel a wave of heat wash over you." - M.radiation += 100 - crit_fail = 1 //broken~ - parent.powerdown(1) - spawn(50) - process() - - checkpower() - return !crit_fail - -/obj/item/powerarmor/reactive - name = "Adminbus power armor reactive plating" - desc = "Made with the rare Badminium molecule." - var/list/togglearmor = list(melee = 250, bullet = 100, laser = 100,energy = 100, bomb = 100, bio = 100, rad = 100) - //Good lord an active energy axe does 150 damage a swing? Anyway, barring var editing, this armor loadout should be impervious to anything. Enjoy, badmins~ --NEO - - toggle(sudden = 0) - switch(parent.active) - if(1) - if(!sudden) - usr << "\blue Reactive armor systems disengaged." - if(0) - usr << "\blue Reactive armor systems engaged." - var/list/switchover = list() - for (var/armorvar in parent.armor) - switchover[armorvar] = togglearmor[armorvar] - togglearmor[armorvar] = parent.armor[armorvar] - parent.armor[armorvar] = switchover[armorvar] - //Probably not the most elegant way to have the vars switch over, but it works. Also propagates the values to the other objects. - if(parent.helm) - parent.helm.armor[armorvar] = parent.armor[armorvar] - if(parent.gloves) - parent.gloves.armor[armorvar] = parent.armor[armorvar] - if(parent.shoes) - parent.shoes.armor[armorvar] = parent.armor[armorvar] - - centcomm - name = "CentComm power armor reactive plating" - desc = "Pretty effective against everything, not perfect though." - togglearmor = list(melee = 90, bullet = 70, laser = 60,energy = 40, bomb = 75, bio = 75, rad = 75) - slowdown = 2 - - -/obj/item/powerarmor/servos - name = "Adminbus power armor movement servos" - desc = "Made with the rare Badminium molecule." - var/toggleslowdown = 9 - - toggle(sudden = 0) - switch(parent.active) - if(1) - if(!sudden) - usr << "\blue Movement assist servos disengaged." - parent.slowdown += toggleslowdown - if(0) - usr << "\blue Movement assist servos engaged." - parent.slowdown -= toggleslowdown - -/obj/item/powerarmor/atmoseal - name = "Power armor atmospheric seals" - desc = "Keeps the bad stuff out." - slowdown = 1 - var/sealed = 0 - - toggle(sudden = 0) - switch(parent.active) - if(1) - if(!sudden) - usr << "\blue Atmospheric seals disengaged." - parent.gas_transfer_coefficient = 1 - parent.permeability_coefficient = 1 - parent.heat_transfer_coefficient = 1 - parent.flags &= ~SUITSPACE - if(parent.helmrequired) - parent.helm.gas_transfer_coefficient = 1 - parent.helm.permeability_coefficient = 1 - parent.helm.heat_transfer_coefficient = 1 - parent.helm.flags &= ~HEADSPACE - if(parent.glovesrequired) - parent.gloves.gas_transfer_coefficient = 1 - parent.gloves.permeability_coefficient = 1 - parent.gloves.heat_transfer_coefficient = 1 - if(parent.shoesrequired) - parent.shoes.gas_transfer_coefficient = 1 - parent.shoes.permeability_coefficient = 1 - parent.shoes.heat_transfer_coefficient = 1 - sealed = 0 - - if(0) - usr << "\blue Atmospheric seals engaged." - parent.gas_transfer_coefficient = 0.01 - parent.permeability_coefficient = 0.02 - parent.heat_transfer_coefficient = 0.02 - parent.flags |= SUITSPACE - if(parent.helmrequired) - parent.helm.gas_transfer_coefficient = 0.01 - parent.helm.permeability_coefficient = 0.02 - parent.helm.heat_transfer_coefficient = 0.02 - parent.helm.flags |= HEADSPACE - if(parent.glovesrequired) - parent.gloves.gas_transfer_coefficient = 0.01 - parent.gloves.permeability_coefficient = 0.02 - parent.gloves.heat_transfer_coefficient = 0.02 - if(parent.shoesrequired) - parent.shoes.gas_transfer_coefficient = 0.01 - parent.shoes.permeability_coefficient = 0.02 - parent.shoes.heat_transfer_coefficient = 0.02 - sealed = 1 - - adminbus - name = "Adminbus power armor atmospheric seals" - desc = "Made with the rare Badminium molecule." - slowdown = 0 - - optional - name = "Togglable power armor atmospheric seals" - desc = "Keeps the bad stuff out, but lets you remove your helmet without having to turn the whole suit off." - - proc/helmtoggle(sudden = 0, manual = 0) - var/mob/living/carbon/human/user = usr - var/obj/item/clothing/head/powered/helm - if(user.head && istype(user.head,/obj/item/clothing/head/powered)) - helm = user.head - - if(!sealed) - user << "\red Unable to initialize helmet seal, armor seals not active." - return - if(!helm.parent) - user << "\blue Helmet locked." - helm.canremove = 0 - parent.helm = helm - helm.parent = parent - sleep(20) - parent.helm.gas_transfer_coefficient = 0.01 - parent.helm.permeability_coefficient = 0.02 - parent.helm.heat_transfer_coefficient = 0.02 - parent.helm.flags |= HEADSPACE - user << "\blue Helmet atmospheric seals engaged." - if(manual) - for (var/armorvar in helm.armor) - helm.armor[armorvar] = parent.armor[armorvar] - return - else - if(manual) - user << "\blue Helmet atmospheric seals disengaged." - parent.helm.gas_transfer_coefficient = 1 - parent.helm.permeability_coefficient = 1 - parent.helm.heat_transfer_coefficient = 1 - parent.helm.flags &= ~HEADSPACE - if(manual) - for (var/armorvar in helm.armor) - helm.armor[armorvar] = parent.reactive.togglearmor[armorvar] - if(!sudden) - if(manual) - sleep(20) - user << "\blue Helmet unlocked." - helm.canremove = 1 - parent.helm = null - helm.parent = null - - adminbus - name = "Adminbus togglable power armor atmospheric seals" - desc = "Made with the rare Badminium molecule." - slowdown = 0 - - - +/obj/item/powerarmor + name = "Generic power armor component" + desc = "This is the base object, you should never see one." + var/obj/item/clothing/suit/powered/parent //so the component knows which armor it belongs to. + var/slowdown = 0 //how much the component slows down the wearer + + proc/toggle() + return + //The child objects will use this proc + + + +/obj/item/powerarmor/power + name = "Adminbus power armor power source" + desc = "Runs on the rare Badminium molecule." + + process() + return + + proc/checkpower() + return 1 + + plasma + name = "Miniaturized plasma generator" + desc = "Runs on plasma." + slowdown = 1 + var/fuel = 0 + + process() + if (fuel > 0 && parent.active) + fuel-- + spawn(50) + process() + return + else if (parent.active) + parent.powerdown(1) + return + + checkpower() + return fuel + + powercell + name = "Powercell interface" + desc = "Boring, but reliable." + var/obj/item/weapon/cell/cell + slowdown = 0.5 + + process() + if (cell && cell.charge > 0 && parent.active) + cell.use(50) + spawn(50) + process() + return + else if (parent.active) + parent.powerdown(1) + return + + checkpower() + return max(cell.charge, 0) + + nuclear + name = "Miniaturized nuclear generator" + desc = "For all your radioactive needs." + slowdown = 1.5 + + process() + if(!crit_fail) + if (prob(src.reliability)) return 1 //No failure + if (prob(src.reliability)) + for (var/mob/M in range(0,src.parent)) //Only a minor failure, enjoy your radiation. + if (src.parent in M.contents) + M << "\red Your armor feels pleasantly warm for a moment." + else + M << "\red You feel a warm sensation." + M.radiation += rand(1,40) + else + for (var/mob/M in range(rand(1,4),src.parent)) //Big failure, TIME FOR RADIATION BITCHES + if (src.parent in M.contents) + M << "\red Your armor's reactor overloads!" + M << "\red You feel a wave of heat wash over you." + M.radiation += 100 + crit_fail = 1 //broken~ + parent.powerdown(1) + spawn(50) + process() + + checkpower() + return !crit_fail + +/obj/item/powerarmor/reactive + name = "Adminbus power armor reactive plating" + desc = "Made with the rare Badminium molecule." + var/list/togglearmor = list(melee = 250, bullet = 100, laser = 100,energy = 100, bomb = 100, bio = 100, rad = 100) + //Good lord an active energy axe does 150 damage a swing? Anyway, barring var editing, this armor loadout should be impervious to anything. Enjoy, badmins~ --NEO + + toggle(sudden = 0) + switch(parent.active) + if(1) + if(!sudden) + usr << "\blue Reactive armor systems disengaged." + if(0) + usr << "\blue Reactive armor systems engaged." + var/list/switchover = list() + for (var/armorvar in parent.armor) + switchover[armorvar] = togglearmor[armorvar] + togglearmor[armorvar] = parent.armor[armorvar] + parent.armor[armorvar] = switchover[armorvar] + //Probably not the most elegant way to have the vars switch over, but it works. Also propagates the values to the other objects. + if(parent.helm) + parent.helm.armor[armorvar] = parent.armor[armorvar] + if(parent.gloves) + parent.gloves.armor[armorvar] = parent.armor[armorvar] + if(parent.shoes) + parent.shoes.armor[armorvar] = parent.armor[armorvar] + + centcomm + name = "CentComm power armor reactive plating" + desc = "Pretty effective against everything, not perfect though." + togglearmor = list(melee = 90, bullet = 70, laser = 60,energy = 40, bomb = 75, bio = 75, rad = 75) + slowdown = 2 + + +/obj/item/powerarmor/servos + name = "Adminbus power armor movement servos" + desc = "Made with the rare Badminium molecule." + var/toggleslowdown = 9 + + toggle(sudden = 0) + switch(parent.active) + if(1) + if(!sudden) + usr << "\blue Movement assist servos disengaged." + parent.slowdown += toggleslowdown + if(0) + usr << "\blue Movement assist servos engaged." + parent.slowdown -= toggleslowdown + +/obj/item/powerarmor/atmoseal + name = "Power armor atmospheric seals" + desc = "Keeps the bad stuff out." + slowdown = 1 + var/sealed = 0 + + toggle(sudden = 0) + switch(parent.active) + if(1) + if(!sudden) + usr << "\blue Atmospheric seals disengaged." + parent.gas_transfer_coefficient = 1 + parent.permeability_coefficient = 1 + parent.heat_transfer_coefficient = 1 + parent.flags &= ~SUITSPACE + if(parent.helmrequired) + parent.helm.gas_transfer_coefficient = 1 + parent.helm.permeability_coefficient = 1 + parent.helm.heat_transfer_coefficient = 1 + parent.helm.flags &= ~HEADSPACE + if(parent.glovesrequired) + parent.gloves.gas_transfer_coefficient = 1 + parent.gloves.permeability_coefficient = 1 + parent.gloves.heat_transfer_coefficient = 1 + if(parent.shoesrequired) + parent.shoes.gas_transfer_coefficient = 1 + parent.shoes.permeability_coefficient = 1 + parent.shoes.heat_transfer_coefficient = 1 + sealed = 0 + + if(0) + usr << "\blue Atmospheric seals engaged." + parent.gas_transfer_coefficient = 0.01 + parent.permeability_coefficient = 0.02 + parent.heat_transfer_coefficient = 0.02 + parent.flags |= SUITSPACE + if(parent.helmrequired) + parent.helm.gas_transfer_coefficient = 0.01 + parent.helm.permeability_coefficient = 0.02 + parent.helm.heat_transfer_coefficient = 0.02 + parent.helm.flags |= HEADSPACE + if(parent.glovesrequired) + parent.gloves.gas_transfer_coefficient = 0.01 + parent.gloves.permeability_coefficient = 0.02 + parent.gloves.heat_transfer_coefficient = 0.02 + if(parent.shoesrequired) + parent.shoes.gas_transfer_coefficient = 0.01 + parent.shoes.permeability_coefficient = 0.02 + parent.shoes.heat_transfer_coefficient = 0.02 + sealed = 1 + + adminbus + name = "Adminbus power armor atmospheric seals" + desc = "Made with the rare Badminium molecule." + slowdown = 0 + + optional + name = "Togglable power armor atmospheric seals" + desc = "Keeps the bad stuff out, but lets you remove your helmet without having to turn the whole suit off." + + proc/helmtoggle(sudden = 0, manual = 0) + var/mob/living/carbon/human/user = usr + var/obj/item/clothing/head/powered/helm + if(user.head && istype(user.head,/obj/item/clothing/head/powered)) + helm = user.head + + if(!sealed) + user << "\red Unable to initialize helmet seal, armor seals not active." + return + if(!helm.parent) + user << "\blue Helmet locked." + helm.canremove = 0 + parent.helm = helm + helm.parent = parent + sleep(20) + parent.helm.gas_transfer_coefficient = 0.01 + parent.helm.permeability_coefficient = 0.02 + parent.helm.heat_transfer_coefficient = 0.02 + parent.helm.flags |= HEADSPACE + user << "\blue Helmet atmospheric seals engaged." + if(manual) + for (var/armorvar in helm.armor) + helm.armor[armorvar] = parent.armor[armorvar] + return + else + if(manual) + user << "\blue Helmet atmospheric seals disengaged." + parent.helm.gas_transfer_coefficient = 1 + parent.helm.permeability_coefficient = 1 + parent.helm.heat_transfer_coefficient = 1 + parent.helm.flags &= ~HEADSPACE + if(manual) + for (var/armorvar in helm.armor) + helm.armor[armorvar] = parent.reactive.togglearmor[armorvar] + if(!sudden) + if(manual) + sleep(20) + user << "\blue Helmet unlocked." + helm.canremove = 1 + parent.helm = null + helm.parent = null + + adminbus + name = "Adminbus togglable power armor atmospheric seals" + desc = "Made with the rare Badminium molecule." + slowdown = 0 + + + diff --git a/code/modules/recycling/scrap.dm b/code/unused/scrap.dm similarity index 95% rename from code/modules/recycling/scrap.dm rename to code/unused/scrap.dm index e15d6780b20..bd3dad3dba5 100644 --- a/code/modules/recycling/scrap.dm +++ b/code/unused/scrap.dm @@ -1,289 +1,289 @@ -// The scrap item -// a single object type represents all combinations of size and composition of scrap -// - - -/obj/item/scrap - name = "scrap" - icon = 'scrap.dmi' - icon_state = "1metal0" - item_state = "scrap-metal" - desc = "A piece of scrap" - var/classtext = "" - throwforce = 14.0 - m_amt = 0 - g_amt = 0 - w_amt = 0 - var/size = 1 // 1=piece, 2= few pieces, 3=small pile, 4=large pile - var/blood = 0 // 0=none, 1=blood-stained, 2=bloody - - throwforce = 8.0 - throw_speed = 1 - throw_range = 4 - w_class = 1 - flags = FPRINT | TABLEPASS | CONDUCT - -#define MAX_SCRAP 15000 // maximum content amount of a scrap pile - - -/obj/item/scrap/New() - src.verbs -= /atom/movable/verb/pull - ..() - update() - -// return a copy -/obj/item/scrap/proc/copy() - var/obj/item/scrap/ret = new() - ret.set_components(m_amt, g_amt, w_amt) - return ret - - -// set the metal, glass and waste content -/obj/item/scrap/proc/set_components(var/m, var/g, var/w) - m_amt = m - g_amt = g - w_amt = w - update() - -// returns the total amount of scrap in this pile -/obj/item/scrap/proc/total() - return m_amt + g_amt + w_amt - - -// sets the size, appearance, and description of the scrap depending on component amounts -/obj/item/scrap/proc/update() - var/total = total() - - - // determine size of pile - if(total<=400) - size = 1 - else if(total<=1600) - size = 2 - else - size = 3 - - w_class = size - - var/sizetext = "" - - switch(size) - if(1) - sizetext = "A piece of" - if(2) - sizetext = "A few pieces of" - if(3) - sizetext = "A pile of" - - // determine bloodiness - var/bloodtext = "" - switch(blood) - if(0) - bloodtext = "" - if(1) - bloodtext = "blood-stained " - if(2) - bloodtext = "bloody " - - - // find mixture and composition - var/class = 0 // 0 = mixed, 1=mostly. 2=pure - var/major = "waste" // the major component type - - var/max = 0 - - if(m_amt > max) - max = m_amt - else if(g_amt > max) - max = g_amt - else if(w_amt > max) - max = w_amt - - if(max == total) - class = 2 // pure - else if(max/total > 0.6) - class = 1 // mostly - else - class = 0 // mixed - - if(class>0) - var/remain = total - max - if(m_amt > remain) - major = "metal" - else if(g_amt > remain) - major = "glass" - else - major = "waste" - - - if(class == 1) - desc = "[sizetext] mostly [major] [bloodtext]scrap." - classtext = "mostly [major] [bloodtext]" - else - desc = "[sizetext] [bloodtext][major] scrap." - classtext = "[bloodtext][major] " - icon_state = "[size][major][blood]" - else - desc = "[sizetext] [bloodtext]mixed scrap." - classtext = "[bloodtext]mixed" - icon_state = "[size]mixed[blood]" - - if(size==0) - pixel_x = rand(-5,5) - pixel_y = rand(-5,5) - else - pixel_x = 0 - pixel_y = 0 - - // clear or set conduction flag depending on whether scrap is mostly metal - if(major=="metal") - flags |= CONDUCT - else - flags &= ~CONDUCT - - item_state = "scrap-[major]" - -// add a scrap item to this one -// if the resulting pile is too big, transfer only what will fit -// otherwise add them and deleted the added pile - -/obj/item/scrap/proc/add_scrap(var/obj/item/scrap/other, var/limit = MAX_SCRAP) - var/total = total() - var/other_total = other.total() - - if( (total + other_total) <= limit ) - m_amt += other.m_amt - g_amt += other.g_amt - w_amt += other.w_amt - - blood = (total*blood + other_total*other.blood) / (total + other_total) - del(other) - - else - var/space = limit - total - - var/m = round(other.m_amt/other_total*space, 1) - var/g = round(other.g_amt/other_total*space, 1) - var/w = round(other.w_amt/other_total*space, 1) - - m_amt += m - g_amt += g - w_amt += w - - other.m_amt -= m - other.g_amt -= g - other.w_amt -= w - - var/other_trans = m + g + w - other.update() - blood = (total*blood + other_trans*other.blood) / (total + other_trans) - - - blood = round(blood,1) - src.update() - -// limit this pile to maximum size -// return any remainder as a new scrap item (or null if none) -// note return item is not necessarily smaller than max size - -/obj/item/scrap/proc/remainder(var/limit = MAX_SCRAP) - var/total = total() - if(total > limit) - var/m = round( m_amt/total * limit, 1) - var/g = round( g_amt/total * limit, 1) - var/w = round( w_amt/total * limit, 1) - - var/obj/item/scrap/S = new() - S.set_components(m_amt - m,g_amt - g,w_amt - w) - src.set_components(m,g,w) - - return S - return null - -// if other pile of scrap tries to enter the same turf, then add that pile to this one - -/obj/item/scrap/CanPass(var/obj/item/scrap/O) - - if(istype(O)) - - src.add_scrap(O) - if(O) - return 0 // O still exists if not all could be transfered, so block it - return 1 - -/obj/item/scrap/proc/to_text() - return "[m_amt],[g_amt],[w_amt] ([total()])" - - -// attack with hand removes a single piece from a pile -/obj/item/scrap/attack_hand(mob/user) - add_fingerprint(user) - if(src.is_single_piece()) - return ..(user) - var/obj/item/scrap/S = src.get_single_piece() - S.attack_hand(user) - return - - -/obj/item/scrap/attackby(obj/item/I, mob/user) - ..() - if(istype(I, /obj/item/scrap)) - var/obj/item/scrap/S = I - if( (S.total()+src.total() ) > MAX_SCRAP ) - user << "The pile is full." - return - if(ismob(src.loc)) // can't combine scrap in hand - return - - src.add_scrap(S) - -// when dropped, try to make a pile if scrap is already there -/obj/item/scrap/dropped() - - spawn(2) // delay to allow drop postprocessing (since src may be destroyed) - for(var/obj/item/scrap/S in oview(0,src)) // excludes src itself - S.add_scrap(src) - -// return true if this is a single piece of scrap -// must be total<=400 and of single composition -/obj/item/scrap/proc/is_single_piece() - if(total() > 400) - return 0 - - var/empty = (m_amt == 0) + (g_amt == 0) + (w_amt == 0) - - return (empty==2) // must be 2 components with zero amount - - -// get a single piece of scrap from a pile -/obj/item/scrap/proc/get_single_piece() - - var/obj/item/scrap/S = new() - - var/cmp = pick(m_amt;1 , g_amt;2, w_amt;3) - - var/amount = 400 - switch(cmp) - if(1) - if(m_amt < amount) - amount = m_amt - - S.set_components(amount, 0, 0) - src.set_components(m_amt - amount, g_amt, w_amt) - - if(2) - if(g_amt < amount) - amount = g_amt - S.set_components(0, amount, 0) - src.set_components(m_amt, g_amt - amount, w_amt) - - if(3) - if(w_amt < amount) - amount = w_amt - S.set_components(0, 0, amount) - src.set_components(m_amt, g_amt, w_amt - amount) - - - return S - - +// The scrap item +// a single object type represents all combinations of size and composition of scrap +// + + +/obj/item/scrap + name = "scrap" + icon = 'scrap.dmi' + icon_state = "1metal0" + item_state = "scrap-metal" + desc = "A piece of scrap" + var/classtext = "" + throwforce = 14.0 + m_amt = 0 + g_amt = 0 + w_amt = 0 + var/size = 1 // 1=piece, 2= few pieces, 3=small pile, 4=large pile + var/blood = 0 // 0=none, 1=blood-stained, 2=bloody + + throwforce = 8.0 + throw_speed = 1 + throw_range = 4 + w_class = 1 + flags = FPRINT | TABLEPASS | CONDUCT + +#define MAX_SCRAP 15000 // maximum content amount of a scrap pile + + +/obj/item/scrap/New() + src.verbs -= /atom/movable/verb/pull + ..() + update() + +// return a copy +/obj/item/scrap/proc/copy() + var/obj/item/scrap/ret = new() + ret.set_components(m_amt, g_amt, w_amt) + return ret + + +// set the metal, glass and waste content +/obj/item/scrap/proc/set_components(var/m, var/g, var/w) + m_amt = m + g_amt = g + w_amt = w + update() + +// returns the total amount of scrap in this pile +/obj/item/scrap/proc/total() + return m_amt + g_amt + w_amt + + +// sets the size, appearance, and description of the scrap depending on component amounts +/obj/item/scrap/proc/update() + var/total = total() + + + // determine size of pile + if(total<=400) + size = 1 + else if(total<=1600) + size = 2 + else + size = 3 + + w_class = size + + var/sizetext = "" + + switch(size) + if(1) + sizetext = "A piece of" + if(2) + sizetext = "A few pieces of" + if(3) + sizetext = "A pile of" + + // determine bloodiness + var/bloodtext = "" + switch(blood) + if(0) + bloodtext = "" + if(1) + bloodtext = "blood-stained " + if(2) + bloodtext = "bloody " + + + // find mixture and composition + var/class = 0 // 0 = mixed, 1=mostly. 2=pure + var/major = "waste" // the major component type + + var/max = 0 + + if(m_amt > max) + max = m_amt + else if(g_amt > max) + max = g_amt + else if(w_amt > max) + max = w_amt + + if(max == total) + class = 2 // pure + else if(max/total > 0.6) + class = 1 // mostly + else + class = 0 // mixed + + if(class>0) + var/remain = total - max + if(m_amt > remain) + major = "metal" + else if(g_amt > remain) + major = "glass" + else + major = "waste" + + + if(class == 1) + desc = "[sizetext] mostly [major] [bloodtext]scrap." + classtext = "mostly [major] [bloodtext]" + else + desc = "[sizetext] [bloodtext][major] scrap." + classtext = "[bloodtext][major] " + icon_state = "[size][major][blood]" + else + desc = "[sizetext] [bloodtext]mixed scrap." + classtext = "[bloodtext]mixed" + icon_state = "[size]mixed[blood]" + + if(size==0) + pixel_x = rand(-5,5) + pixel_y = rand(-5,5) + else + pixel_x = 0 + pixel_y = 0 + + // clear or set conduction flag depending on whether scrap is mostly metal + if(major=="metal") + flags |= CONDUCT + else + flags &= ~CONDUCT + + item_state = "scrap-[major]" + +// add a scrap item to this one +// if the resulting pile is too big, transfer only what will fit +// otherwise add them and deleted the added pile + +/obj/item/scrap/proc/add_scrap(var/obj/item/scrap/other, var/limit = MAX_SCRAP) + var/total = total() + var/other_total = other.total() + + if( (total + other_total) <= limit ) + m_amt += other.m_amt + g_amt += other.g_amt + w_amt += other.w_amt + + blood = (total*blood + other_total*other.blood) / (total + other_total) + del(other) + + else + var/space = limit - total + + var/m = round(other.m_amt/other_total*space, 1) + var/g = round(other.g_amt/other_total*space, 1) + var/w = round(other.w_amt/other_total*space, 1) + + m_amt += m + g_amt += g + w_amt += w + + other.m_amt -= m + other.g_amt -= g + other.w_amt -= w + + var/other_trans = m + g + w + other.update() + blood = (total*blood + other_trans*other.blood) / (total + other_trans) + + + blood = round(blood,1) + src.update() + +// limit this pile to maximum size +// return any remainder as a new scrap item (or null if none) +// note return item is not necessarily smaller than max size + +/obj/item/scrap/proc/remainder(var/limit = MAX_SCRAP) + var/total = total() + if(total > limit) + var/m = round( m_amt/total * limit, 1) + var/g = round( g_amt/total * limit, 1) + var/w = round( w_amt/total * limit, 1) + + var/obj/item/scrap/S = new() + S.set_components(m_amt - m,g_amt - g,w_amt - w) + src.set_components(m,g,w) + + return S + return null + +// if other pile of scrap tries to enter the same turf, then add that pile to this one + +/obj/item/scrap/CanPass(var/obj/item/scrap/O) + + if(istype(O)) + + src.add_scrap(O) + if(O) + return 0 // O still exists if not all could be transfered, so block it + return 1 + +/obj/item/scrap/proc/to_text() + return "[m_amt],[g_amt],[w_amt] ([total()])" + + +// attack with hand removes a single piece from a pile +/obj/item/scrap/attack_hand(mob/user) + add_fingerprint(user) + if(src.is_single_piece()) + return ..(user) + var/obj/item/scrap/S = src.get_single_piece() + S.attack_hand(user) + return + + +/obj/item/scrap/attackby(obj/item/I, mob/user) + ..() + if(istype(I, /obj/item/scrap)) + var/obj/item/scrap/S = I + if( (S.total()+src.total() ) > MAX_SCRAP ) + user << "The pile is full." + return + if(ismob(src.loc)) // can't combine scrap in hand + return + + src.add_scrap(S) + +// when dropped, try to make a pile if scrap is already there +/obj/item/scrap/dropped() + + spawn(2) // delay to allow drop postprocessing (since src may be destroyed) + for(var/obj/item/scrap/S in oview(0,src)) // excludes src itself + S.add_scrap(src) + +// return true if this is a single piece of scrap +// must be total<=400 and of single composition +/obj/item/scrap/proc/is_single_piece() + if(total() > 400) + return 0 + + var/empty = (m_amt == 0) + (g_amt == 0) + (w_amt == 0) + + return (empty==2) // must be 2 components with zero amount + + +// get a single piece of scrap from a pile +/obj/item/scrap/proc/get_single_piece() + + var/obj/item/scrap/S = new() + + var/cmp = pick(m_amt;1 , g_amt;2, w_amt;3) + + var/amount = 400 + switch(cmp) + if(1) + if(m_amt < amount) + amount = m_amt + + S.set_components(amount, 0, 0) + src.set_components(m_amt - amount, g_amt, w_amt) + + if(2) + if(g_amt < amount) + amount = g_amt + S.set_components(0, amount, 0) + src.set_components(m_amt, g_amt - amount, w_amt) + + if(3) + if(w_amt < amount) + amount = w_amt + S.set_components(0, 0, amount) + src.set_components(m_amt, g_amt, w_amt - amount) + + + return S + +