08-03-2018, 12:52 PM
(This post was last modified: 09-13-2018, 03:22 PM by kyle2143. Edited 6 times in total.
Edit Reason: More Detail
)
Okay, this is a long time coming, and there's a bunch of stuff in this patch, I'll outline it here. I'm calling it finished, but there are still some things that "technically" need doing. Mostly the Cyber Organ functions and such. When I originally set out to do this project I wasn't even thinking about Cyber Organs, but about halfway through I decided to put them in. But I didn't really have any idea what sort of function most of them should have. So I figure I can field some ideas here or if someone wants to contribute, they can add a function to the organ's(There's not much too it, unless you want to get really fancy).
This patch adds in functionality/surgery for all organs that currently existed in organ.dm for which there were sprites. Here are all the ones I've added and a summary of their attached functionality:
- Liver - Supposed to allow for "metabolizing" toxins. To simulate this, Liver takes damage based on tox damage taken. If it "dies" then you start taking tox damage perpetually until replaced and depletion rates of chems slows.
- Kidneys - Basically the same as the Liver, both need to die for you to experience the bad effects.
- Pancreas - Produces insulin in response to sugar in the bloodstream
- Spleen - Needed for natural blood regeneration.
- Lungs - Needed to breath and for stamina. Losing one drastically lowers stamina and you'll gasp every so often. Losing both, you'll have basically no stamina and die after a minute or two with no aid.
- Appendix - Does nothing, but there is a minor random event that can afflict someone with appendicitis.
- Stomach & Intestines -does nothing currently. mbc said he'd possibly tie them into the motive system.
Surgery
All of these organs are operable. I had to weirdly work in the current surgery system, which was tough. Code wise all of it changes the op_stage of the chest area. Here is the tree to see how it works. The video also shows it in action.
//this exists in the code, just leaving it here
------------------------------------------------------------------------------------
chest op_stage description
snip = surgical scissors/garden snips
op_stage = (actions you can take) -> where it will send you
0.0 = snip -> 1.0 || cut -> 5.0
1.0 = snip -> 3.0 || cut -> 4.0 || (G)saw -> 2.0
2.0 = cut is remove lungs R/L
3.0 = snip is remove appendix || cut is remove liver
4.0 = snip is remove stomach || cut is remove intestines
5.0 = snip -> 6.0 || cut -> 7.0 || saw -> 8.0
6.0 = snip is remove pancreas || cut is remove spleen
7.0 = snip is remove kidneys
8.0 = cut -> 9.0
9.0 = saw is remove heart
remove lungs = snip -> saw -> snip -> Right/Left hands for removing R/L lungs -
remove appendix = snip -> snip -> snip -
remove liver = snip -> snip -> cut -
remove stomach = snip -> cut -> snip -
remove intestines = snip -> cut -> cut -
remove pancreas = cut -> snip -> snip -
remove spleen = cut -> snip -> cut -
remove kidneys = cut -> cut -> snip -> Right/Left hands for removing R/L kidneys -
remove heart = 0.0 cut -> 5.0 saw -> 8.0 cut -> 9.0 saw//Also with these, you need to "close up" by suturing the chest after you get to the end path before going down another path.
--------------------------------------------------------------------------------------------------------
video demos:
surgery - https://streamable.com/ky3rn
organ functions - https://streamable.com/wu0ck
organ damage and failure diseases - https://streamable.com/s3vpn
EDIT: also, I forgot to say. Sundance has kindly agreed to make some cyber organ sprites for this, they're almost all done, but I'm gonna add them all in at once when they are. So they aren't in yet.
----------------------------------------------------------------------
More description:
- So it looks like there are a lot of new lines of code because of this and I feel bad about it, but there isn't much I can do about it. The bulk of it comes from organ.dm, surgery.dm, human.dm, and the new organ failure diseases in code/datums/diseases/organ_diseases. For most of this, I didn't really see any way around it, I was trying to stick with the current conventions for new organs to add, which means a tonne of lines in organ.dm and surgery.
- Stamina changes due to lungs VS current cyber heart stamina changes. So I wrote this annoying proc called handle_lungs_stamina() in organs.dm that adds stamina modifiers and removes them based on the number of lungs. The cyber heart doesn't have anything like that. When a cyber heart is added to a human, the human gets that stamina buff, when they lose that heart, they lose the debuff. Period. It doesn't matter if the heart is broken or the patient has flatlined, its human has that stamina buff as long as the heart is in their body. But with my new organs, a lung can get damaged enough so that it does not function anymore and when that happens I wanted their stamina to suffer. Because of this constraint I imposed on myself for this organ system it's going to have to check the number of lungs each life tick and change the stamina correspondingly. And that sounded intensive to be adding and removing stamina each tick, so the proc just checks if the number of working lungs changes and it does THEN AND ONLY THEN does it change the stamina modifiers. So it's really doing a much less intensive process each life tick, though I guess it could be improved efficiency wise by doing this every 10 or 20 life ticks or something.
--------------------------------------------------------------------
What is unfinished:
- Flavour text for some surgery steps and disease effects. This stuff I kinda just stopped on, but they usually say something. I don't know enough about medicine IRL to make it sound accurate so i just settled for ridiculous or generic stuff. Updated flavor text, things look unique and I think OK. It's the best I can do.
- Functions for cyber appendix/pancreas/spleen/kidneys. I didn't know what interesting stuff could be done with these so they'll exist, but not do anything other than a normal organ. EXCEPT all cyber organs take damage from EMP's.
- Maybe a recipe for chemistry crafting the organ healing drugs. Right now they just dispense from medical vendomats.
- Some other unexpected ways to injure organs. Currently there is stuff like drinking too much or eating too much sugar, or smoking. But there should be some other ways that can cause damage, I kind of wanted some secret ones, or ones that weren't obvious, but maybe that's asking too much. I stopped where I did because I felt like I'd be making a tonne of single line changes everywhere and that would get so cluttered.
- Like Zewaka said, gotta clean up some useless extra lines and stuff. Removed useless extra lines and issues.
- Also, I don't know if I should call this next part "Unfinished", but this new organ system is not used by the heart, brain, or butt organs. This was intentional on my end, for one thing, in my patches I usually want to try to change as little existing code as possible and rewriting the heart/brain surgery health/diseases to fit with these new non-vital organ additions would just make it terrible to merge.
https://github.com/goonstation/goonstati...l/73/files
This patch adds in functionality/surgery for all organs that currently existed in organ.dm for which there were sprites. Here are all the ones I've added and a summary of their attached functionality:
- Liver - Supposed to allow for "metabolizing" toxins. To simulate this, Liver takes damage based on tox damage taken. If it "dies" then you start taking tox damage perpetually until replaced and depletion rates of chems slows.
- Kidneys - Basically the same as the Liver, both need to die for you to experience the bad effects.
- Pancreas - Produces insulin in response to sugar in the bloodstream
- Spleen - Needed for natural blood regeneration.
- Lungs - Needed to breath and for stamina. Losing one drastically lowers stamina and you'll gasp every so often. Losing both, you'll have basically no stamina and die after a minute or two with no aid.
- Appendix - Does nothing, but there is a minor random event that can afflict someone with appendicitis.
- Stomach & Intestines -does nothing currently. mbc said he'd possibly tie them into the motive system.
Surgery
All of these organs are operable. I had to weirdly work in the current surgery system, which was tough. Code wise all of it changes the op_stage of the chest area. Here is the tree to see how it works. The video also shows it in action.
//this exists in the code, just leaving it here
------------------------------------------------------------------------------------
chest op_stage description
snip = surgical scissors/garden snips
op_stage = (actions you can take) -> where it will send you
0.0 = snip -> 1.0 || cut -> 5.0
1.0 = snip -> 3.0 || cut -> 4.0 || (G)saw -> 2.0
2.0 = cut is remove lungs R/L
3.0 = snip is remove appendix || cut is remove liver
4.0 = snip is remove stomach || cut is remove intestines
5.0 = snip -> 6.0 || cut -> 7.0 || saw -> 8.0
6.0 = snip is remove pancreas || cut is remove spleen
7.0 = snip is remove kidneys
8.0 = cut -> 9.0
9.0 = saw is remove heart
remove lungs = snip -> saw -> snip -> Right/Left hands for removing R/L lungs -
remove appendix = snip -> snip -> snip -
remove liver = snip -> snip -> cut -
remove stomach = snip -> cut -> snip -
remove intestines = snip -> cut -> cut -
remove pancreas = cut -> snip -> snip -
remove spleen = cut -> snip -> cut -
remove kidneys = cut -> cut -> snip -> Right/Left hands for removing R/L kidneys -
remove heart = 0.0 cut -> 5.0 saw -> 8.0 cut -> 9.0 saw//Also with these, you need to "close up" by suturing the chest after you get to the end path before going down another path.
--------------------------------------------------------------------------------------------------------
video demos:
surgery - https://streamable.com/ky3rn
organ functions - https://streamable.com/wu0ck
organ damage and failure diseases - https://streamable.com/s3vpn
EDIT: also, I forgot to say. Sundance has kindly agreed to make some cyber organ sprites for this, they're almost all done, but I'm gonna add them all in at once when they are. So they aren't in yet.
----------------------------------------------------------------------
More description:
- So it looks like there are a lot of new lines of code because of this and I feel bad about it, but there isn't much I can do about it. The bulk of it comes from organ.dm, surgery.dm, human.dm, and the new organ failure diseases in code/datums/diseases/organ_diseases. For most of this, I didn't really see any way around it, I was trying to stick with the current conventions for new organs to add, which means a tonne of lines in organ.dm and surgery.
- Stamina changes due to lungs VS current cyber heart stamina changes. So I wrote this annoying proc called handle_lungs_stamina() in organs.dm that adds stamina modifiers and removes them based on the number of lungs. The cyber heart doesn't have anything like that. When a cyber heart is added to a human, the human gets that stamina buff, when they lose that heart, they lose the debuff. Period. It doesn't matter if the heart is broken or the patient has flatlined, its human has that stamina buff as long as the heart is in their body. But with my new organs, a lung can get damaged enough so that it does not function anymore and when that happens I wanted their stamina to suffer. Because of this constraint I imposed on myself for this organ system it's going to have to check the number of lungs each life tick and change the stamina correspondingly. And that sounded intensive to be adding and removing stamina each tick, so the proc just checks if the number of working lungs changes and it does THEN AND ONLY THEN does it change the stamina modifiers. So it's really doing a much less intensive process each life tick, though I guess it could be improved efficiency wise by doing this every 10 or 20 life ticks or something.
--------------------------------------------------------------------
What is unfinished:
- Flavour text for some surgery steps and disease effects. This stuff I kinda just stopped on, but they usually say something. I don't know enough about medicine IRL to make it sound accurate so i just settled for ridiculous or generic stuff. Updated flavor text, things look unique and I think OK. It's the best I can do.
- Functions for cyber appendix/pancreas/spleen/kidneys. I didn't know what interesting stuff could be done with these so they'll exist, but not do anything other than a normal organ. EXCEPT all cyber organs take damage from EMP's.
- Maybe a recipe for chemistry crafting the organ healing drugs. Right now they just dispense from medical vendomats.
- Some other unexpected ways to injure organs. Currently there is stuff like drinking too much or eating too much sugar, or smoking. But there should be some other ways that can cause damage, I kind of wanted some secret ones, or ones that weren't obvious, but maybe that's asking too much. I stopped where I did because I felt like I'd be making a tonne of single line changes everywhere and that would get so cluttered.
- Like Zewaka said, gotta clean up some useless extra lines and stuff. Removed useless extra lines and issues.
- Also, I don't know if I should call this next part "Unfinished", but this new organ system is not used by the heart, brain, or butt organs. This was intentional on my end, for one thing, in my patches I usually want to try to change as little existing code as possible and rewriting the heart/brain surgery health/diseases to fit with these new non-vital organ additions would just make it terrible to merge.
https://github.com/goonstation/goonstati...l/73/files