Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CONDENSER IMPLANT (bounty) #736

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
6 changes: 6 additions & 0 deletions modular_splurt/code/modules/client/loadout/backpack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,9 @@
/datum/gear/backpack/towel
name = "Towel"
path = /obj/item/reagent_containers/rag/towel

/datum/gear/backpack/condenser
name = "A condenser"
path = /obj/item/autosurgeon/condenser
cost = 7

102 changes: 102 additions & 0 deletions modular_splurt/code/modules/surgery/organs/augments_internal.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@



/obj/item/organ/cyberimp/brain/condenser
name = "condenser implant"
desc = "This cybernetic brain implant will allow you to force your hand muscles to contract, preventing item dropping. Twitch ear to toggle."
implant_color = "#DE7E00"
slot = ORGAN_SLOT_BRAIN_ANTIDROP
actions_types = list(/datum/action/item_action/organ_action/toggle)
var/datum/condenser_implant/condenser/condenser
var/on = 0
var/wanted_size = 30

/obj/item/organ/cyberimp/brain/condenser/New()
..()
condenser = new(null, src)

/obj/item/organ/cyberimp/brain/condenser/ui_action_click()
condenser.ui_interact(usr)

/datum/condenser_implant/condenser
var/obj/item/organ/cyberimp/brain/condenser/FATHER = null

/datum/condenser_implant/condenser/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "Condenser", "Condenser")
ui.open()

/datum/condenser_implant/condenser/New(mob/viewer, obj/item/organ/cyberimp/brain/condenser/objectA)
FATHER = objectA
ui_interact(viewer)

/datum/condenser_implant/ui_state(mob/user)
return GLOB.conscious_state

/datum/condenser_implant/condenser/ui_act(action, params)
if(..())
return
switch(action)
if("condenser")
FATHER.on = !FATHER.on
. = TRUE
if("size")
var/sent_value = params["size"]
FATHER.wanted_size = sent_value
. = TRUE

/datum/condenser_implant/condenser/ui_data(mob/user)
if(!ishuman(user))
return
var/list/data = list()
var/mob/living/carbon/human/H = user
var/obj/item/organ/genital/penis/P = null
var/obj/item/organ/genital/testicles/T = null
var/obj/item/organ/genital/breasts/B = null

for(var/obj/item/organ/genital/penis/PP in H.internal_organs)
P = PP
for(var/obj/item/organ/genital/testicles/TT in H.internal_organs)
T = TT
for(var/obj/item/organ/genital/breasts/BB in H.internal_organs)
B = BB


data["on"] = FATHER.on
data["wanted_size"] = FATHER.wanted_size
if(FATHER.on)
if(P)
P.length = max(FATHER.wanted_size, 1)
if(T)
T.size = clamp(FATHER.wanted_size, BALLS_SIZE_MIN, BALLS_SIZE_MAX)
if(B)
B.cached_size = max(FATHER.wanted_size, 1)
else
if(P)
P.length = initial(P.prev_length)
if(B)
B.cached_size = max(FATHER.wanted_size, 1)

if(P)
if(P.length != P.prev_length)
P.update()
P.update_size()
P.get_features(user)
P.prev_length = P.length

if(T)
T.get_features(user)
T.update_appearance()
T.update_size()

if(B)
if(B.cached_size != B.prev_size)
B.update()
B.update_size()
B.get_features(user)
else
B.prev_size = B.cached_size

return data

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is all of this in ui_data() though...? It would be better if it was in the ui_act() and that said proc and the js menu had better handling of setting genitals sizes through that.
I also don't see where the original sizes for the genitals are being saved so they can be returned to that size once the condenser stops targeting those genitals... or a panel to select which genitals the condenser should target at all...
For all of this, I'd recommend you code it in a similar way to how the size normalizers are coded, but instead aimed towards genitals. also it's better that you use modify_size() rather than manually setting the size of each genital and updating them. There's no need to get_features() if you do that


3 changes: 3 additions & 0 deletions modular_splurt/code/modules/surgery/organs/autosurgeon.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/obj/item/autosurgeon/condenser
starting_organ = /obj/item/organ/cyberimp/brain/condenser

2 changes: 2 additions & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -4781,6 +4781,8 @@
#include "modular_splurt\code\modules\surgery\bodyparts\_bodyparts.dm"
#include "modular_splurt\code\modules\surgery\organs\augments_arms.dm"
#include "modular_splurt\code\modules\surgery\organs\augments_eyes.dm"
#include "modular_splurt\code\modules\surgery\organs\augments_internal.dm"
#include "modular_splurt\code\modules\surgery\organs\autosurgeon.dm"
#include "modular_splurt\code\modules\surgery\organs\ears.dm"
#include "modular_splurt\code\modules\surgery\organs\eyes.dm"
#include "modular_splurt\code\modules\surgery\organs\liver.dm"
Expand Down
42 changes: 42 additions & 0 deletions tgui/packages/tgui/interfaces/Condenser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { useBackend } from '../backend';
import { Button, LabeledList, NumberInput, Section } from '../components';
import { Window } from '../layouts';

export const Condenser = (props, context) => {
const { act, data } = useBackend(context);
return (
<Window
width={335}
height={115}>
<Window.Content>
<Section>
<LabeledList>
<LabeledList.Item label="Condenser">
<Button
icon={data.on ? 'power-off' : 'times'}
content={data.on ? 'On' : 'Off'}
selected={data.on}
onClick={() => act('condenser')} />
</LabeledList.Item>

<LabeledList.Item label="Maximum Size">
<NumberInput
animated
value={parseFloat(data.wanted_size)}
unit="inches"
width="75px"
minValue={0}
maxValue={30}
step={10}
onChange={(e, value) => act('size', {
size: value,
})} />
</LabeledList.Item>

</LabeledList>
</Section>
</Window.Content>
</Window>
);
};