Skip to content

Commit

Permalink
Money for Torsos
Browse files Browse the repository at this point in the history
  • Loading branch information
InsightfulParasite committed Jan 23, 2024
1 parent af97d40 commit a2da73e
Show file tree
Hide file tree
Showing 2 changed files with 184 additions and 0 deletions.
184 changes: 184 additions & 0 deletions ModularTegustation/lc13_machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,187 @@
playsound(get_turf(src), 'sound/machines/pda_button2.ogg', 50, TRUE)
updateUsrDialog()
return TRUE

/*---------------\
|Torso Fabricator|
\---------------*/
#define ANIMATE_FABRICATOR_ACTIVE flick("fab_robot_a", src)
/*
* When someone who has the time to convert tegu cloners
* into ours you can remove this code. -IP
*/
/obj/machinery/body_fabricator
name = "torso fabricator"
desc = "A fabricator for constructing humanoid bodies for the bodiless. Place a brain inside and activate! -NO REFUNDS-."
icon = 'icons/mob/hivebot.dmi'
icon_state = "fab_robot"
density = TRUE
layer = BELOW_OBJ_LAYER
use_power = NO_POWER_USE
var/active = FALSE
var/stored_money = 0
var/prosthetic_cost = 300
var/organic_cost = 1200
var/obj/item/organ/brain/slotted_brain
var/obj/item/bodypart/head/slotted_head

/obj/machinery/body_fabricator/attackby(obj/item/I, mob/user)
if(istype(I, /obj/item/holochip))
var/obj/item/holochip/H = I
var/ahn_amount = H.get_item_credit_value()
H.spend(ahn_amount)
AdjustMoney(ahn_amount)
return

if(!slotted_head || !slotted_brain)
if(istype(I, /obj/item/bodypart/head))
var/obj/item/bodypart/head/heed = I
if(heed.brain)
SlottedHead(heed)

if(istype(I, /obj/item/mmi))
var/obj/item/mmi/case = I
if(case.brainmob)
SlottedBrain(case.brainmob)

if(istype(I, /obj/item/organ/brain))
var/obj/item/organ/brain/B = I
SlottedBrain(B)
..()

/obj/machinery/body_fabricator/ui_interact(mob/user)
. = ..()
if(isliving(user))
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, FALSE)
var/dat
dat += "<b>FABRICATION_FUNDS: [stored_money]</b><br>----------------------<br>"
if(slotted_head || slotted_brain)
if(slotted_brain)
dat += "BRAIN DETECTED|<br>--<br>"
if(slotted_head)
dat += "HEAD DETECTED|<br>--<br>"
dat += " <A href='byond://?src=[REF(src)];PRINT_PROSTHETIC=[REF(src)]'>PRINT PROSTHETIC TORSO: [prosthetic_cost] AHN:</A><br>"
dat += " Areas of the body have been replaced with scrap prosthetics. Clients have claimed to suffer a small attribute decrease.<br>"
dat += " <A href='byond://?src=[REF(src)];PRINT_ORGANIC=[REF(src)]'>PRINT ORGANIC TORSO: [organic_cost] AHN</A><br>"
dat += " Through undisclosed means we will print you a new torso with no attribute decay.<br>"
else
dat += "<b>NO HEAD OR BRAIN DETECTED|</b><br>--<br>"
var/datum/browser/popup = new(user, "body_fab", "body fabricator", 500, 550)
popup.set_content(dat)
popup.open()
return

/obj/machinery/body_fabricator/Topic(href, href_list)
. = ..()
if(.)
return .
if(ishuman(usr))
usr.set_machine(src)
add_fingerprint(usr)
if(href_list["PRINT_PROSTHETIC"])
if(stored_money < prosthetic_cost)
return
ConstructTorso(2)
AdjustMoney(-prosthetic_cost)
updateUsrDialog()
return TRUE
if(href_list["PRINT_ORGANIC"])
if(stored_money < organic_cost)
return
ConstructTorso(1)
AdjustMoney(-organic_cost)
updateUsrDialog()
return TRUE

