From f6d8d91c1077977010c738a00c9608d5583d1e45 Mon Sep 17 00:00:00 2001 From: NiceNiceSwan Date: Mon, 28 Apr 2025 13:22:53 +0200 Subject: [PATCH] added belt busting helplessness pref and it's interactions with the primitive belt --- GainStation13/code/mechanics/helplessness.dm | 11 ++ .../modules/client/preferences/preferences.dm | 2 + .../code/modules/mob/living/species.dm | 24 ++++ .../code/obj/items/bluespace_belt.dm | 107 ++++++++++++------ code/__DEFINES/traits.dm | 1 + code/modules/client/preferences.dm | 5 + code/modules/client/preferences_savefile.dm | 2 + 7 files changed, 118 insertions(+), 34 deletions(-) diff --git a/GainStation13/code/mechanics/helplessness.dm b/GainStation13/code/mechanics/helplessness.dm index 317e674744..9e647b0722 100644 --- a/GainStation13/code/mechanics/helplessness.dm +++ b/GainStation13/code/mechanics/helplessness.dm @@ -16,6 +16,17 @@ if(!mod_check(I) && HAS_TRAIT(H, TRAIT_NO_MISC) && (slot == ITEM_SLOT_FEET || slot ==ITEM_SLOT_GLOVES || slot == ITEM_SLOT_OCLOTHING)) to_chat(H, "You are too fat to wear [I].") return FALSE + + if(HAS_TRAIT(H, TRAIT_NO_BELT) && slot == ITEM_SLOT_BELT) + if(istype(I, /obj/item/bluespace_belt/primitive) && H?.client?.prefs.helplessness_belts*2 > H.fatness) + return ..() + + if(istype(I, /obj/item/bluespace_belt) && !istype(I, /obj/item/bluespace_belt/primitive)) + return ..() + + to_chat(H, "You are too fat to wear [I].") + return FALSE + return ..() diff --git a/GainStation13/code/modules/client/preferences/preferences.dm b/GainStation13/code/modules/client/preferences/preferences.dm index 3ad11a65e4..d8ce7cf670 100644 --- a/GainStation13/code/modules/client/preferences/preferences.dm +++ b/GainStation13/code/modules/client/preferences/preferences.dm @@ -56,6 +56,8 @@ var/helplessness_clothing_jumpsuit = FALSE ///What fatness level prevents the user from wearing non-jumpsuit clothing var/helplessness_clothing_misc = FALSE + // What fatness level prevents the user from wearing belts. Also affects the max weight the PBS Belt can hide + var/helplessness_belts = FALSE ///What fatness level prevents the user from wearing anything on their back var/helplessness_clothing_back = FALSE ///What fatness level prevents the user from being buckled to anything? diff --git a/GainStation13/code/modules/mob/living/species.dm b/GainStation13/code/modules/mob/living/species.dm index 12fff6fc92..e2e759c373 100644 --- a/GainStation13/code/modules/mob/living/species.dm +++ b/GainStation13/code/modules/mob/living/species.dm @@ -196,6 +196,30 @@ REMOVE_TRAIT(fatty, TRAIT_NO_MISC, HELPLESSNESS_TRAIT) + if(preferences.helplessness_belts) + if(!HAS_TRAIT_FROM(fatty, TRAIT_NO_BELT, HELPLESSNESS_TRAIT)) + if(fatty.fatness >= preferences.helplessness_belts) + ADD_TRAIT(fatty, TRAIT_NO_BELT, HELPLESSNESS_TRAIT) + + // if(istype(fatty.belt, /obj/item/bluespace_belt)) + var/obj/item/bluespace_belt/primitive/PBS_belt = fatty.belt + if(istype(PBS_belt)) + to_chat(fatty, "[PBS_belt] can no longer contain your weight!") + fatty.dropItemToGround(PBS_belt) + + var/obj/item/storage/belt/belt = fatty.belt + if(istype(belt)) + to_chat(fatty, "[belt] can no longer contain your weight!") + fatty.dropItemToGround(belt) + + else if(fatty.fatness < preferences.helplessness_belts) + to_chat(fatty, "You feel thin enough to put on belts now. ") + REMOVE_TRAIT(fatty, TRAIT_NO_BELT, HELPLESSNESS_TRAIT) + + else + if(HAS_TRAIT_FROM(fatty, TRAIT_NO_BELT, HELPLESSNESS_TRAIT)) + REMOVE_TRAIT(fatty, TRAIT_NO_BELT, HELPLESSNESS_TRAIT) + if(preferences.helplessness_clothing_back) if(!HAS_TRAIT_FROM(fatty, TRAIT_NO_BACKPACK, HELPLESSNESS_TRAIT)) if(fatty.fatness >= preferences.helplessness_clothing_back) diff --git a/GainStation13/code/obj/items/bluespace_belt.dm b/GainStation13/code/obj/items/bluespace_belt.dm index ae11e1d157..e252638411 100644 --- a/GainStation13/code/obj/items/bluespace_belt.dm +++ b/GainStation13/code/obj/items/bluespace_belt.dm @@ -48,6 +48,7 @@ var/maximum_power_drain = 100 var/fatness_to_power_coefficient = 68 // FATNESS_LEVEL_BLOB*2 BFI divided by this equals 100, our maximum power drain var/mob/living/carbon/user // the fatass who's weight we must track for power drain calcs + var/overloaded = FALSE // is it EMP'ed? /obj/item/bluespace_belt/primitive/examine(mob/user) . = ..() @@ -63,49 +64,76 @@ /obj/item/bluespace_belt/primitive/emp_act(severity) . = ..() - STOP_PROCESSING(SSprocessing, src) + if(cell && !(. & EMP_PROTECT_CONTENTS)) cell.emp_act(severity) - - icon_state = "primitive_belt_off" - if(!isnull(user)) - user.hider_remove(src) - to_chat(loc, "\The [src] overloads!") - + + overloaded = TRUE + to_chat(loc, "\The [src] overloads!") + deactivate() addtimer(CALLBACK(src, PROC_REF(emp_act_end)), severity*10, TIMER_UNIQUE | TIMER_NO_HASH_WAIT | TIMER_OVERRIDE) /obj/item/bluespace_belt/primitive/proc/emp_act_end() - if(!isnull(user)) + overloaded = FALSE + activate() + +/obj/item/bluespace_belt/primitive/proc/activate() + if (overloaded) + deactivate() + return + + if(!cell) + deactivate() + return + + if(!cell.charge) + deactivate() + return + + if(!isnull(user) && equipped) user.hider_add(src) + icon_state = "primitive_belt" START_PROCESSING(SSprocessing, src) +/obj/item/bluespace_belt/primitive/proc/deactivate() + if(!isnull(user)) + user.hider_remove(src) + + STOP_PROCESSING(SSprocessing, src) + icon_state = "primitive_belt_off" + +/obj/item/bluespace_belt/primitive/fat_hide(var/mob/living/carbon/user) + var/belts_pref = user?.client?.prefs.helplessness_belts + var/weight_to_hide = min(belts_pref, user.fatness_real - 1) + return -(weight_to_hide) + /obj/item/bluespace_belt/primitive/equipped(mob/U, slot) ..() if(!iscarbon(U)) user = null return + user = U - START_PROCESSING(SSprocessing, src) if(slot == ITEM_SLOT_BELT && !cell) equipped = TRUE to_chat(user, "You put the belt around your waist, but it seems that the battery is missing!") - user.hider_remove(src) + deactivate() else if(slot == ITEM_SLOT_BELT && !cell.charge) equipped = TRUE to_chat(user, "You put the belt around your waist, but it seems that the battery is dead!") - user.hider_remove(src) + deactivate() else if(slot == ITEM_SLOT_BELT && cell.charge) equipped = TRUE to_chat(user, "You put the belt around your waist and your mass begins to shrink...") - user.hider_add(src) + activate() else if(equipped) equipped = FALSE to_chat(user, "The belt is opened, letting your mass flow out!") user.hider_remove(src) - user = null + // user = null /obj/item/bluespace_belt/primitive/attackby(obj/item/W, mob/person) if (istype(W, /obj/item/stock_parts/cell)) @@ -118,17 +146,27 @@ person.put_in_hands(cell) cell = W - if (cell.charge) - icon_state = "primitive_belt" - else - icon_state = "primitive_belt_off" + // if (cell.charge) + // icon_state = "primitive_belt" + // else + // icon_state = "primitive_belt_off" - START_PROCESSING(SSprocessing, src) + // START_PROCESSING(SSprocessing, src) - if (equipped) + // if(cell.charge) + // if(equipped) + // to_chat(person, "Your mass begins to shrink as the belt is powered again...") + // user = person + // activate() + + + + if (equipped && cell.charge) to_chat(person, "Your mass begins to shrink as the belt is powered again...") user = person - user.hider_add(src) + + // // user.hider_add(src) + activate() @@ -136,15 +174,14 @@ if (!cell) return - if(!isnull(user)) - user.hider_remove(src) + // if(!isnull(user)) + // user.hider_remove(src) to_chat(person, "You take the cell out of the belt, letting your mass flow out!") - icon_state = "primitive_belt_off" - user = null person.put_in_hands(cell) cell = null - STOP_PROCESSING(SSprocessing, src) + deactivate() + // user = null /obj/item/bluespace_belt/primitive/AltClick(mob/person) . = ..() @@ -152,15 +189,16 @@ if (!cell) return - if(!isnull(user)) - user.hider_remove(src) + // if(!isnull(user)) + // user.hider_remove(src) to_chat(person, "You take the cell out of the belt, letting your mass flow out!") - icon_state = "primitive_belt_off" - user = null + // icon_state = "primitive_belt_off" + // user = null person.put_in_hands(cell) cell = null - STOP_PROCESSING(SSprocessing, src) + // STOP_PROCESSING(SSprocessing, src) + deactivate() /obj/item/bluespace_belt/primitive/dropped(mob/person) @@ -175,11 +213,12 @@ return if (!cell.charge) - icon_state = "primitive_belt_off" - user.hider_remove(src) + // icon_state = "primitive_belt_off" + // user.hider_remove(src) to_chat(user, "The belt beeps as it's battery runs out, and your mass starts flowing out!") - user = null - STOP_PROCESSING(SSprocessing, src) + // user = null + // STOP_PROCESSING(SSprocessing, src) + deactivate() return diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index 98d5205a20..9f36dc0b92 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -254,6 +254,7 @@ #define TRAIT_NO_MOVE "no_move" #define TRAIT_NO_JUMPSUIT "no_jumpsuit" #define TRAIT_NO_MISC "no_misc" +#define TRAIT_NO_BELT "no_belt" #define TRAIT_NO_BACKPACK "no_backpack" #define TRAIT_NO_BUCKLE "no_buckle" #define TRAIT_DOCILE "docile" diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 3cb2e1c7ce..f70c97c512 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -343,6 +343,8 @@ GLOBAL_LIST_EMPTY(preferences_datums) helplessness_clothing_back = 0 if(isnull(helplessness_clothing_jumpsuit)) helplessness_clothing_jumpsuit = 0 + if(isnull(helplessness_belts)) + helplessness_belts = 0 if(isnull(helplessness_hidden_face)) helplessness_hidden_face = 0 if(isnull(helplessness_mute)) @@ -1452,6 +1454,7 @@ GLOBAL_LIST_EMPTY(preferences_datums) dat += "Immobile Arms:[helplessness_immobile_arms == FALSE ? "Disabled" : helplessness_immobile_arms]
" dat += "Clothing Jumpsuit:[helplessness_clothing_jumpsuit == FALSE ? "Disabled" : helplessness_clothing_jumpsuit]
" dat += "Clothing, Suit, Boots, and Gloves:[helplessness_clothing_misc == FALSE ? "Disabled" : helplessness_clothing_misc]
" + dat += "Belts:[helplessness_belts == FALSE ? "Disabled" : helplessness_belts]
" dat += "Clothing Back:[helplessness_clothing_back == FALSE ? "Disabled" : helplessness_clothing_back]
" dat += "No Buckle:[helplessness_no_buckle == FALSE ? "Disabled" : helplessness_no_buckle]
" dat += "" @@ -3542,6 +3545,8 @@ GLOBAL_LIST_EMPTY(preferences_datums) helplessness_clothing_jumpsuit = chose_weight("Choose the level of fatness that you would like to be made unable to wear jumpsuits at. None will disable this alltogether", user) if("helplessness_clothing_misc") helplessness_clothing_misc = chose_weight("Choose the level of fatness that you would like to be made unable to wear other non-jumpsuit clothing at. None will disable this alltogether", user) + if("helplessness_belts") + helplessness_belts = chose_weight("Choose the level of fatness that you would like to be made unable to wear belts at. This also affects how much weight the Primitive Bluespace Belt can hide. None will disable this alltogether", user) if("helplessness_clothing_back") helplessness_clothing_back = chose_weight("Choose the level of fatness that you would like to be made unable to wear anything on your back at. None will disable this alltogether", user) if("helplessness_no_buckle") diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 4bf91a6e0f..2836b6d7b7 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -949,6 +949,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car S["helplessness_immobile_arms"] >> helplessness_immobile_arms S["helplessness_clothing_jumpsuit"] >> helplessness_clothing_jumpsuit S["helplessness_clothing_misc"] >> helplessness_clothing_misc + S["helplessness_belts"] >> helplessness_belts S["helplessness_clothing_back"] >> helplessness_clothing_back S["helplessness_no_buckle"] >> helplessness_no_buckle S["stuckage"] >> stuckage @@ -1245,6 +1246,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car WRITE_FILE(S["helplessness_immobile_arms"], helplessness_immobile_arms) WRITE_FILE(S["helplessness_clothing_jumpsuit"], helplessness_clothing_jumpsuit) WRITE_FILE(S["helplessness_clothing_misc"], helplessness_clothing_misc) + WRITE_FILE(S["helplessness_belts"], helplessness_belts) WRITE_FILE(S["helplessness_clothing_back"], helplessness_clothing_back) WRITE_FILE(S["helplessness_no_buckle"], helplessness_no_buckle) WRITE_FILE(S["stuckage"], stuckage)