/obj/machinery/body_fabricator/proc/AdjustMoney(amount)
stored_money += amount

/*
* In Library of Ruina there is a fixer that has their body
* damaged by clowns so their coworkers behead them and take
* them to get a new body cloned for them. That is the
* inspiration for the torso fabricator.
*/
/obj/machinery/body_fabricator/proc/SlottedBrain(obj/item/organ/brain/B)
if(slotted_brain)
return FALSE
slotted_brain = B
B.forceMove(src)
return TRUE

/obj/machinery/body_fabricator/proc/SlottedHead(obj/item/bodypart/head/H)
if(slotted_head)
return FALSE
slotted_head = H
H.forceMove(src)
if(H.brain)
slotted_brain = H.brain
return TRUE

/*
* Okay so when your gibbed your head contains your brainmob
* but when your brain is cut out of the head the brain now
* contains the brainmob. The brainmob is the one who has
* the previous owners dna stored in it.
*/
/obj/machinery/body_fabricator/proc/ConstructTorso(biotype = 1)
playsound(get_turf(src), 'sound/machines/click.ogg', 10, TRUE)
var/mob/living/carbon/human/H = new /mob/living/carbon/human(src)
//YOU DIDNT PAY FOR LIMBS
RemoveAllLimbs(H)

//DNA TRANSFER GO!!!
if(slotted_brain)
var/mob/living/brain/B = locate(/mob/living/brain) in slotted_brain
if(slotted_head)
B = slotted_head.brainmob
var/datum/dna/gibbed_dna = B.stored_dna
if(gibbed_dna)
gibbed_dna.transfer_identity(H)

//LIMB ATTACHMENT
if(!H.get_bodypart(BODY_ZONE_HEAD))
if(slotted_head)
slotted_head.attach_limb(H)
else
slotted_head = new /obj/item/bodypart/head(src)

//BRAIN INSERTION
if(slotted_brain)
slotted_brain.Insert(H)

//YOU DIDNT PAY FOR PREMIUM SO WE ARE MAKING YOUR BODY WORSE
if(biotype == 2)
RoboticizeBody(H)
H.adjust_all_attribute_levels(-5)
H.updateappearance()
DumpBody(H)

/obj/machinery/body_fabricator/proc/RoboticizeBody(mob/living/carbon/human/H)
var/obj/item/bodypart/chest/robot/robobody = new /obj/item/bodypart/chest/robot(src)
if(!slotted_head)
var/obj/item/bodypart/head/robot/robohead = new /obj/item/bodypart/head/robot(src)
robohead.attach_limb(H)
var/refuse = H.get_bodypart(BODY_ZONE_CHEST)
robobody.replace_limb(H)
qdel(refuse)

/obj/machinery/body_fabricator/proc/RemoveAllLimbs(mob/living/carbon/human/H)
var/static/list/zones = list(BODY_ZONE_HEAD, BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_R_LEG, BODY_ZONE_L_LEG)
for(var/zone in zones)
var/obj/item/bodypart/BP = H.get_bodypart(zone)
if(BP)
BP.drop_limb()
qdel(BP)

/obj/machinery/body_fabricator/proc/DumpBody(mob/living/carbon/human/dude)
slotted_head = null
slotted_brain = null
ANIMATE_FABRICATOR_ACTIVE
playsound(get_turf(src), 'sound/effects/cashregister.ogg', 35, 3, 3)
sleep(32)
playsound(get_turf(src), 'sound/effects/bin_close.ogg', 35, 3, 3)
playsound(get_turf(src), 'sound/misc/splort.ogg', 35, 3, 3)
dude.forceMove(get_turf(src))

#undef ANIMATE_FABRICATOR_ACTIVE
Binary file modified icons/mob/hivebot.dmi
Binary file not shown.

0 comments on commit a2da73e

Please sign in to comment.