From eea3b928cbe05d855b7da4ad3429fb686fcec055 Mon Sep 17 00:00:00 2001 From: silicons Date: Wed, 26 Jul 2023 13:03:31 -0700 Subject: [PATCH 01/62] let's start a silicons refactor off right by refactoring something that doesn't have much connection to the actual goal at all and implement a new complex feature for no reason --- citadel.dme | 11 ++- code/__DEFINES/tgui.dm | 23 ++++- code/modules/mob/mob_defines.dm | 2 +- code/modules/mob/physiology.dm | 8 +- .../tgui/{modal_vr.dm => modal_vr_legacy.dm} | 0 code/modules/tgui/{ => modals}/tgui_alert.dm | 0 .../modules/tgui/modals/tgui_dynamic_input.dm | 98 +++++++++++++++++++ .../tgui/{ => modals}/tgui_input_list.dm | 0 .../tgui/{ => modals}/tgui_input_number.dm | 0 .../tgui/{ => modals}/tgui_input_text.dm | 0 .../interfaces/ui/UIDynamicInputModal.tsx | 73 ++++++++++++++ 11 files changed, 203 insertions(+), 12 deletions(-) rename code/modules/tgui/{modal_vr.dm => modal_vr_legacy.dm} (100%) rename code/modules/tgui/{ => modals}/tgui_alert.dm (100%) create mode 100644 code/modules/tgui/modals/tgui_dynamic_input.dm rename code/modules/tgui/{ => modals}/tgui_input_list.dm (100%) rename code/modules/tgui/{ => modals}/tgui_input_number.dm (100%) rename code/modules/tgui/{ => modals}/tgui_input_text.dm (100%) create mode 100644 tgui/packages/tgui/interfaces/ui/UIDynamicInputModal.tsx diff --git a/citadel.dme b/citadel.dme index dd1dedf03202..177e707b831f 100644 --- a/citadel.dme +++ b/citadel.dme @@ -4585,16 +4585,17 @@ #include "code\modules\tgchat\to_chat.dm" #include "code\modules\tgs\includes.dm" #include "code\modules\tgui\external.dm" -#include "code\modules\tgui\modal_vr.dm" +#include "code\modules\tgui\modal_vr_legacy.dm" #include "code\modules\tgui\module.dm" #include "code\modules\tgui\states.dm" #include "code\modules\tgui\status_composers.dm" #include "code\modules\tgui\tgui.dm" -#include "code\modules\tgui\tgui_alert.dm" -#include "code\modules\tgui\tgui_input_list.dm" -#include "code\modules\tgui\tgui_input_number.dm" -#include "code\modules\tgui\tgui_input_text.dm" #include "code\modules\tgui\tgui_window.dm" +#include "code\modules\tgui\modals\tgui_alert.dm" +#include "code\modules\tgui\modals\tgui_dynamic_input.dm" +#include "code\modules\tgui\modals\tgui_input_list.dm" +#include "code\modules\tgui\modals\tgui_input_number.dm" +#include "code\modules\tgui\modals\tgui_input_text.dm" #include "code\modules\tgui\modules\_base.dm" #include "code\modules\tgui\modules\alarm.dm" #include "code\modules\tgui\modules\atmos_control.dm" diff --git a/code/__DEFINES/tgui.dm b/code/__DEFINES/tgui.dm index bdc4055e5556..5b0c61371dcd 100644 --- a/code/__DEFINES/tgui.dm +++ b/code/__DEFINES/tgui.dm @@ -1,4 +1,4 @@ -// ui_status +//* ui_status /// Green eye; fully interactive #define UI_INTERACTIVE 2 /// Orange eye; updates but is not interactive @@ -8,7 +8,7 @@ /// UI Should close #define UI_CLOSE -1 -// refreshing var +//* refreshing var /// no refresh queued #define UI_NOT_REFRESHING 0 /// soft refreshing - can show a status, won't block viewport @@ -46,6 +46,7 @@ "%7b%22type%22%3a%22[type]%22%2c%22payload%22%3a[url_encode(json_encode(payload))]%7d" \ ) +//* Legacy Modal Stuff /// Max length for Modal Input #define UI_MODAL_INPUT_MAX_LENGTH 1024 @@ -56,3 +57,21 @@ #define UI_MODAL_DELEGATE 2 #define UI_MODAL_ANSWER 3 #define UI_MODAL_CLOSE 4 + +//* tgui dynamic input +//* all constraints must be specified if it is included. + +#define TGUI_INPUT_DATA_KEY "key" +#define TGUI_INPUT_DATA_TYPE "type" +#define TGUI_INPUT_DATA_NAME "name" +#define TGUI_INPUT_DATA_CONSTRAINTS "constraints" +#define TGUI_INPUT_DATA_DEFAULT "default" + +/// constraints: [maxlength] +#define TGUI_INPUT_DATATYPE_TEXT "text" +/// constraints: [min, max, round] +#define TGUI_INPUT_DATATYPE_NUM "num" +/// constraints (required): [str1, str2, ...] +#define TGUI_INPUT_DATATYPE_LIST_PICK "list_single" +/// constraints: nothing +#define TGUI_INPUT_DATATYPE_TOGGLE "bool" diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 1bdeba507663..524f79fa1e22 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -63,7 +63,7 @@ //? Physiology /// overall physiology - see physiology.dm - var/datum/physiology/physiology + var/datum/global_physiology/physiology /// physiology modifiers - see physiology.dm; set to list of paths at init to initialize into instances. var/list/datum/physiology_modifier/physiology_modifiers diff --git a/code/modules/mob/physiology.dm b/code/modules/mob/physiology.dm index 776af71edb3b..3909f19ed840 100644 --- a/code/modules/mob/physiology.dm +++ b/code/modules/mob/physiology.dm @@ -3,14 +3,14 @@ * * todo: on biologies update, we might need to lazy-cache this, and have different physiologies for each biology. */ -/datum/physiology - // todo: /datum/physiology should hold global body physiology, limbs should hold modifiers/whatever themselves. +/datum/global_physiology + // todo: /datum/global_physiology should hold global body physiology, limbs should hold modifiers/whatever themselves. // this way biologies can be supported as efficiently as possible. -/datum/physiology/proc/apply(datum/physiology_modifier/modifier) +/datum/global_physiology/proc/apply(datum/physiology_modifier/modifier) // todo: modifier/apply_global, modifier/apply_bodypart -/datum/physiology/proc/revert(datum/physiology_modifier/modifier) +/datum/global_physiology/proc/revert(datum/physiology_modifier/modifier) // todo: modifier/apply_global, modifier/apply_bodypart /** diff --git a/code/modules/tgui/modal_vr.dm b/code/modules/tgui/modal_vr_legacy.dm similarity index 100% rename from code/modules/tgui/modal_vr.dm rename to code/modules/tgui/modal_vr_legacy.dm diff --git a/code/modules/tgui/tgui_alert.dm b/code/modules/tgui/modals/tgui_alert.dm similarity index 100% rename from code/modules/tgui/tgui_alert.dm rename to code/modules/tgui/modals/tgui_alert.dm diff --git a/code/modules/tgui/modals/tgui_dynamic_input.dm b/code/modules/tgui/modals/tgui_dynamic_input.dm new file mode 100644 index 000000000000..7ffd766e9a34 --- /dev/null +++ b/code/modules/tgui/modals/tgui_dynamic_input.dm @@ -0,0 +1,98 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2023 Citadel Station developers. *// + +/** + * Creates a TGUI input window and returns the user's response + * + * This is used to grab a set of responses to various datatypes. + * This proc blocks until finished. + * + * @params + * * user - who to send this to + * * message - description in interface + * * title - self explanatory + * * query - structured list of input items (see TGUI_INPUT_DATA_* defines) as list(list(data...), ...) + * * timeout - timeout before menu closes. if it times out, choices will be null. + * * sanitize - perform sanitize in this proc instead of trusting caller to do it + * + * @return list of key-value pairs (TGUI_INPUT_DATA_KEY) associated to values + */ +/proc/tgui_dynamic_input(mob/user, message, title = "Input", list/query, timeout = 0, sanitize = FALSE) + #warn impl + +/** + * Creates a TGUI input window and returns the user's response + * + * This is used to grab a set of responses to various datatypes. + * This proc immediately returns. + * + * @params + * * user - who to send this to + * * message - description in interface + * * title - self explanatory + * * query - structured list of input items (see TGUI_INPUT_DATA_* defines) as list(list(data...), ...) + * * callback - callback called with first arg being the picked list when we're done. + * * sanitize - perform sanitize in this proc instead of trusting caller to do it + */ +/proc/tgui_dynamic_input_async(mob/user, message, title = "Input", list/query, sanitize = FALSE, datum/callback/callback) + #warn impl + +/datum/tgui_dynamic_input + /// title of the windo + var/title + /// message that appears inside the window + var/message + /// structured query list + var/list/query + /// list of user's choices; null if they haven't picked yet + var/list/choices + /// when we were opened + var/opened_time + /// how long our timeout is; null for infinite + var/timeout + /// did user close us yet? also set to true if we're qdeleted + var/closed + /// callback to invoke on finish + var/datum/callback/callback + /// do we sanitize? + var/sanitize + + #warn impl + +/datum/tgui_dynamic_input/New(mob/user, message, title, list/query, timeout, sanitize, datum/callback/callback) + #warn impl + +/datum/tgui_dynamic_input/Destroy() + query = null + choices = null + closed = TRUE + return ..() + +/datum/tgui_dynamic_input/ui_static_data(mob/user, datum/tgui/ui, datum/ui_state/state) + . = ..() + #warn impl + +/datum/tgui_dynamic_input/ui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui) + . = ..() + #warn impl + +/datum/tgui_dynamic_input/ui_act(action, list/params, datum/tgui/ui) + . = ..() + if(.) + return + switch(action) + if("submit") + #warn impl + if("cancel") + closed = TRUE + SStgui.close_uis(src) + return TRUE + +/datum/tgui_dynamic_input/proc/block_on_finished() + #warn impl + +/datum/tgui_dynamic_input/proc/finish(list/choices) + callback?.InvokeAsync(cohices) + +/datum/tgui_dynamic_input/proc/sanitize(list/choices) + #warn impl diff --git a/code/modules/tgui/tgui_input_list.dm b/code/modules/tgui/modals/tgui_input_list.dm similarity index 100% rename from code/modules/tgui/tgui_input_list.dm rename to code/modules/tgui/modals/tgui_input_list.dm diff --git a/code/modules/tgui/tgui_input_number.dm b/code/modules/tgui/modals/tgui_input_number.dm similarity index 100% rename from code/modules/tgui/tgui_input_number.dm rename to code/modules/tgui/modals/tgui_input_number.dm diff --git a/code/modules/tgui/tgui_input_text.dm b/code/modules/tgui/modals/tgui_input_text.dm similarity index 100% rename from code/modules/tgui/tgui_input_text.dm rename to code/modules/tgui/modals/tgui_input_text.dm diff --git a/tgui/packages/tgui/interfaces/ui/UIDynamicInputModal.tsx b/tgui/packages/tgui/interfaces/ui/UIDynamicInputModal.tsx new file mode 100644 index 000000000000..a387f6c407e5 --- /dev/null +++ b/tgui/packages/tgui/interfaces/ui/UIDynamicInputModal.tsx @@ -0,0 +1,73 @@ + +interface UIDynamicInputContext { + query: UIDynamicInputEntry[]; +} + +interface UIDynamicInputEntry { + key: string; + name: string; +} + +interface StringEntry extends UIDynamicInputEntry { + type: UIDynamicInputType.String; + constraints: StringConstraint; +} + +interface NumberEntry extends UIDynamicInputEntry { + type: UIDynamicInputType.Number; + constraints: NumberConstraint; +} + +interface PickEntry extends UIDynamicInputEntry { + type: UIDynamicInputType.ListSingle; + constraints: NumberConstraint; +} + +interface ToggleEntry extends UIDynamicInputEntry { + type: UIDynamicInputType.Toggle; + constraints: NumberConstraint; +} + +enum UIDynamicInputType { + String = "text", + Number = "num", + ListSingle = "list_single", + Toggle = "bool", +} + +type UIDynamicInputConstraint = StringConstraint | NumberConstraint | ListConstraint | ToggleConstraint; + +type StringConstraint = [number] | undefined; +type NumberConstraint = [number, number, number] | undefined; +type ListConstraint = string[]; +type ToggleConstraint = [] | undefined; + +export const UIDynamicInputModal = (props, context) => { + +}; + +interface DynamicEntryProps { + entry: UIDynamicInputEntry; +} + +const DynamicEntry = (props: DynamicEntryProps, context) => { + +}; + +const DynamicEntryNumber = (props, context) => { + +}; + +const DynamicEntryString = (props, context) => { + +}; + +const DynamicEntryPick = (props, context) => { + +}; + +const DynamicEntryToggle = (props, context) => { + +}; + + From f0598c500775fc61c0ddc4fa9cfb49c39f9a5fd1 Mon Sep 17 00:00:00 2001 From: silicons Date: Wed, 26 Jul 2023 17:38:50 -0700 Subject: [PATCH 02/62] stuff --- code/game/objects/items.dm | 41 ++++++++++++++++++- code/modules/clothing/clothing.dm | 6 +++ code/modules/clothing/clothing_accessories.dm | 9 +--- code/modules/mob/inventory/items.dm | 16 ++++++++ code/modules/mob/living/inventory.dm | 32 +++++++++++++++ code/modules/mob/living/living_defines.dm | 12 ++++-- code/modules/mob/mob_defines.dm | 3 ++ .../modules/tgui/modals/tgui_dynamic_input.dm | 2 +- 8 files changed, 108 insertions(+), 13 deletions(-) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 4a10872a7473..5d3230c8d345 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -36,6 +36,12 @@ /// economic category for items var/economic_category_item = ECONOMIC_CATEGORY_ITEM_DEFAULT + //* Carry Weight + /// carry weight in kgs. this might be generalized later so KEEP IT REALISTIC. + var/carry_weight = 0 + /// registered carry weight - null if not in inventory. + var/carry_weight_cached + //? Combat /// Amount of damage we do on melee. var/damage_force = 0 @@ -100,7 +106,7 @@ /// For electrical admittance/conductance (electrocution checks and shit) var/siemens_coefficient = 1 /// How much clothing is slowing you down. Negative values speeds you up - var/slowdown = 0 + var/slowdown_legacy = 0 /// Suit storage stuff. var/list/allowed = null /// All items can have an uplink hidden inside, just remember to add the triggers. @@ -239,6 +245,23 @@ /obj/item/examine(mob/user, dist) . = ..() . += "[gender == PLURAL ? "They are" : "It is"] a [weightclass2text(w_class)] item." + switch(get_carry_weight()) + if(-INFINITY to 0.1) + . += "It looks like it weighs practically nothing." + if(0.1 to 0.75) + . += "It looks like it weighs very little." + if(0.75 to 2) + . += "It looks like it's decently lightweight." + if(2 to 5) + . += "It looks like it weighs a bit." + if(5 to 10) + . += "It looks like it weighs a good amount." + if(10 to 20) + . += "It looks like it is heavy. It would take a good effort to run around with it." + if(20 to 40) + . += "It looks like it weighs a lot. You probably will have a hard time running with it." + if(40 to INFINITY) + . ++ "It looks like it weighs a ton. You really won't be doing much running with it." // if(resistance_flags & INDESTRUCTIBLE) // . += "[src] seems extremely robust! It'll probably withstand anything that could happen to it!" @@ -740,6 +763,22 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. // . = ..() // update_action_buttons() +//* Carry Weight + +/obj/item/proc/get_carry_weight() + return carry_weight + +/obj/item/proc/update_carry_weight() + if(isnull(carry_weight_cached)) + return null + . = get_carry_weight() + if(. == carry_weight_cached) + return 0 + . -= carry_weight_cached + var/mob/living/wearer = worn_mob() + if(istype(wearer)) + wearer.adjust_current_carry_weight(.) + /** * grabs an attack verb to use * diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 874236bbc727..52a22484e6fe 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -61,6 +61,12 @@ /// full list of accessories, everything inside must be an /obj/item. *not* /obj/item/clothing. var/list/accessories + //* Carry Weight + /// carry weight compensation for accessories - flat. can't be negative, that makes no sense. + var/weight_compensation_flat = 0 + /// carry weight compensation for accessories - multiplier. applied before flat. 0 to 1. + var/weight_compensation_mult = 0 + /obj/item/clothing/Initialize(mapload) . = ..() if(islist(active_slots)) diff --git a/code/modules/clothing/clothing_accessories.dm b/code/modules/clothing/clothing_accessories.dm index 783372887a7c..d7bbfdf98827 100644 --- a/code/modules/clothing/clothing_accessories.dm +++ b/code/modules/clothing/clothing_accessories.dm @@ -210,8 +210,8 @@ LAZYADD(accessories,A) A.on_attached(src, user) add_obj_verb(src, /obj/item/clothing/proc/removetie_verb) - update_accessory_slowdown() update_worn_icon() + update_carry_weight() /obj/item/clothing/proc/remove_accessory(mob/user, obj/item/clothing/accessory/A) if(!LAZYLEN(accessories) || !(A in accessories)) @@ -219,13 +219,8 @@ A.on_removed(user) accessories -= A - update_accessory_slowdown() update_worn_icon() - -/obj/item/clothing/proc/update_accessory_slowdown() - slowdown = initial(slowdown) - for(var/obj/item/clothing/accessory/A in accessories) - slowdown += A.slowdown + update_carry_weight() /obj/item/clothing/proc/removetie_verb() set name = "Remove Accessory" diff --git a/code/modules/mob/inventory/items.dm b/code/modules/mob/inventory/items.dm index aa38b32e5929..0bd5ab9e052a 100644 --- a/code/modules/mob/inventory/items.dm +++ b/code/modules/mob/inventory/items.dm @@ -101,6 +101,14 @@ if(zoom) zoom() //binoculars, scope, etc + // todo: remove assertion for performance + if(isnull(carry_weight_cached)) + STACK_TRACE("carry weight cached was not null on pickup") + if(isliving(user)) + var/mob/living/L = user + L.remove_current_carry_weight(carry_weight_cached) + carry_weight_cached = null + return ((. & COMPONENT_ITEM_DROPPED_RELOCATE)? ITEM_RELOCATED_BY_DROPPED : NONE) /** @@ -120,6 +128,14 @@ if(isturf(oldLoc) && !(flags & (INV_OP_SILENT | INV_OP_DIRECTLY_EQUIPPING))) playsound(src, pickup_sound, 20, ignore_walls = FALSE) + // todo: remove assertion for performance + if(!isnull(carry_weight_cached)) + STACK_TRACE("carry weight cached was not null on pickup") + carry_weight_cached = get_carry_weight() + if(isliving(user)) + var/mob/living/L = user + L.add_current_carry_weight(carry_weight_cached) + /** * get the slowdown we incur when we're worn */ diff --git a/code/modules/mob/living/inventory.dm b/code/modules/mob/living/inventory.dm index 7369dc3608c3..0636985d9704 100644 --- a/code/modules/mob/living/inventory.dm +++ b/code/modules/mob/living/inventory.dm @@ -255,3 +255,35 @@ /mob/living/has_free_hand() return !l_hand || !r_hand + +//* carry weight + +/mob/living/proc/recalculate_carry_weight() + var/tally = 0 + for(var/obj/item/I as anything in get_equipped_items()) + tally += I.get_carry_weight() + if(cached_carry_weight == tally) + return + cached_carry_weight = tally + update_carry_weight_slowdown() + +/mob/living/proc/add_current_carry_weight(amount) + if(!amount) + return + cached_carry_weight += amount + update_carry_weight_slowdown() + +/mob/living/proc/remove_current_carry_weight(amount) + if(!amount) + return + cached_carry_weight -= amount + update_carry_weight_slowdown() + +/mob/living/proc/adjust_current_carry_weight(amount) + if(!amount) + return + cached_carry_weight += tally + update_carry_weight_slowdown() + +/mob/living/proc/update_carry_weight_slowdown() + #warn impl diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index f21a67fc0b02..4689cd20b70d 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -1,9 +1,8 @@ /** - * # /mob/living + * living mobs * - * mob/living is the base type of mobs that have health - * there's probably a better explanation we can type someday but for that, uh - * yeah. + * living mobs are the subtype of mobs that are semantically what you'd think of as a true mob + * health, inventory carry weight simulations, etc. */ /mob/living see_invisible = SEE_INVISIBLE_LIVING @@ -124,6 +123,11 @@ /// Set to TRUE to enable the use of hands and the hands hud var/has_hands = FALSE + //* Carry Weight + // todo: put all this on /datum/inventory after hand refactor + /// cached carry weight of all items + var/cached_carry_weight = 0 + //? movement /// are we currently pushing (or trying to push) (or otherwise inside Bump() handling that deals with this crap) another atom? var/pushing_bumped_atom = FALSE diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 524f79fa1e22..1ea717a3a603 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -1,3 +1,6 @@ +/** + * base BYOND type for an actor, if the game world is a scene. + */ /mob datum_flags = DF_USE_TAG density = 1 diff --git a/code/modules/tgui/modals/tgui_dynamic_input.dm b/code/modules/tgui/modals/tgui_dynamic_input.dm index 7ffd766e9a34..beec14dccb9a 100644 --- a/code/modules/tgui/modals/tgui_dynamic_input.dm +++ b/code/modules/tgui/modals/tgui_dynamic_input.dm @@ -92,7 +92,7 @@ #warn impl /datum/tgui_dynamic_input/proc/finish(list/choices) - callback?.InvokeAsync(cohices) + callback?.InvokeAsync(choices) /datum/tgui_dynamic_input/proc/sanitize(list/choices) #warn impl From bdc73a00e9c7945f50989de22729a844ed252519 Mon Sep 17 00:00:00 2001 From: silicons Date: Wed, 26 Jul 2023 19:08:26 -0700 Subject: [PATCH 03/62] things --- code/modules/clothing/clothing_accessories.dm | 9 +++++++++ code/modules/mob/living/carbon/inventory.dm | 5 +++++ code/modules/mob/living/inventory.dm | 9 ++++++++- code/modules/movespeed/modifiers/mob.dm | 3 +++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/code/modules/clothing/clothing_accessories.dm b/code/modules/clothing/clothing_accessories.dm index d7bbfdf98827..c906df2d3deb 100644 --- a/code/modules/clothing/clothing_accessories.dm +++ b/code/modules/clothing/clothing_accessories.dm @@ -15,6 +15,15 @@ return accessory_host.update_worn_icon() return ..() +/obj/item/clothing/get_carry_weight() + . = ..() + var/tally = 0 + for(var/obj/item/I as anything in accessories) + tally += I.get_carry_weight() + tally *= (1 - weight_compensation_mult) + tally = max(0, tally - weight_compensation_flat) + . += tally + /obj/item/clothing/equipped(mob/user, slot, flags) . = ..() // propagate through accessories diff --git a/code/modules/mob/living/carbon/inventory.dm b/code/modules/mob/living/carbon/inventory.dm index 063704e5b4f8..e255864a9bec 100644 --- a/code/modules/mob/living/carbon/inventory.dm +++ b/code/modules/mob/living/carbon/inventory.dm @@ -44,3 +44,8 @@ SLOT_ID_HANDCUFFED, SLOT_ID_LEGCUFFED ) + +//* carry weight + +/mob/living/carbon/carry_weight_to_slowdown(amount) + #warn impl diff --git a/code/modules/mob/living/inventory.dm b/code/modules/mob/living/inventory.dm index 0636985d9704..d304f2fceac5 100644 --- a/code/modules/mob/living/inventory.dm +++ b/code/modules/mob/living/inventory.dm @@ -286,4 +286,11 @@ update_carry_weight_slowdown() /mob/living/proc/update_carry_weight_slowdown() - #warn impl + var/slowdown = carry_weight_to_slowdown(cached_carry_weight) + if(slowdown) + add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/mob_carry_weight, multiplicative_slowdown = slowdown) + else + remove_movespeed_modifier(/datum/movespeed_modifier/mob_carry_weight) + +/mob/living/proc/carry_weight_to_slowdown(amount) + return 0 diff --git a/code/modules/movespeed/modifiers/mob.dm b/code/modules/movespeed/modifiers/mob.dm index 77c8fe51864a..d72ab4138edd 100644 --- a/code/modules/movespeed/modifiers/mob.dm +++ b/code/modules/movespeed/modifiers/mob.dm @@ -3,3 +3,6 @@ /datum/movespeed_modifier/mob_staggered variable = TRUE + +/datum/movespeed_modifier/mob_carry_weight + variable = TRUE From ac7df211b24c6fbf3ed6d5b8fd5431f15a1228b8 Mon Sep 17 00:00:00 2001 From: silicons Date: Wed, 26 Jul 2023 19:18:44 -0700 Subject: [PATCH 04/62] updates --- citadel.dme | 1 + code/__DEFINES/inventory/carry_weight.dm | 25 +++++++++++++ code/game/gamemodes/technomancer/core_obj.dm | 2 +- .../technomancer/devices/shield_armor.dm | 2 +- .../technomancer/devices/tesla_armor.dm | 2 +- code/game/objects/items.dm | 4 +-- code/game/objects/items/storage/backpack.dm | 36 ------------------- code/game/objects/items/storage/bags.dm | 1 - code/game/objects/items/tools/screwdriver.dm | 4 +-- code/game/objects/items/tools/weldingtool.dm | 2 +- code/game/objects/items/tools/wirecutters.dm | 2 +- code/game/objects/items/tools/wrench.dm | 2 +- code/game/objects/items/weapons/melee/misc.dm | 2 +- .../guns/magnetic/magnetic_railgun.dm | 18 +++------- 14 files changed, 41 insertions(+), 62 deletions(-) create mode 100644 code/__DEFINES/inventory/carry_weight.dm diff --git a/citadel.dme b/citadel.dme index 177e707b831f..58f2d5513762 100644 --- a/citadel.dme +++ b/citadel.dme @@ -190,6 +190,7 @@ #include "code\__DEFINES\fishing\fishing.dm" #include "code\__DEFINES\inventory\accessories.dm" #include "code\__DEFINES\inventory\bodytypes.dm" +#include "code\__DEFINES\inventory\carry_weight.dm" #include "code\__DEFINES\inventory\icons.dm" #include "code\__DEFINES\inventory\misc.dm" #include "code\__DEFINES\inventory\procs.dm" diff --git a/code/__DEFINES/inventory/carry_weight.dm b/code/__DEFINES/inventory/carry_weight.dm new file mode 100644 index 000000000000..fe731f0bb166 --- /dev/null +++ b/code/__DEFINES/inventory/carry_weight.dm @@ -0,0 +1,25 @@ +#warn impl + +#define CARRY_WEIGHT_BASELINE 0 + +//* Tools + +#define CARRY_WEIGHT_HYBRID_TOOLS 1 + +//* Armor + +//* Weapons + +#define CARRY_WEIGHT_GUN_LIGHT 3 +#define CARRY_WEIGHT_GUN_NORMAL 5 +#define CARRY_WEIGHT_GUN_LARGE 7.5 +#define CARRY_WEIGHT_GUN_BULKY 10 +#define CARRY_WEIGHT_GUN_UNREASONABLE 15 +#define CARRY_WEIGHT_GUN_RIDICULOUS 30 +#define CARRY_WEIGHT_GUN_VEHICLE 60 + +//* Spacesuits / RIGs + +//* Antags + +#define CARRY_WEIGHT_TECHNOMANCER_BULKY_CORE 10 diff --git a/code/game/gamemodes/technomancer/core_obj.dm b/code/game/gamemodes/technomancer/core_obj.dm index 3fae544560f0..0ef1d0c3118d 100644 --- a/code/game/gamemodes/technomancer/core_obj.dm +++ b/code/game/gamemodes/technomancer/core_obj.dm @@ -262,7 +262,7 @@ energy = 20000 max_energy = 20000 regen_rate = 25 //800 seconds to full - slowdown = 1 + carry_weight = CARRY_WEIGHT_TECHNOMANCER_BULKY_CORE instability_modifier = 1.0 spell_power_modifier = 1.4 diff --git a/code/game/gamemodes/technomancer/devices/shield_armor.dm b/code/game/gamemodes/technomancer/devices/shield_armor.dm index 273428c41735..08e23187cde7 100644 --- a/code/game/gamemodes/technomancer/devices/shield_armor.dm +++ b/code/game/gamemodes/technomancer/devices/shield_armor.dm @@ -16,7 +16,7 @@ require a very potent supply of an energy of some kind in order to function." icon_state = "shield_armor_0" blood_overlay_type = "armor" - slowdown = 0 + carry_weight = 0 armor_type = /datum/armor/none action_button_name = "Toggle Shield Projector" var/active = 0 diff --git a/code/game/gamemodes/technomancer/devices/tesla_armor.dm b/code/game/gamemodes/technomancer/devices/tesla_armor.dm index 03668e4990e0..85d73a4ecee3 100644 --- a/code/game/gamemodes/technomancer/devices/tesla_armor.dm +++ b/code/game/gamemodes/technomancer/devices/tesla_armor.dm @@ -12,7 +12,7 @@ desc = "This rather dangerous looking armor will hopefully shock your enemies, and not you in the process." icon_state = "tesla_armor_1" //wip blood_overlay_type = "armor" - slowdown = 1 + carry_weight = 0 armor_type = /datum/armor/none action_button_name = "Toggle Tesla Armor" var/active = 1 //Determines if the armor will zap or block diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 5d3230c8d345..160cafab64d3 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -38,7 +38,7 @@ //* Carry Weight /// carry weight in kgs. this might be generalized later so KEEP IT REALISTIC. - var/carry_weight = 0 + var/carry_weight = CARRY_WEIGHT_BASELINE /// registered carry weight - null if not in inventory. var/carry_weight_cached @@ -261,7 +261,7 @@ if(20 to 40) . += "It looks like it weighs a lot. You probably will have a hard time running with it." if(40 to INFINITY) - . ++ "It looks like it weighs a ton. You really won't be doing much running with it." + . += "It looks like it weighs a ton. You really won't be doing much running with it." // if(resistance_flags & INDESTRUCTIBLE) // . += "[src] seems extremely robust! It'll probably withstand anything that could happen to it!" diff --git a/code/game/objects/items/storage/backpack.dm b/code/game/objects/items/storage/backpack.dm index 9f24b81775aa..462f380b5729 100644 --- a/code/game/objects/items/storage/backpack.dm +++ b/code/game/objects/items/storage/backpack.dm @@ -594,10 +594,6 @@ return FALSE var/mob/living/carbon/human/H if(istype(H) && istype(H.tail_style, taurtype)) - if(H.size_multiplier >= RESIZE_BIG) //Are they a macro? - slowdown = 0 - else - slowdown = initial(slowdown) return 1 else to_chat(H, "[no_message]") @@ -631,59 +627,27 @@ var/datum/sprite_accessory/tail/taur/TT = H.tail_style if(istype(H) && istype(TT, /datum/sprite_accessory/tail/taur/horse)) item_state = "[icon_base]_horse" - if(H.size_multiplier >= RESIZE_BIG) //Are they a macro? - slowdown = 0 - else - slowdown = initial(slowdown) return 1 if(istype(H) && istype(TT, /datum/sprite_accessory/tail/taur/wolf)) item_state = "[icon_base]_wolf" - if(H.size_multiplier >= RESIZE_BIG) //Are they a macro? - slowdown = 0 - else - slowdown = initial(slowdown) return 1 if(istype(H) && istype(TT, /datum/sprite_accessory/tail/taur/cow)) item_state = "[icon_base]_cow" - if(H.size_multiplier >= RESIZE_BIG) //Are they a macro? - slowdown = 0 - else - slowdown = initial(slowdown) return 1 if(istype(H) && istype(TT, /datum/sprite_accessory/tail/taur/lizard)) item_state = "[icon_base]_lizard" - if(H.size_multiplier >= RESIZE_BIG) //Are they a macro? - slowdown = 0 - else - slowdown = initial(slowdown) return 1 if(istype(H) && istype(TT, /datum/sprite_accessory/tail/taur/feline)) item_state = "[icon_base]_feline" - if(H.size_multiplier >= RESIZE_BIG) //Are they a macro? - slowdown = 0 - else - slowdown = initial(slowdown) return 1 if(istype(H) && istype(TT, /datum/sprite_accessory/tail/taur/drake)) item_state = "[icon_base]_drake" - if(H.size_multiplier >= RESIZE_BIG) //Are they a macro? - slowdown = 0 - else - slowdown = initial(slowdown) return 1 if(istype(H) && istype(TT, /datum/sprite_accessory/tail/taur/otie)) item_state = "[icon_base]_otie" - if(H.size_multiplier >= RESIZE_BIG) //Are they a macro? - slowdown = 0 - else - slowdown = initial(slowdown) return 1 if(istype(H) && istype(TT, /datum/sprite_accessory/tail/taur/deer)) item_state = "[icon_base]_deer" - if(H.size_multiplier >= RESIZE_BIG) //Are they a macro? - slowdown = 0 - else - slowdown = initial(slowdown) return 1 else to_chat(H, "[no_message]") diff --git a/code/game/objects/items/storage/bags.dm b/code/game/objects/items/storage/bags.dm index f89027ea40ac..32c9c5afe65f 100644 --- a/code/game/objects/items/storage/bags.dm +++ b/code/game/objects/items/storage/bags.dm @@ -386,7 +386,6 @@ desc = "A bag for storing pills, patches, and bottles." max_storage_space = 200 w_class = ITEMSIZE_LARGE - slowdown = 1 can_hold = list( /obj/item/reagent_containers/pill, /obj/item/reagent_containers/glass/beaker, diff --git a/code/game/objects/items/tools/screwdriver.dm b/code/game/objects/items/tools/screwdriver.dm index 2ab66c31d2d8..25b0fc1c2ec0 100644 --- a/code/game/objects/items/tools/screwdriver.dm +++ b/code/game/objects/items/tools/screwdriver.dm @@ -113,15 +113,13 @@ icon_state = "hybscrewdriver" item_state = "screwdriver_black" origin_tech = list(TECH_MATERIAL = 3, TECH_ENGINEERING = 3) - slowdown = 0.1 + carry_weight = CARRY_WEIGHT_HYBRID_TOOLS w_class = ITEMSIZE_NORMAL tool_sound = 'sound/effects/uncloak.ogg' tool_speed = 0.4 random_color = FALSE reach = 2 - - /obj/item/tool/screwdriver/cyborg name = "powered screwdriver" desc = "An electrical screwdriver, designed to be both precise and quick." diff --git a/code/game/objects/items/tools/weldingtool.dm b/code/game/objects/items/tools/weldingtool.dm index a080a6322f25..7d1b31cc8866 100644 --- a/code/game/objects/items/tools/weldingtool.dm +++ b/code/game/objects/items/tools/weldingtool.dm @@ -453,7 +453,7 @@ icon_state = "hybwelder" max_fuel = 80 eye_safety_modifier = -2 // Brighter than the sun. Literally, you can look at the sun with a welding mask of proper grade, this will burn through that. - slowdown = 0.1 + carry_weight = CARRY_WEIGHT_HYBRID_TOOLS tool_speed = 0.25 w_class = ITEMSIZE_LARGE flame_intensity = 5 diff --git a/code/game/objects/items/tools/wirecutters.dm b/code/game/objects/items/tools/wirecutters.dm index f2c4f501d63a..77843c63ca2b 100644 --- a/code/game/objects/items/tools/wirecutters.dm +++ b/code/game/objects/items/tools/wirecutters.dm @@ -107,7 +107,7 @@ catalogue_data = list(/datum/category_item/catalogue/anomalous/precursor_a/alien_wirecutters) icon_state = "hybcutters" w_class = ITEMSIZE_NORMAL - slowdown = 0.1 + carry_weight = CARRY_WEIGHT_HYBRID_TOOLS origin_tech = list(TECH_MATERIAL = 3, TECH_ENGINEERING = 3, TECH_PHORON = 2) attack_verb = list("pinched", "nipped", "warped", "blasted") tool_sound = 'sound/effects/stealthoff.ogg' diff --git a/code/game/objects/items/tools/wrench.dm b/code/game/objects/items/tools/wrench.dm index acabc9ac3d7b..299d3abdc9e8 100644 --- a/code/game/objects/items/tools/wrench.dm +++ b/code/game/objects/items/tools/wrench.dm @@ -81,7 +81,7 @@ damage_force = 8 throw_force = 10 w_class = ITEMSIZE_NORMAL - slowdown = 0.1 + carry_weight = CARRY_WEIGHT_HYBRID_TOOLS origin_tech = list(TECH_MATERIAL = 3, TECH_ENGINEERING = 3, TECH_PHORON = 2) attack_verb = list("bashed", "battered", "bludgeoned", "whacked", "warped", "blasted") tool_sound = 'sound/effects/stealthoff.ogg' diff --git a/code/game/objects/items/weapons/melee/misc.dm b/code/game/objects/items/weapons/melee/misc.dm index 0d3690d06861..a4535caa551f 100644 --- a/code/game/objects/items/weapons/melee/misc.dm +++ b/code/game/objects/items/weapons/melee/misc.dm @@ -387,7 +387,7 @@ edge = 1 attack_verb = list("attacked", "smashed", "crushed", "wacked", "pounded") armor_penetration = 50 - slowdown = 0 + carry_weight = CARRY_WEIGHT_BASELINE //This currently just kills the user. lol /* diff --git a/code/modules/projectiles/guns/magnetic/magnetic_railgun.dm b/code/modules/projectiles/guns/magnetic/magnetic_railgun.dm index a42dac66fe66..8cda78331515 100644 --- a/code/modules/projectiles/guns/magnetic/magnetic_railgun.dm +++ b/code/modules/projectiles/guns/magnetic/magnetic_railgun.dm @@ -12,13 +12,11 @@ heavy = TRUE slot_flags = SLOT_BELT loaded = /obj/item/rcd_ammo/large - slowdown = 1 // Slowdown equals slowdown_worn, until we decide to import the system to differentiate between held and worn items + slowdown = CARRY_WEIGHT_GUN_BULKY // Slowdown equals slowdown_worn, until we decide to import the system to differentiate between held and worn items fire_delay = 1 var/initial_cell_type = /obj/item/cell/hyper var/initial_capacitor_type = /obj/item/stock_parts/capacitor/adv - var/slowdown_held = 2 - var/slowdown_worn = 1 var/empty_sound = 'sound/machines/twobeep.ogg' /obj/item/gun/magnetic/railgun/Initialize(mapload) @@ -64,9 +62,7 @@ initial_capacitor_type = /obj/item/stock_parts/capacitor/super fire_delay = 0 - slowdown = 2 - slowdown_held = 3 - slowdown_worn = 2 + slowdown = CARRY_WEIGHT_GUN_RIDICULOUS slot_flags = SLOT_BACK w_class = ITEMSIZE_NO_CONTAINER @@ -95,9 +91,7 @@ slot_flags = SLOT_BACK - slowdown = 0 - slowdown_held = 0 - slowdown_worn = 0 + slowdown = CARRY_WEIGHT_GUN_LIGHT power_cost = 100 load_type = /obj/item/magnetic_ammo @@ -127,9 +121,7 @@ slot_flags = SLOT_BACK - slowdown = 0 - slowdown_held = 0 - slowdown_worn = 0 + slowdown = CARRY_WEIGHT_GUN_LIGHT power_cost = 400 projectile_type = /obj/projectile/bullet/magnetic/heated @@ -185,7 +177,7 @@ slot_flags = SLOT_BACK - slowdown = 0.3 + slowdown = CARRY_WEIGHT_GUN_NORMAL power_cost = 200 projectile_type = /obj/projectile/bullet/magnetic/flechette/hunting From 1713d904d4d4c33c06b2ff5569eca7b00072d6c0 Mon Sep 17 00:00:00 2001 From: silicons Date: Wed, 26 Jul 2023 20:46:45 -0700 Subject: [PATCH 05/62] updates --- code/__DEFINES/inventory/carry_weight.dm | 22 ++++++++++++++++++- .../game/gamemodes/changeling/powers/armor.dm | 2 +- code/game/gamemodes/cult/cult_items.dm | 3 ++- code/game/objects/items.dm | 9 +++++--- code/game/objects/items/storage/backpack.dm | 4 ++-- code/modules/artifice/telecube.dm | 2 -- code/modules/clothing/suits/bio.dm | 2 +- code/modules/clothing/suits/medieval_armor.dm | 6 ++--- code/modules/clothing/suits/utility.dm | 13 +++-------- .../mob/living/carbon/human/movement.dm | 3 +++ code/modules/mob/living/inventory.dm | 16 ++++++++++++++ code/modules/movespeed/modifiers/mob.dm | 3 +++ code/modules/movespeed/movespeed_modifier.dm | 6 +++-- 13 files changed, 65 insertions(+), 26 deletions(-) diff --git a/code/__DEFINES/inventory/carry_weight.dm b/code/__DEFINES/inventory/carry_weight.dm index fe731f0bb166..4d20c5b5b4ab 100644 --- a/code/__DEFINES/inventory/carry_weight.dm +++ b/code/__DEFINES/inventory/carry_weight.dm @@ -1,4 +1,4 @@ -#warn impl +//? Carry weight defines #define CARRY_WEIGHT_BASELINE 0 @@ -8,6 +8,14 @@ //* Armor +#define CARRY_WEIGHT_ARMOR_LIGHT 5 + +#define CARRY_WEIGHT_ARMOR_PLATE_ARMOR 20 +#define CARRY_WEIGHT_ARMOR_CHAINMAIL_ARMOR 15 + +#define CARRY_WEIGHT_ARMOR_BIORADSUIT 10 +#define CARRY_WEIGHT_ARMOR_FIRESUIT 10 + //* Weapons #define CARRY_WEIGHT_GUN_LIGHT 3 @@ -20,6 +28,18 @@ //* Spacesuits / RIGs +#define CARRY_WEIGHT_LEGACY_RIG_TECHNICIAN 10 +#define CARRY_WEIGHT_LEGACY_RIG_PARAMEDIC 10 +#define CARRY_WEIGHT_LEGACY_RIG_COMBAT 15 +#define CARRY_WEIGHT_LEGACY_RIG_MILITARY 20 + //* Antags +#define CARRY_WEIGHT_CHANGELING_ARMOR 20 +#define CARRY_WEIGHT_CULT_VOIDSUIT_HELMET 5 +#define CARRY_WEIGHT_CULT_VOIDSUIT 20 #define CARRY_WEIGHT_TECHNOMANCER_BULKY_CORE 10 + +//* Storage + +#define CARRY_WEIGHT_STORAGE_DUFFLEBAG 15 diff --git a/code/game/gamemodes/changeling/powers/armor.dm b/code/game/gamemodes/changeling/powers/armor.dm index 4d3753a5f2b0..ac7102972fb2 100644 --- a/code/game/gamemodes/changeling/powers/armor.dm +++ b/code/game/gamemodes/changeling/powers/armor.dm @@ -97,7 +97,7 @@ armor_type = /datum/armor/changeling/chitin siemens_coefficient = 0.3 max_heat_protection_temperature = FIRESUIT_MAX_HEAT_PROTECTION_TEMPERATURE - slowdown = 3 + carry_weight = CARRY_WEIGHT_CHANGELING_ARMOR /obj/item/clothing/suit/space/changeling/armored/Initialize(mapload) . = ..() diff --git a/code/game/gamemodes/cult/cult_items.dm b/code/game/gamemodes/cult/cult_items.dm index ebe367a9a708..e606043db452 100644 --- a/code/game/gamemodes/cult/cult_items.dm +++ b/code/game/gamemodes/cult/cult_items.dm @@ -107,6 +107,7 @@ icon_state = "cult_helmet" origin_tech = list(TECH_MATERIAL = 3, TECH_ARCANE = 1) armor_type = /datum/armor/cult/space + carry_weight = CARRY_WEIGHT_CULT_VOIDSUIT_HELMET siemens_coefficient = 0 /obj/item/clothing/head/helmet/space/cult/cultify() @@ -119,7 +120,7 @@ desc = "A bulky suit of armour, bristling with spikes. It looks space-worthy." w_class = ITEMSIZE_NORMAL allowed = list(/obj/item/book/tome,/obj/item/melee/cultblade,/obj/item/tank/emergency/oxygen,/obj/item/suit_cooling_unit) - slowdown = 1 + carry_weight = CARRY_WEIGHT_CULT_VOIDSUIT armor_type = /datum/armor/cult/space siemens_coefficient = 0 inv_hide_flags = HIDEGLOVES|HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 160cafab64d3..91c6dc9eb6e8 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -37,10 +37,15 @@ var/economic_category_item = ECONOMIC_CATEGORY_ITEM_DEFAULT //* Carry Weight + /// alternative carry weight, only used while equipped. this is for stuff that's light but should be encumbering. overrides carry_weight + var/carry_encumberence = CARRY_WEIGHT_BASELINE /// carry weight in kgs. this might be generalized later so KEEP IT REALISTIC. var/carry_weight = CARRY_WEIGHT_BASELINE /// registered carry weight - null if not in inventory. var/carry_weight_cached + /// Hard slowdown. Applied before carry weight. + /// This affects multiplicative movespeed. + var/hard_slowdown = 0 //? Combat /// Amount of damage we do on melee. @@ -105,8 +110,6 @@ var/permeability_coefficient = 1 /// For electrical admittance/conductance (electrocution checks and shit) var/siemens_coefficient = 1 - /// How much clothing is slowing you down. Negative values speeds you up - var/slowdown_legacy = 0 /// Suit storage stuff. var/list/allowed = null /// All items can have an uplink hidden inside, just remember to add the triggers. @@ -766,7 +769,7 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. //* Carry Weight /obj/item/proc/get_carry_weight() - return carry_weight + return isnull(carry_encumberence)? carry_weight : carry_encumberence /obj/item/proc/update_carry_weight() if(isnull(carry_weight_cached)) diff --git a/code/game/objects/items/storage/backpack.dm b/code/game/objects/items/storage/backpack.dm index 462f380b5729..982b6c730402 100644 --- a/code/game/objects/items/storage/backpack.dm +++ b/code/game/objects/items/storage/backpack.dm @@ -163,7 +163,7 @@ desc = "A large dufflebag for holding extra things." icon_state = "duffle" item_state_slots = list(SLOT_ID_RIGHT_HAND = "duffle", SLOT_ID_LEFT_HAND = "duffle") - slowdown = 1 + carry_weight = CARRY_WEIGHT_STORAGE_DUFFLEBAG max_storage_space = INVENTORY_DUFFLEBAG_SPACE /obj/item/storage/backpack/dufflebag/syndie @@ -171,7 +171,7 @@ desc = "A large dufflebag for holding extra tactical supplies. This one appears to be made out of lighter material than usual." icon_state = "duffle-syndie" item_state_slots = list(SLOT_ID_RIGHT_HAND = "duffle_syndie", SLOT_ID_LEFT_HAND = "duffle_syndie") - slowdown = 0 + carry_weight = CARRY_WEIGHT_BASELINE /obj/item/storage/backpack/dufflebag/syndie/med name = "medical dufflebag" diff --git a/code/modules/artifice/telecube.dm b/code/modules/artifice/telecube.dm index 21056a7ed4fa..795dff6b7337 100644 --- a/code/modules/artifice/telecube.dm +++ b/code/modules/artifice/telecube.dm @@ -28,8 +28,6 @@ catalogue_data = list(/datum/category_item/catalogue/anomalous/precursor_a/telecube) - slowdown = 5 - throw_range = 2 var/obj/item/telecube/mate = null diff --git a/code/modules/clothing/suits/bio.dm b/code/modules/clothing/suits/bio.dm index 58777abcd83a..e72c9d56780c 100644 --- a/code/modules/clothing/suits/bio.dm +++ b/code/modules/clothing/suits/bio.dm @@ -19,7 +19,7 @@ gas_transfer_coefficient = 0.01 permeability_coefficient = 0.01 body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS|HANDS|FEET - slowdown = 1.0 + carry_weight = CARRY_WEIGHT_ARMOR_BIORADSUIT allowed = list(/obj/item/tank/emergency/oxygen,/obj/item/pen,/obj/item/flashlight/pen) armor_type = /datum/armor/general/biosuit inv_hide_flags = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER diff --git a/code/modules/clothing/suits/medieval_armor.dm b/code/modules/clothing/suits/medieval_armor.dm index 87e188ceb33c..576e583b1606 100644 --- a/code/modules/clothing/suits/medieval_armor.dm +++ b/code/modules/clothing/suits/medieval_armor.dm @@ -50,7 +50,7 @@ armor_type = /datum/armor/general/medieval icon = 'icons/clothing/suit/armor/medieval/knight.dmi' icon_state = "knight" - slowdown = 1 + carry_weight = CARRY_WEIGHT_ARMOR_PLATE_ARMOR inv_hide_flags = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETIE|HIDEHOLSTER body_cover_flags = UPPER_TORSO|LOWER_TORSO|ARMS|HANDS|LEGS|FEET worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL @@ -79,7 +79,7 @@ armor_type = /datum/armor/general/medieval/light icon = 'icons/clothing/suit/armor/medieval/bastard.dmi' icon_state = "bastard" - slowdown = 0 + carry_weight = CARRY_WEIGHT_ARMOR_CHAINMAIL_ARMOR /obj/item/clothing/suit/armor/medieval/paladin name = "elite paladin plate" @@ -87,7 +87,7 @@ armor_type = /datum/armor/general/medieval/mesh icon = 'icons/clothing/suit/armor/medieval/paladin.dmi' icon_state = "paladin" - slowdown = 0 + carry_weight = CARRY_WEIGHT_ARMOR_CHAINMAIL_ARMOR //Crusader stuff //Helmets diff --git a/code/modules/clothing/suits/utility.dm b/code/modules/clothing/suits/utility.dm index fe85ebfac383..ba7dff39654d 100644 --- a/code/modules/clothing/suits/utility.dm +++ b/code/modules/clothing/suits/utility.dm @@ -18,7 +18,8 @@ permeability_coefficient = 0.50 body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS allowed = list(/obj/item/flashlight,/obj/item/tank/emergency/oxygen,/obj/item/extinguisher) - slowdown = 1.0 + carry_encumberence = CARRY_WEIGHT_ARMOR_FIRESUIT + carry_weight = CARRY_WEIGHT_ARMOR_LIGHT inv_hide_flags = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER clothing_flags = 0 heat_protection = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS @@ -31,14 +32,6 @@ /obj/item/clothing/suit/fire/firefighter icon_state = "firesuit" -/obj/item/clothing/suit/fire/heavy //Is this even used?? -S2- - name = "firesuit" - desc = "A suit that protects against extreme fire and heat." - //icon_state = "thermal" - item_state_slots = list(SLOT_ID_RIGHT_HAND = "black_suit", SLOT_ID_LEFT_HAND = "black_suit") - w_class = ITEMSIZE_LARGE//bulky item - slowdown = 1.5 - /* * Bomb protection */ @@ -95,7 +88,7 @@ permeability_coefficient = 0.50 body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS|HANDS|FEET allowed = list(/obj/item/flashlight,/obj/item/tank/emergency/oxygen,/obj/item/clothing/head/radiation,/obj/item/clothing/mask/gas) - slowdown = 1.5 + carry_weight = CARRY_WEIGHT_ARMOR_BIORADSUIT armor_type = /datum/armor/general/radsuit inv_hide_flags = HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER clothing_flags = CLOTHING_THICK_MATERIAL diff --git a/code/modules/mob/living/carbon/human/movement.dm b/code/modules/mob/living/carbon/human/movement.dm index 55ba626e7235..3c013c27671c 100644 --- a/code/modules/mob/living/carbon/human/movement.dm +++ b/code/modules/mob/living/carbon/human/movement.dm @@ -84,6 +84,9 @@ var/turf/T = get_turf(src) tally += calculate_turf_slowdown(T, direct) + if(CE_SPEEDBOOST in chem_effects) + tally -= 0.5 + // Item related slowdown. var/item_tally = calculate_item_encumbrance() if(item_tally > 0) // is it greater than 0? run the wacky shit diff --git a/code/modules/mob/living/inventory.dm b/code/modules/mob/living/inventory.dm index d304f2fceac5..7ae2a20c840c 100644 --- a/code/modules/mob/living/inventory.dm +++ b/code/modules/mob/living/inventory.dm @@ -258,6 +258,11 @@ //* carry weight +// don't call this you shouldn't need to +/mob/living/proc/update_carry_weight() + recalculate_carry_weight() + update_carry_weight_slowdown() + /mob/living/proc/recalculate_carry_weight() var/tally = 0 for(var/obj/item/I as anything in get_equipped_items()) @@ -294,3 +299,14 @@ /mob/living/proc/carry_weight_to_slowdown(amount) return 0 + +//* hard movespeed slowdown + +/mob/living/proc/update_item_movespeed() + var/tally = 0 + for(var/obj/item/I as anything in get_equipped_items()) + tally += I.hard_slowdown + if(tally) + add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/mob_item_slowdown) + else + remove_movespeed_modifier(/datum/movespeed_modifier/mob_item_slowdown) diff --git a/code/modules/movespeed/modifiers/mob.dm b/code/modules/movespeed/modifiers/mob.dm index d72ab4138edd..7d5facc08943 100644 --- a/code/modules/movespeed/modifiers/mob.dm +++ b/code/modules/movespeed/modifiers/mob.dm @@ -6,3 +6,6 @@ /datum/movespeed_modifier/mob_carry_weight variable = TRUE + +/datum/movespeed_modifier/mob_item_slowdown + variable = TRUE diff --git a/code/modules/movespeed/movespeed_modifier.dm b/code/modules/movespeed/movespeed_modifier.dm index 859326fa88ba..941f1cdb6f3b 100644 --- a/code/modules/movespeed/movespeed_modifier.dm +++ b/code/modules/movespeed/movespeed_modifier.dm @@ -34,7 +34,8 @@ Key procs /// Determines order. Lower priorities are applied first. var/priority = 0 - var/flags = NONE + /// flags + var/movespeed_modifier_flags = NONE /// Multiplicative slowdown var/multiplicative_slowdown = 0 @@ -51,7 +52,8 @@ Key procs /// Movetypes this never applies to var/blacklisted_movetypes = NONE - /// Other modification datums this conflicts with. + /// Other modification datums this conflicts with. Enum string. + /// If there is, it prioritizes the highest slow *or* the highest speedup, with abs(). var/conflicts_with /datum/movespeed_modifier/New() From 2bb5165b159a0129efd3791bfcb4fe5ae26f1049 Mon Sep 17 00:00:00 2001 From: silicons Date: Wed, 26 Jul 2023 20:48:59 -0700 Subject: [PATCH 06/62] updates --- code/__DEFINES/inventory/carry_weight.dm | 9 +++++++++ code/__DEFINES/items_clothing.dm | 2 -- code/modules/clothing/shoes/_shoes.dm | 1 - code/modules/clothing/shoes/colour.dm | 8 ++++++-- code/modules/clothing/spacesuits/plasman.dm | 3 ++- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/code/__DEFINES/inventory/carry_weight.dm b/code/__DEFINES/inventory/carry_weight.dm index 4d20c5b5b4ab..bc33ea747de4 100644 --- a/code/__DEFINES/inventory/carry_weight.dm +++ b/code/__DEFINES/inventory/carry_weight.dm @@ -16,6 +16,10 @@ #define CARRY_WEIGHT_ARMOR_BIORADSUIT 10 #define CARRY_WEIGHT_ARMOR_FIRESUIT 10 +//* Shoes + +#define CARRY_WEIGHT_SHOES_CUFFED 150 + //* Weapons #define CARRY_WEIGHT_GUN_LIGHT 3 @@ -40,6 +44,11 @@ #define CARRY_WEIGHT_CULT_VOIDSUIT 20 #define CARRY_WEIGHT_TECHNOMANCER_BULKY_CORE 10 +//* Species + +#define CARRY_WEIGHT_PHORONOID_SUIT 20 +#define CARRY_WEIGHT_PHORONOID_HELMET 5 + //* Storage #define CARRY_WEIGHT_STORAGE_DUFFLEBAG 15 diff --git a/code/__DEFINES/items_clothing.dm b/code/__DEFINES/items_clothing.dm index 4053ccf656bb..6c463461f061 100644 --- a/code/__DEFINES/items_clothing.dm +++ b/code/__DEFINES/items_clothing.dm @@ -1,6 +1,4 @@ -/// How much shoes slow you down by default. Negative values speed you up. -#define SHOES_SLOWDOWN 0 /// For how bright candles are. #define CANDLE_LUM 3 diff --git a/code/modules/clothing/shoes/_shoes.dm b/code/modules/clothing/shoes/_shoes.dm index 212ed0ce8e11..a86df9ffd1ea 100644 --- a/code/modules/clothing/shoes/_shoes.dm +++ b/code/modules/clothing/shoes/_shoes.dm @@ -25,7 +25,6 @@ var/step_volume_mod = 1 //How quiet or loud footsteps in this shoe are permeability_coefficient = 0.50 - slowdown = SHOES_SLOWDOWN damage_force = 2 var/overshoes = 0 species_restricted = list("exclude",SPECIES_TESHARI, SPECIES_VOX) diff --git a/code/modules/clothing/shoes/colour.dm b/code/modules/clothing/shoes/colour.dm index 2ae6d1db50b9..200139b6ba39 100644 --- a/code/modules/clothing/shoes/colour.dm +++ b/code/modules/clothing/shoes/colour.dm @@ -97,7 +97,9 @@ if(!user.attempt_insert_item_for_installation(cuffs, src)) return chained = cuffs - slowdown = 15 + // todo: refactor + carry_encumberence = CARRY_WEIGHT_SHOES_CUFFED + update_carry_weight() icon_state = "orange1" /obj/item/clothing/shoes/orange/proc/remove_cuffs(mob/user as mob) @@ -107,7 +109,9 @@ user.put_in_hands_or_drop(chained) chained.add_fingerprint(user) - slowdown = initial(slowdown) + // todo: refactor + carry_encumberence = initial(carry_encumberence) + update_carry_weight() icon_state = "orange" chained = null diff --git a/code/modules/clothing/spacesuits/plasman.dm b/code/modules/clothing/spacesuits/plasman.dm index 1f4723332f84..1eb272cd323c 100644 --- a/code/modules/clothing/spacesuits/plasman.dm +++ b/code/modules/clothing/spacesuits/plasman.dm @@ -6,7 +6,7 @@ icon_state = "plasmaman_suit" icon_override = 'icons/mob/plasmeme/suits.dmi' desc = "A suit designed by NT to keep phoronoids from coming into contact with incompatible atmosphere. Seems like it doesn't protect from much else." - slowdown = 1 + carry_weight = CARRY_WEIGHT_PHORONOID_SUIT clothing_flags = ALLOWINTERNALS armor_type = /datum/armor/phoronoid allowed = list(/obj/item/tank) @@ -35,6 +35,7 @@ clothing_flags = ALLOWINTERNALS | FLEXIBLEMATERIAL armor_type = /datum/armor/phoronoid light_overlay = "plasmaman_overlay" + carry_weight = CARRY_WEIGHT_PHORONOID_HELMET // // SEC From 18434bd92c012ff46303705ea28caa575c496fdd Mon Sep 17 00:00:00 2001 From: silicons Date: Wed, 26 Jul 2023 21:00:04 -0700 Subject: [PATCH 07/62] updates --- code/__DEFINES/inventory/carry_weight.dm | 18 ++++++++++++++++-- code/modules/clothing/suits/armor.dm | 3 +-- code/modules/clothing/suits/bio.dm | 2 +- code/modules/clothing/suits/utility.dm | 1 + code/modules/clothing/under/nanotrasen_vr.dm | 2 +- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/code/__DEFINES/inventory/carry_weight.dm b/code/__DEFINES/inventory/carry_weight.dm index bc33ea747de4..a687c8a2eead 100644 --- a/code/__DEFINES/inventory/carry_weight.dm +++ b/code/__DEFINES/inventory/carry_weight.dm @@ -1,3 +1,13 @@ +//? Carry strength defines + +#define CARRY_STRENGTH_BASELINE 15 +#define CARRY_STRENGTH_UNATHI 20 +#define CARRY_STRENGTH_PROTEAN 22.5 +#define CARRY_STRENGTH_LIGHTADAPT_NEPID 17.5 +#define CARRY_STRENGTH + +#warn AOIGHAOIGJOIWAJOIJ + //? Carry weight defines #define CARRY_WEIGHT_BASELINE 0 @@ -10,11 +20,15 @@ #define CARRY_WEIGHT_ARMOR_LIGHT 5 +#define CARRY_WEIGHT_ARMOR_SPECIALIZED_VEST 10 + #define CARRY_WEIGHT_ARMOR_PLATE_ARMOR 20 #define CARRY_WEIGHT_ARMOR_CHAINMAIL_ARMOR 15 -#define CARRY_WEIGHT_ARMOR_BIORADSUIT 10 -#define CARRY_WEIGHT_ARMOR_FIRESUIT 10 +#define CARRY_WEIGHT_ARMOR_BIORADSUIT 17.5 +#define CARRY_WEIGHT_ARMOR_BIORADSUIT_HELMET 7.5 +#define CARRY_WEIGHT_ARMOR_FIRESUIT 17.5 +#define CARRY_WEIGHT_ARMOR_FIRESUIT_HELMET 7.5 //* Shoes diff --git a/code/modules/clothing/suits/armor.dm b/code/modules/clothing/suits/armor.dm index 0aa95a12e929..e830ec9c9e10 100644 --- a/code/modules/clothing/suits/armor.dm +++ b/code/modules/clothing/suits/armor.dm @@ -69,7 +69,7 @@ icon_state = "bulletproof" item_state_slots = list(SLOT_ID_RIGHT_HAND = "armor", SLOT_ID_LEFT_HAND = "armor") blood_overlay_type = "armor" - slowdown = 0.5 + carry_weight = CARRY_WEIGHT_ARMOR_SPECIALIZED_VEST armor_type = /datum/armor/station/ballistic siemens_coefficient = 0.7 @@ -83,7 +83,6 @@ desc = "A vest that excels in protecting the wearer against energy projectiles." icon_state = "armor_reflec" blood_overlay_type = "armor" - slowdown = 0.5 armor_type = /datum/armor/station/ablative siemens_coefficient = 0.1 diff --git a/code/modules/clothing/suits/bio.dm b/code/modules/clothing/suits/bio.dm index e72c9d56780c..ce29f21d0cec 100644 --- a/code/modules/clothing/suits/bio.dm +++ b/code/modules/clothing/suits/bio.dm @@ -113,7 +113,7 @@ gas_transfer_coefficient = 0.01 permeability_coefficient = 0.01 body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS|HANDS|FEET - slowdown = 1.0 + carry_weight = CARRY_WEIGHT_ARMOR_BIORADSUIT allowed = list(/obj/item/tank/emergency/oxygen,/obj/item/pen,/obj/item/flashlight/pen) armor_type = /datum/armor/general/beekeeper inv_hide_flags = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER diff --git a/code/modules/clothing/suits/utility.dm b/code/modules/clothing/suits/utility.dm index ba7dff39654d..f5db974fd586 100644 --- a/code/modules/clothing/suits/utility.dm +++ b/code/modules/clothing/suits/utility.dm @@ -78,6 +78,7 @@ clothing_flags = CLOTHING_THICK_MATERIAL body_cover_flags = HEAD|FACE|EYES armor_type = /datum/armor/general/radsuit + carry_weight = CARRY_WEIGHT_ARMOR_BIORADSUIT_HELMET /obj/item/clothing/suit/radiation name = "Radiation suit" diff --git a/code/modules/clothing/under/nanotrasen_vr.dm b/code/modules/clothing/under/nanotrasen_vr.dm index fa8d2a9217aa..7b536b8342bf 100644 --- a/code/modules/clothing/under/nanotrasen_vr.dm +++ b/code/modules/clothing/under/nanotrasen_vr.dm @@ -52,4 +52,4 @@ icon_state = "webvest" item_state_slots = list(SLOT_ID_RIGHT_HAND = "swat", SLOT_ID_LEFT_HAND = "swat") armor_type = /datum/armor/station/tactical - slowdown = 0.5 + carry_weight = CARRY_WEIGHT_ARMOR_LIGHT From 16b5ef774a1a518b2b22d4ea7cd0a6b15b5cb4fd Mon Sep 17 00:00:00 2001 From: silicons Date: Thu, 27 Jul 2023 00:57:56 -0700 Subject: [PATCH 08/62] pain --- citadel.dme | 2 +- code/__DEFINES/inventory/carry_weight.dm | 68 ---------- code/__DEFINES/inventory/weight.dm | 120 ++++++++++++++++++ code/game/gamemodes/cult/cult_items.dm | 2 + code/game/objects/items.dm | 29 ++++- code/game/objects/items/storage/backpack.dm | 6 +- .../items/weapons/material/twohanded.dm | 2 +- code/modules/clothing/spacesuits/plasman.dm | 2 + code/modules/clothing/suits/armor.dm | 1 + code/modules/clothing/suits/bio.dm | 1 + code/modules/clothing/suits/medieval_armor.dm | 9 +- code/modules/clothing/suits/utility.dm | 6 +- 12 files changed, 169 insertions(+), 79 deletions(-) delete mode 100644 code/__DEFINES/inventory/carry_weight.dm create mode 100644 code/__DEFINES/inventory/weight.dm diff --git a/citadel.dme b/citadel.dme index 58f2d5513762..30d9acfc9d21 100644 --- a/citadel.dme +++ b/citadel.dme @@ -190,12 +190,12 @@ #include "code\__DEFINES\fishing\fishing.dm" #include "code\__DEFINES\inventory\accessories.dm" #include "code\__DEFINES\inventory\bodytypes.dm" -#include "code\__DEFINES\inventory\carry_weight.dm" #include "code\__DEFINES\inventory\icons.dm" #include "code\__DEFINES\inventory\misc.dm" #include "code\__DEFINES\inventory\procs.dm" #include "code\__DEFINES\inventory\rendering.dm" #include "code\__DEFINES\inventory\slots.dm" +#include "code\__DEFINES\inventory\weight.dm" #include "code\__DEFINES\items\hypospray.dm" #include "code\__DEFINES\items\inducer.dm" #include "code\__DEFINES\items\nifs.dm" diff --git a/code/__DEFINES/inventory/carry_weight.dm b/code/__DEFINES/inventory/carry_weight.dm deleted file mode 100644 index a687c8a2eead..000000000000 --- a/code/__DEFINES/inventory/carry_weight.dm +++ /dev/null @@ -1,68 +0,0 @@ -//? Carry strength defines - -#define CARRY_STRENGTH_BASELINE 15 -#define CARRY_STRENGTH_UNATHI 20 -#define CARRY_STRENGTH_PROTEAN 22.5 -#define CARRY_STRENGTH_LIGHTADAPT_NEPID 17.5 -#define CARRY_STRENGTH - -#warn AOIGHAOIGJOIWAJOIJ - -//? Carry weight defines - -#define CARRY_WEIGHT_BASELINE 0 - -//* Tools - -#define CARRY_WEIGHT_HYBRID_TOOLS 1 - -//* Armor - -#define CARRY_WEIGHT_ARMOR_LIGHT 5 - -#define CARRY_WEIGHT_ARMOR_SPECIALIZED_VEST 10 - -#define CARRY_WEIGHT_ARMOR_PLATE_ARMOR 20 -#define CARRY_WEIGHT_ARMOR_CHAINMAIL_ARMOR 15 - -#define CARRY_WEIGHT_ARMOR_BIORADSUIT 17.5 -#define CARRY_WEIGHT_ARMOR_BIORADSUIT_HELMET 7.5 -#define CARRY_WEIGHT_ARMOR_FIRESUIT 17.5 -#define CARRY_WEIGHT_ARMOR_FIRESUIT_HELMET 7.5 - -//* Shoes - -#define CARRY_WEIGHT_SHOES_CUFFED 150 - -//* Weapons - -#define CARRY_WEIGHT_GUN_LIGHT 3 -#define CARRY_WEIGHT_GUN_NORMAL 5 -#define CARRY_WEIGHT_GUN_LARGE 7.5 -#define CARRY_WEIGHT_GUN_BULKY 10 -#define CARRY_WEIGHT_GUN_UNREASONABLE 15 -#define CARRY_WEIGHT_GUN_RIDICULOUS 30 -#define CARRY_WEIGHT_GUN_VEHICLE 60 - -//* Spacesuits / RIGs - -#define CARRY_WEIGHT_LEGACY_RIG_TECHNICIAN 10 -#define CARRY_WEIGHT_LEGACY_RIG_PARAMEDIC 10 -#define CARRY_WEIGHT_LEGACY_RIG_COMBAT 15 -#define CARRY_WEIGHT_LEGACY_RIG_MILITARY 20 - -//* Antags - -#define CARRY_WEIGHT_CHANGELING_ARMOR 20 -#define CARRY_WEIGHT_CULT_VOIDSUIT_HELMET 5 -#define CARRY_WEIGHT_CULT_VOIDSUIT 20 -#define CARRY_WEIGHT_TECHNOMANCER_BULKY_CORE 10 - -//* Species - -#define CARRY_WEIGHT_PHORONOID_SUIT 20 -#define CARRY_WEIGHT_PHORONOID_HELMET 5 - -//* Storage - -#define CARRY_WEIGHT_STORAGE_DUFFLEBAG 15 diff --git a/code/__DEFINES/inventory/weight.dm b/code/__DEFINES/inventory/weight.dm new file mode 100644 index 000000000000..2b52c5b58cd9 --- /dev/null +++ b/code/__DEFINES/inventory/weight.dm @@ -0,0 +1,120 @@ +//? Despite this being weight.dm, this contains defines for: +//? carry strength - how much someone can carry +//? weight - how much stuff weighs +//? encumberence - how hard it is to move with an item + +//? Carry strength - flat strength + +#define CARRY_STRENGTH_BASELINE 15 +#define CARRY_STRENGTH_UNATHI 20 +#define CARRY_STRENGTH_PROTEAN 22.5 +#define CARRY_STRENGTH_LIGHTADAPT_NEPID 17.5 +#define CARRY_STRENGTH + +//? Carry strength - multiplier for over-limit penalty + +#define CARRY_STRENGTH_FACTOR_BASELINE 10 + +#warn AOIGHAOIGJOIWAJOIJ + +//? Item Encumbrance defines + +#define ITEM_ENCUMBRANCE_BASELINE 0 + +//* Armor + +#define ITEM_ENCUMBRANCE_ARMOR_SPECIALIZED_VEST 5 + +#define ITEM_ENCUMBRANCE_ARMOR_BIORAD_SUIT 15 +#define ITEM_ENCUMBRANCE_ARMOR_BIORAD_HELMET 1 +#define ITEM_ENCUMBRANCE_ARMOR_BOMB_SUIT 15 +#define ITEM_ENCUMBRANCE_ARMOR_BOMB_HELMET 1 +#define ITEM_ENCUMBRANCE_ARMOR_FIRE_SUIT 15 +#define ITEM_ENCUMBRANCE_ARMOR_FIRE_HELMET 1 + +#define ITEM_ENCUMBRANCE_ARMOR_MEDIEVAL_PLATE 20 +#define ITEM_ENCUMBRANCE_ARMOR_MEDIEVAL_CHAIN 15 + +//* Factions + +#define ITEM_ENCUMBRANCE_CULT_VOIDSUIT 15 +#define ITEM_ENCUMBRANCE_CULT_VOIDSUIT_HELMET 1 + +//* Spacesuits + +#define ITEM_ENCUMBRANCE_SOFTSUIT 15 +#define ITEM_ENCUMBRANCE_SOFTSUIT_HELMET 1 +#define ITEM_ENCUMBRANCE_VOIDSUIT 15 +#define ITEM_ENCUMBRANCE_VOIDSUIT_HELMET 1 +#define ITEM_ENCUMBRANCE_RIGSUIT 15 + +//* Storage + +#define ITEM_ENCUMBRANCE_STORAGE_BACKPACK 5 +#define ITEM_ENCUMBRANCE_STORAGE_DUFFLEBAG 15 + +//* Weapons + +#define ITEM_ENCUMBRANCE_MELEE_SPEAR 15 + +//? Item Weight defines + +#define CARRY_WEIGHT_BASELINE 0 + +//* Tools + +#define CARRY_WEIGHT_HYBRID_TOOLS 1 + +//* Armor + +#define CARRY_WEIGHT_ARMOR_LIGHT 5 + +#define CARRY_WEIGHT_ARMOR_SPECIALIZED_VEST 10 + +#define CARRY_WEIGHT_ARMOR_BIORAD_SUIT 17.5 +#define CARRY_WEIGHT_ARMOR_BIORAD_SUIT_HELMET 7.5 +#define CARRY_WEIGHT_ARMOR_FIRE_SUIT 17.5 +#define CARRY_WEIGHT_ARMOR_FIRE_SUIT_HELMET 7.5 + +#define CARRY_WEIGHT_ARMOR_MEDIEVAL_PLATE 20 +#define CARRY_WEIGHT_ARMOR_MEDIEVAL_CHAIN 15 + +//* Shoes + +#define CARRY_WEIGHT_SHOES_CUFFED 150 + +//* Weapons + +#define CARRY_WEIGHT_GUN_LIGHT 3 +#define CARRY_WEIGHT_GUN_NORMAL 5 +#define CARRY_WEIGHT_GUN_LARGE 7.5 +#define CARRY_WEIGHT_GUN_BULKY 10 +#define CARRY_WEIGHT_GUN_UNREASONABLE 15 +#define CARRY_WEIGHT_GUN_RIDICULOUS 30 +#define CARRY_WEIGHT_GUN_VEHICLE 60 + +#define CARRY_WEIGHT_MELEE_SPEAR 10 + +//* Spacesuits / RIGs + +#define CARRY_WEIGHT_LEGACY_RIG_TECHNICIAN 10 +#define CARRY_WEIGHT_LEGACY_RIG_PARAMEDIC 10 +#define CARRY_WEIGHT_LEGACY_RIG_COMBAT 15 +#define CARRY_WEIGHT_LEGACY_RIG_MILITARY 20 + +//* Antags + +#define CARRY_WEIGHT_CHANGELING_ARMOR 20 +#define CARRY_WEIGHT_CULT_VOIDSUIT_HELMET 5 +#define CARRY_WEIGHT_CULT_VOIDSUIT 20 +#define CARRY_WEIGHT_TECHNOMANCER_BULKY_CORE 10 + +//* Species + +#define CARRY_WEIGHT_PHORONOID_SUIT 20 +#define CARRY_WEIGHT_PHORONOID_HELMET 5 + +//* Storage + +#define CARRY_WEIGHT_STORAGE_DUFFLEBAG 15 +#define CARRY_WEIGHT_STORAGE_BACKPACK 10 diff --git a/code/game/gamemodes/cult/cult_items.dm b/code/game/gamemodes/cult/cult_items.dm index e606043db452..718616249288 100644 --- a/code/game/gamemodes/cult/cult_items.dm +++ b/code/game/gamemodes/cult/cult_items.dm @@ -107,6 +107,7 @@ icon_state = "cult_helmet" origin_tech = list(TECH_MATERIAL = 3, TECH_ARCANE = 1) armor_type = /datum/armor/cult/space + encumbrance = ITEM_ENCUMBRANCE_CULT_VOIDSUIT_HELMET carry_weight = CARRY_WEIGHT_CULT_VOIDSUIT_HELMET siemens_coefficient = 0 @@ -121,6 +122,7 @@ w_class = ITEMSIZE_NORMAL allowed = list(/obj/item/book/tome,/obj/item/melee/cultblade,/obj/item/tank/emergency/oxygen,/obj/item/suit_cooling_unit) carry_weight = CARRY_WEIGHT_CULT_VOIDSUIT + encumbrance = ITEM_ENCUMBRANCE_CULT_VOIDSUIT armor_type = /datum/armor/cult/space siemens_coefficient = 0 inv_hide_flags = HIDEGLOVES|HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 91c6dc9eb6e8..0aeb38f22eb3 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -36,15 +36,23 @@ /// economic category for items var/economic_category_item = ECONOMIC_CATEGORY_ITEM_DEFAULT - //* Carry Weight - /// alternative carry weight, only used while equipped. this is for stuff that's light but should be encumbering. overrides carry_weight - var/carry_encumberence = CARRY_WEIGHT_BASELINE + //? Carry Weight + // todo: rename carry_weight to weight by getting rid of other var/weight variables. + + /// encumberance. + /// calculated as max() of all encumbrance + /// result is calculated into slowdown value + /// and then max()'d with carry weight for the final slowdown used. + var/encumbrance = ITEM_ENCUMBRANCE_BASELINE + /// registered encumbrance - null if not in inventory + var/encumbrance_cached /// carry weight in kgs. this might be generalized later so KEEP IT REALISTIC. var/carry_weight = CARRY_WEIGHT_BASELINE /// registered carry weight - null if not in inventory. var/carry_weight_cached /// Hard slowdown. Applied before carry weight. /// This affects multiplicative movespeed. + #warn regex to slowdown again var/hard_slowdown = 0 //? Combat @@ -782,6 +790,21 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. if(istype(wearer)) wearer.adjust_current_carry_weight(.) +/obj/item/proc/set_carry_weight(amount) + if(amount == carry_weight) + return + carry_weight = amount + if(!isnull(carry_encumberence)) + // we're being overridden, don't bother + return + update_carry_weight() + +/obj/item/proc/set_carry_encumberence(amount) + if(amount == carry_encumberence) + return + carry_encumberence = amount + update_carry_weight() + /** * grabs an attack verb to use * diff --git a/code/game/objects/items/storage/backpack.dm b/code/game/objects/items/storage/backpack.dm index 982b6c730402..16a398bd718d 100644 --- a/code/game/objects/items/storage/backpack.dm +++ b/code/game/objects/items/storage/backpack.dm @@ -10,6 +10,8 @@ w_class = ITEMSIZE_LARGE slot_flags = SLOT_BACK max_w_class = ITEMSIZE_LARGE + carry_weight = CARRY_WEIGHT_STORAGE_BACKPACK + encumbrance = ITEM_ENCUMBRANCE_STORAGE_BACKPACK max_storage_space = INVENTORY_STANDARD_SPACE var/flippable = 0 var/side = 0 //0 = right, 1 = left @@ -164,6 +166,7 @@ icon_state = "duffle" item_state_slots = list(SLOT_ID_RIGHT_HAND = "duffle", SLOT_ID_LEFT_HAND = "duffle") carry_weight = CARRY_WEIGHT_STORAGE_DUFFLEBAG + encumbrance = ITEM_ENCUMBRANCE_STORAGE_BACKPACK max_storage_space = INVENTORY_DUFFLEBAG_SPACE /obj/item/storage/backpack/dufflebag/syndie @@ -584,7 +587,8 @@ item_state = "saddlebag" icon_state = "saddlebag" max_storage_space = INVENTORY_DUFFLEBAG_SPACE //Saddlebags can hold more, like dufflebags - slowdown = 1 //And are slower, too...Unless you're a macro, that is. + encumbrance = ITEM_ENCUMBRANCE_STORAGE_DUFFLEBAG + carry_weight = CARRY_WEIGHT_STORAGE_DUFFLEBAG var/taurtype = /datum/sprite_accessory/tail/taur/horse //Acceptable taur type to be wearing this var/no_message = "You aren't the appropriate taur type to wear this!" diff --git a/code/game/objects/items/weapons/material/twohanded.dm b/code/game/objects/items/weapons/material/twohanded.dm index 7237c7e83ede..2323453a1bf9 100644 --- a/code/game/objects/items/weapons/material/twohanded.dm +++ b/code/game/objects/items/weapons/material/twohanded.dm @@ -219,7 +219,7 @@ fragile = 1 //It's a haphazard thing of glass, wire, and steel reach = 2 // Spears are long. attackspeed = 20 - slowdown = 1.05 + carry_weight = CARRY_WEIGHT_MELEE_SPEAR var/obj/item/grenade/explosive = null var/war_cry = "AAAAARGH!!!" diff --git a/code/modules/clothing/spacesuits/plasman.dm b/code/modules/clothing/spacesuits/plasman.dm index 1eb272cd323c..0b2530dcb9f5 100644 --- a/code/modules/clothing/spacesuits/plasman.dm +++ b/code/modules/clothing/spacesuits/plasman.dm @@ -7,6 +7,7 @@ icon_override = 'icons/mob/plasmeme/suits.dmi' desc = "A suit designed by NT to keep phoronoids from coming into contact with incompatible atmosphere. Seems like it doesn't protect from much else." carry_weight = CARRY_WEIGHT_PHORONOID_SUIT + encumbrance = ITEM_ENCUMBRANCE_SOFTSUIT clothing_flags = ALLOWINTERNALS armor_type = /datum/armor/phoronoid allowed = list(/obj/item/tank) @@ -36,6 +37,7 @@ armor_type = /datum/armor/phoronoid light_overlay = "plasmaman_overlay" carry_weight = CARRY_WEIGHT_PHORONOID_HELMET + encumbrance = ITEM_ENCUMBRANCE_SOFTSUIT_HELMET // // SEC diff --git a/code/modules/clothing/suits/armor.dm b/code/modules/clothing/suits/armor.dm index e830ec9c9e10..641eaeb10ba0 100644 --- a/code/modules/clothing/suits/armor.dm +++ b/code/modules/clothing/suits/armor.dm @@ -69,6 +69,7 @@ icon_state = "bulletproof" item_state_slots = list(SLOT_ID_RIGHT_HAND = "armor", SLOT_ID_LEFT_HAND = "armor") blood_overlay_type = "armor" + encumbrance = ITEM_ENCUMBRANCE_ARMOR_SPECIALIZED_VEST carry_weight = CARRY_WEIGHT_ARMOR_SPECIALIZED_VEST armor_type = /datum/armor/station/ballistic siemens_coefficient = 0.7 diff --git a/code/modules/clothing/suits/bio.dm b/code/modules/clothing/suits/bio.dm index ce29f21d0cec..5a8f43ea4e7c 100644 --- a/code/modules/clothing/suits/bio.dm +++ b/code/modules/clothing/suits/bio.dm @@ -10,6 +10,7 @@ siemens_coefficient = 0.9 atom_flags = PHORONGUARD clothing_flags = CLOTHING_THICK_MATERIAL | ALLOW_SURVIVALFOOD + encumbrance /obj/item/clothing/suit/bio_suit name = "bio suit" diff --git a/code/modules/clothing/suits/medieval_armor.dm b/code/modules/clothing/suits/medieval_armor.dm index 576e583b1606..5ca560505656 100644 --- a/code/modules/clothing/suits/medieval_armor.dm +++ b/code/modules/clothing/suits/medieval_armor.dm @@ -50,7 +50,8 @@ armor_type = /datum/armor/general/medieval icon = 'icons/clothing/suit/armor/medieval/knight.dmi' icon_state = "knight" - carry_weight = CARRY_WEIGHT_ARMOR_PLATE_ARMOR + encumbrance = ITEM_ENCUMBRANCE_ARMOR_MEDIEVAL_PLATE + carry_weight = CARRY_WEIGHT_ARMOR_MEDIEVIAL_PLATE inv_hide_flags = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETIE|HIDEHOLSTER body_cover_flags = UPPER_TORSO|LOWER_TORSO|ARMS|HANDS|LEGS|FEET worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL @@ -79,7 +80,8 @@ armor_type = /datum/armor/general/medieval/light icon = 'icons/clothing/suit/armor/medieval/bastard.dmi' icon_state = "bastard" - carry_weight = CARRY_WEIGHT_ARMOR_CHAINMAIL_ARMOR + carry_weight = CARRY_WEIGHT_ARMOR_MEDIEVAL_CHAIN + encumbrance = ITEM_ENCUMBRANCE_ARMOR_MEDIEVAL_CHAIN /obj/item/clothing/suit/armor/medieval/paladin name = "elite paladin plate" @@ -87,7 +89,8 @@ armor_type = /datum/armor/general/medieval/mesh icon = 'icons/clothing/suit/armor/medieval/paladin.dmi' icon_state = "paladin" - carry_weight = CARRY_WEIGHT_ARMOR_CHAINMAIL_ARMOR + carry_weight = CARRY_WEIGHT_ARMOR_MEDIEVAL_CHAIN + encumbrance = ITEM_ENCUMBRANCE_ARMOR_MEDIEVAL_CHAIN //Crusader stuff //Helmets diff --git a/code/modules/clothing/suits/utility.dm b/code/modules/clothing/suits/utility.dm index f5db974fd586..4a80632a7609 100644 --- a/code/modules/clothing/suits/utility.dm +++ b/code/modules/clothing/suits/utility.dm @@ -18,8 +18,8 @@ permeability_coefficient = 0.50 body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS allowed = list(/obj/item/flashlight,/obj/item/tank/emergency/oxygen,/obj/item/extinguisher) - carry_encumberence = CARRY_WEIGHT_ARMOR_FIRESUIT - carry_weight = CARRY_WEIGHT_ARMOR_LIGHT + carry_encumberence = ITEM_ENCUMBRANCE_ARMOR_FIRE_SUIT + carry_weight = CARRY_WEIGHT_ARMOR_FIRE_SUIT inv_hide_flags = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER clothing_flags = 0 heat_protection = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS @@ -79,6 +79,7 @@ body_cover_flags = HEAD|FACE|EYES armor_type = /datum/armor/general/radsuit carry_weight = CARRY_WEIGHT_ARMOR_BIORADSUIT_HELMET + encumbrance = ITEM_ENCUMBRANCE_ARMOR_BIORAD_HELMET /obj/item/clothing/suit/radiation name = "Radiation suit" @@ -93,3 +94,4 @@ armor_type = /datum/armor/general/radsuit inv_hide_flags = HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER clothing_flags = CLOTHING_THICK_MATERIAL + encumbrance = ITEM_ENCUMBRANCE_ARMOR_BIORAD_SUIT From 24fff2d6d485cfffdf287df5a56b71ab82f2d0a4 Mon Sep 17 00:00:00 2001 From: silicons Date: Thu, 27 Jul 2023 00:59:05 -0700 Subject: [PATCH 09/62] pain --- code/__DEFINES/inventory/weight.dm | 62 +++++++++---------- .../game/gamemodes/changeling/powers/armor.dm | 2 +- code/game/gamemodes/cult/cult_items.dm | 4 +- code/game/gamemodes/technomancer/core_obj.dm | 2 +- code/game/objects/items.dm | 2 +- code/game/objects/items/storage/backpack.dm | 8 +-- code/game/objects/items/tools/screwdriver.dm | 2 +- code/game/objects/items/tools/weldingtool.dm | 2 +- code/game/objects/items/tools/wirecutters.dm | 2 +- code/game/objects/items/tools/wrench.dm | 2 +- .../items/weapons/material/twohanded.dm | 2 +- code/game/objects/items/weapons/melee/misc.dm | 2 +- code/modules/clothing/shoes/colour.dm | 2 +- code/modules/clothing/spacesuits/plasman.dm | 4 +- code/modules/clothing/suits/armor.dm | 2 +- code/modules/clothing/suits/bio.dm | 4 +- code/modules/clothing/suits/medieval_armor.dm | 6 +- code/modules/clothing/suits/utility.dm | 6 +- code/modules/clothing/under/nanotrasen_vr.dm | 2 +- code/modules/fishing/fish.dm | 18 +++--- .../guns/magnetic/magnetic_railgun.dm | 10 +-- 21 files changed, 73 insertions(+), 73 deletions(-) diff --git a/code/__DEFINES/inventory/weight.dm b/code/__DEFINES/inventory/weight.dm index 2b52c5b58cd9..6233184960fa 100644 --- a/code/__DEFINES/inventory/weight.dm +++ b/code/__DEFINES/inventory/weight.dm @@ -59,62 +59,62 @@ //? Item Weight defines -#define CARRY_WEIGHT_BASELINE 0 +#define ITEM_WEIGHT_BASELINE 0 //* Tools -#define CARRY_WEIGHT_HYBRID_TOOLS 1 +#define ITEM_WEIGHT_HYBRID_TOOLS 1 //* Armor -#define CARRY_WEIGHT_ARMOR_LIGHT 5 +#define ITEM_WEIGHT_ARMOR_LIGHT 5 -#define CARRY_WEIGHT_ARMOR_SPECIALIZED_VEST 10 +#define ITEM_WEIGHT_ARMOR_SPECIALIZED_VEST 10 -#define CARRY_WEIGHT_ARMOR_BIORAD_SUIT 17.5 -#define CARRY_WEIGHT_ARMOR_BIORAD_SUIT_HELMET 7.5 -#define CARRY_WEIGHT_ARMOR_FIRE_SUIT 17.5 -#define CARRY_WEIGHT_ARMOR_FIRE_SUIT_HELMET 7.5 +#define ITEM_WEIGHT_ARMOR_BIORAD_SUIT 17.5 +#define ITEM_WEIGHT_ARMOR_BIORAD_SUIT_HELMET 7.5 +#define ITEM_WEIGHT_ARMOR_FIRE_SUIT 17.5 +#define ITEM_WEIGHT_ARMOR_FIRE_SUIT_HELMET 7.5 -#define CARRY_WEIGHT_ARMOR_MEDIEVAL_PLATE 20 -#define CARRY_WEIGHT_ARMOR_MEDIEVAL_CHAIN 15 +#define ITEM_WEIGHT_ARMOR_MEDIEVAL_PLATE 20 +#define ITEM_WEIGHT_ARMOR_MEDIEVAL_CHAIN 15 //* Shoes -#define CARRY_WEIGHT_SHOES_CUFFED 150 +#define ITEM_WEIGHT_SHOES_CUFFED 150 //* Weapons -#define CARRY_WEIGHT_GUN_LIGHT 3 -#define CARRY_WEIGHT_GUN_NORMAL 5 -#define CARRY_WEIGHT_GUN_LARGE 7.5 -#define CARRY_WEIGHT_GUN_BULKY 10 -#define CARRY_WEIGHT_GUN_UNREASONABLE 15 -#define CARRY_WEIGHT_GUN_RIDICULOUS 30 -#define CARRY_WEIGHT_GUN_VEHICLE 60 +#define ITEM_WEIGHT_GUN_LIGHT 3 +#define ITEM_WEIGHT_GUN_NORMAL 5 +#define ITEM_WEIGHT_GUN_LARGE 7.5 +#define ITEM_WEIGHT_GUN_BULKY 10 +#define ITEM_WEIGHT_GUN_UNREASONABLE 15 +#define ITEM_WEIGHT_GUN_RIDICULOUS 30 +#define ITEM_WEIGHT_GUN_VEHICLE 60 -#define CARRY_WEIGHT_MELEE_SPEAR 10 +#define ITEM_WEIGHT_MELEE_SPEAR 10 //* Spacesuits / RIGs -#define CARRY_WEIGHT_LEGACY_RIG_TECHNICIAN 10 -#define CARRY_WEIGHT_LEGACY_RIG_PARAMEDIC 10 -#define CARRY_WEIGHT_LEGACY_RIG_COMBAT 15 -#define CARRY_WEIGHT_LEGACY_RIG_MILITARY 20 +#define ITEM_WEIGHT_LEGACY_RIG_TECHNICIAN 10 +#define ITEM_WEIGHT_LEGACY_RIG_PARAMEDIC 10 +#define ITEM_WEIGHT_LEGACY_RIG_COMBAT 15 +#define ITEM_WEIGHT_LEGACY_RIG_MILITARY 20 //* Antags -#define CARRY_WEIGHT_CHANGELING_ARMOR 20 -#define CARRY_WEIGHT_CULT_VOIDSUIT_HELMET 5 -#define CARRY_WEIGHT_CULT_VOIDSUIT 20 -#define CARRY_WEIGHT_TECHNOMANCER_BULKY_CORE 10 +#define ITEM_WEIGHT_CHANGELING_ARMOR 20 +#define ITEM_WEIGHT_CULT_VOIDSUIT_HELMET 5 +#define ITEM_WEIGHT_CULT_VOIDSUIT 20 +#define ITEM_WEIGHT_TECHNOMANCER_BULKY_CORE 10 //* Species -#define CARRY_WEIGHT_PHORONOID_SUIT 20 -#define CARRY_WEIGHT_PHORONOID_HELMET 5 +#define ITEM_WEIGHT_PHORONOID_SUIT 20 +#define ITEM_WEIGHT_PHORONOID_HELMET 5 //* Storage -#define CARRY_WEIGHT_STORAGE_DUFFLEBAG 15 -#define CARRY_WEIGHT_STORAGE_BACKPACK 10 +#define ITEM_WEIGHT_STORAGE_DUFFLEBAG 15 +#define ITEM_WEIGHT_STORAGE_BACKPACK 10 diff --git a/code/game/gamemodes/changeling/powers/armor.dm b/code/game/gamemodes/changeling/powers/armor.dm index ac7102972fb2..de3825dfc55f 100644 --- a/code/game/gamemodes/changeling/powers/armor.dm +++ b/code/game/gamemodes/changeling/powers/armor.dm @@ -97,7 +97,7 @@ armor_type = /datum/armor/changeling/chitin siemens_coefficient = 0.3 max_heat_protection_temperature = FIRESUIT_MAX_HEAT_PROTECTION_TEMPERATURE - carry_weight = CARRY_WEIGHT_CHANGELING_ARMOR + carry_weight = ITEM_WEIGHT_CHANGELING_ARMOR /obj/item/clothing/suit/space/changeling/armored/Initialize(mapload) . = ..() diff --git a/code/game/gamemodes/cult/cult_items.dm b/code/game/gamemodes/cult/cult_items.dm index 718616249288..59701732829a 100644 --- a/code/game/gamemodes/cult/cult_items.dm +++ b/code/game/gamemodes/cult/cult_items.dm @@ -108,7 +108,7 @@ origin_tech = list(TECH_MATERIAL = 3, TECH_ARCANE = 1) armor_type = /datum/armor/cult/space encumbrance = ITEM_ENCUMBRANCE_CULT_VOIDSUIT_HELMET - carry_weight = CARRY_WEIGHT_CULT_VOIDSUIT_HELMET + carry_weight = ITEM_WEIGHT_CULT_VOIDSUIT_HELMET siemens_coefficient = 0 /obj/item/clothing/head/helmet/space/cult/cultify() @@ -121,7 +121,7 @@ desc = "A bulky suit of armour, bristling with spikes. It looks space-worthy." w_class = ITEMSIZE_NORMAL allowed = list(/obj/item/book/tome,/obj/item/melee/cultblade,/obj/item/tank/emergency/oxygen,/obj/item/suit_cooling_unit) - carry_weight = CARRY_WEIGHT_CULT_VOIDSUIT + carry_weight = ITEM_WEIGHT_CULT_VOIDSUIT encumbrance = ITEM_ENCUMBRANCE_CULT_VOIDSUIT armor_type = /datum/armor/cult/space siemens_coefficient = 0 diff --git a/code/game/gamemodes/technomancer/core_obj.dm b/code/game/gamemodes/technomancer/core_obj.dm index 0ef1d0c3118d..94771497e814 100644 --- a/code/game/gamemodes/technomancer/core_obj.dm +++ b/code/game/gamemodes/technomancer/core_obj.dm @@ -262,7 +262,7 @@ energy = 20000 max_energy = 20000 regen_rate = 25 //800 seconds to full - carry_weight = CARRY_WEIGHT_TECHNOMANCER_BULKY_CORE + carry_weight = ITEM_WEIGHT_TECHNOMANCER_BULKY_CORE instability_modifier = 1.0 spell_power_modifier = 1.4 diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 0aeb38f22eb3..4b3fd8de45e8 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -47,7 +47,7 @@ /// registered encumbrance - null if not in inventory var/encumbrance_cached /// carry weight in kgs. this might be generalized later so KEEP IT REALISTIC. - var/carry_weight = CARRY_WEIGHT_BASELINE + var/carry_weight = ITEM_WEIGHT_BASELINE /// registered carry weight - null if not in inventory. var/carry_weight_cached /// Hard slowdown. Applied before carry weight. diff --git a/code/game/objects/items/storage/backpack.dm b/code/game/objects/items/storage/backpack.dm index 16a398bd718d..7f8bc87c23cf 100644 --- a/code/game/objects/items/storage/backpack.dm +++ b/code/game/objects/items/storage/backpack.dm @@ -10,7 +10,7 @@ w_class = ITEMSIZE_LARGE slot_flags = SLOT_BACK max_w_class = ITEMSIZE_LARGE - carry_weight = CARRY_WEIGHT_STORAGE_BACKPACK + carry_weight = ITEM_WEIGHT_STORAGE_BACKPACK encumbrance = ITEM_ENCUMBRANCE_STORAGE_BACKPACK max_storage_space = INVENTORY_STANDARD_SPACE var/flippable = 0 @@ -165,7 +165,7 @@ desc = "A large dufflebag for holding extra things." icon_state = "duffle" item_state_slots = list(SLOT_ID_RIGHT_HAND = "duffle", SLOT_ID_LEFT_HAND = "duffle") - carry_weight = CARRY_WEIGHT_STORAGE_DUFFLEBAG + carry_weight = ITEM_WEIGHT_STORAGE_DUFFLEBAG encumbrance = ITEM_ENCUMBRANCE_STORAGE_BACKPACK max_storage_space = INVENTORY_DUFFLEBAG_SPACE @@ -174,7 +174,7 @@ desc = "A large dufflebag for holding extra tactical supplies. This one appears to be made out of lighter material than usual." icon_state = "duffle-syndie" item_state_slots = list(SLOT_ID_RIGHT_HAND = "duffle_syndie", SLOT_ID_LEFT_HAND = "duffle_syndie") - carry_weight = CARRY_WEIGHT_BASELINE + carry_weight = ITEM_WEIGHT_BASELINE /obj/item/storage/backpack/dufflebag/syndie/med name = "medical dufflebag" @@ -588,7 +588,7 @@ icon_state = "saddlebag" max_storage_space = INVENTORY_DUFFLEBAG_SPACE //Saddlebags can hold more, like dufflebags encumbrance = ITEM_ENCUMBRANCE_STORAGE_DUFFLEBAG - carry_weight = CARRY_WEIGHT_STORAGE_DUFFLEBAG + carry_weight = ITEM_WEIGHT_STORAGE_DUFFLEBAG var/taurtype = /datum/sprite_accessory/tail/taur/horse //Acceptable taur type to be wearing this var/no_message = "You aren't the appropriate taur type to wear this!" diff --git a/code/game/objects/items/tools/screwdriver.dm b/code/game/objects/items/tools/screwdriver.dm index 25b0fc1c2ec0..165f878f115b 100644 --- a/code/game/objects/items/tools/screwdriver.dm +++ b/code/game/objects/items/tools/screwdriver.dm @@ -113,7 +113,7 @@ icon_state = "hybscrewdriver" item_state = "screwdriver_black" origin_tech = list(TECH_MATERIAL = 3, TECH_ENGINEERING = 3) - carry_weight = CARRY_WEIGHT_HYBRID_TOOLS + carry_weight = ITEM_WEIGHT_HYBRID_TOOLS w_class = ITEMSIZE_NORMAL tool_sound = 'sound/effects/uncloak.ogg' tool_speed = 0.4 diff --git a/code/game/objects/items/tools/weldingtool.dm b/code/game/objects/items/tools/weldingtool.dm index 7d1b31cc8866..a02085bcc126 100644 --- a/code/game/objects/items/tools/weldingtool.dm +++ b/code/game/objects/items/tools/weldingtool.dm @@ -453,7 +453,7 @@ icon_state = "hybwelder" max_fuel = 80 eye_safety_modifier = -2 // Brighter than the sun. Literally, you can look at the sun with a welding mask of proper grade, this will burn through that. - carry_weight = CARRY_WEIGHT_HYBRID_TOOLS + carry_weight = ITEM_WEIGHT_HYBRID_TOOLS tool_speed = 0.25 w_class = ITEMSIZE_LARGE flame_intensity = 5 diff --git a/code/game/objects/items/tools/wirecutters.dm b/code/game/objects/items/tools/wirecutters.dm index 77843c63ca2b..5c800123cb68 100644 --- a/code/game/objects/items/tools/wirecutters.dm +++ b/code/game/objects/items/tools/wirecutters.dm @@ -107,7 +107,7 @@ catalogue_data = list(/datum/category_item/catalogue/anomalous/precursor_a/alien_wirecutters) icon_state = "hybcutters" w_class = ITEMSIZE_NORMAL - carry_weight = CARRY_WEIGHT_HYBRID_TOOLS + carry_weight = ITEM_WEIGHT_HYBRID_TOOLS origin_tech = list(TECH_MATERIAL = 3, TECH_ENGINEERING = 3, TECH_PHORON = 2) attack_verb = list("pinched", "nipped", "warped", "blasted") tool_sound = 'sound/effects/stealthoff.ogg' diff --git a/code/game/objects/items/tools/wrench.dm b/code/game/objects/items/tools/wrench.dm index 299d3abdc9e8..1a0cf123f922 100644 --- a/code/game/objects/items/tools/wrench.dm +++ b/code/game/objects/items/tools/wrench.dm @@ -81,7 +81,7 @@ damage_force = 8 throw_force = 10 w_class = ITEMSIZE_NORMAL - carry_weight = CARRY_WEIGHT_HYBRID_TOOLS + carry_weight = ITEM_WEIGHT_HYBRID_TOOLS origin_tech = list(TECH_MATERIAL = 3, TECH_ENGINEERING = 3, TECH_PHORON = 2) attack_verb = list("bashed", "battered", "bludgeoned", "whacked", "warped", "blasted") tool_sound = 'sound/effects/stealthoff.ogg' diff --git a/code/game/objects/items/weapons/material/twohanded.dm b/code/game/objects/items/weapons/material/twohanded.dm index 2323453a1bf9..e3b4e4da86a8 100644 --- a/code/game/objects/items/weapons/material/twohanded.dm +++ b/code/game/objects/items/weapons/material/twohanded.dm @@ -219,7 +219,7 @@ fragile = 1 //It's a haphazard thing of glass, wire, and steel reach = 2 // Spears are long. attackspeed = 20 - carry_weight = CARRY_WEIGHT_MELEE_SPEAR + carry_weight = ITEM_WEIGHT_MELEE_SPEAR var/obj/item/grenade/explosive = null var/war_cry = "AAAAARGH!!!" diff --git a/code/game/objects/items/weapons/melee/misc.dm b/code/game/objects/items/weapons/melee/misc.dm index a4535caa551f..130044590ea4 100644 --- a/code/game/objects/items/weapons/melee/misc.dm +++ b/code/game/objects/items/weapons/melee/misc.dm @@ -387,7 +387,7 @@ edge = 1 attack_verb = list("attacked", "smashed", "crushed", "wacked", "pounded") armor_penetration = 50 - carry_weight = CARRY_WEIGHT_BASELINE + carry_weight = ITEM_WEIGHT_BASELINE //This currently just kills the user. lol /* diff --git a/code/modules/clothing/shoes/colour.dm b/code/modules/clothing/shoes/colour.dm index 200139b6ba39..111636ec19e6 100644 --- a/code/modules/clothing/shoes/colour.dm +++ b/code/modules/clothing/shoes/colour.dm @@ -98,7 +98,7 @@ return chained = cuffs // todo: refactor - carry_encumberence = CARRY_WEIGHT_SHOES_CUFFED + carry_encumberence = ITEM_WEIGHT_SHOES_CUFFED update_carry_weight() icon_state = "orange1" diff --git a/code/modules/clothing/spacesuits/plasman.dm b/code/modules/clothing/spacesuits/plasman.dm index 0b2530dcb9f5..9ae6ec43a363 100644 --- a/code/modules/clothing/spacesuits/plasman.dm +++ b/code/modules/clothing/spacesuits/plasman.dm @@ -6,7 +6,7 @@ icon_state = "plasmaman_suit" icon_override = 'icons/mob/plasmeme/suits.dmi' desc = "A suit designed by NT to keep phoronoids from coming into contact with incompatible atmosphere. Seems like it doesn't protect from much else." - carry_weight = CARRY_WEIGHT_PHORONOID_SUIT + carry_weight = ITEM_WEIGHT_PHORONOID_SUIT encumbrance = ITEM_ENCUMBRANCE_SOFTSUIT clothing_flags = ALLOWINTERNALS armor_type = /datum/armor/phoronoid @@ -36,7 +36,7 @@ clothing_flags = ALLOWINTERNALS | FLEXIBLEMATERIAL armor_type = /datum/armor/phoronoid light_overlay = "plasmaman_overlay" - carry_weight = CARRY_WEIGHT_PHORONOID_HELMET + carry_weight = ITEM_WEIGHT_PHORONOID_HELMET encumbrance = ITEM_ENCUMBRANCE_SOFTSUIT_HELMET // diff --git a/code/modules/clothing/suits/armor.dm b/code/modules/clothing/suits/armor.dm index 641eaeb10ba0..87211429fca7 100644 --- a/code/modules/clothing/suits/armor.dm +++ b/code/modules/clothing/suits/armor.dm @@ -70,7 +70,7 @@ item_state_slots = list(SLOT_ID_RIGHT_HAND = "armor", SLOT_ID_LEFT_HAND = "armor") blood_overlay_type = "armor" encumbrance = ITEM_ENCUMBRANCE_ARMOR_SPECIALIZED_VEST - carry_weight = CARRY_WEIGHT_ARMOR_SPECIALIZED_VEST + carry_weight = ITEM_WEIGHT_ARMOR_SPECIALIZED_VEST armor_type = /datum/armor/station/ballistic siemens_coefficient = 0.7 diff --git a/code/modules/clothing/suits/bio.dm b/code/modules/clothing/suits/bio.dm index 5a8f43ea4e7c..0c4896832d03 100644 --- a/code/modules/clothing/suits/bio.dm +++ b/code/modules/clothing/suits/bio.dm @@ -20,7 +20,7 @@ gas_transfer_coefficient = 0.01 permeability_coefficient = 0.01 body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS|HANDS|FEET - carry_weight = CARRY_WEIGHT_ARMOR_BIORADSUIT + carry_weight = ITEM_WEIGHT_ARMOR_BIORADSUIT allowed = list(/obj/item/tank/emergency/oxygen,/obj/item/pen,/obj/item/flashlight/pen) armor_type = /datum/armor/general/biosuit inv_hide_flags = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER @@ -114,7 +114,7 @@ gas_transfer_coefficient = 0.01 permeability_coefficient = 0.01 body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS|HANDS|FEET - carry_weight = CARRY_WEIGHT_ARMOR_BIORADSUIT + carry_weight = ITEM_WEIGHT_ARMOR_BIORADSUIT allowed = list(/obj/item/tank/emergency/oxygen,/obj/item/pen,/obj/item/flashlight/pen) armor_type = /datum/armor/general/beekeeper inv_hide_flags = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER diff --git a/code/modules/clothing/suits/medieval_armor.dm b/code/modules/clothing/suits/medieval_armor.dm index 5ca560505656..833d1509a3f4 100644 --- a/code/modules/clothing/suits/medieval_armor.dm +++ b/code/modules/clothing/suits/medieval_armor.dm @@ -51,7 +51,7 @@ icon = 'icons/clothing/suit/armor/medieval/knight.dmi' icon_state = "knight" encumbrance = ITEM_ENCUMBRANCE_ARMOR_MEDIEVAL_PLATE - carry_weight = CARRY_WEIGHT_ARMOR_MEDIEVIAL_PLATE + carry_weight = ITEM_WEIGHT_ARMOR_MEDIEVIAL_PLATE inv_hide_flags = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETIE|HIDEHOLSTER body_cover_flags = UPPER_TORSO|LOWER_TORSO|ARMS|HANDS|LEGS|FEET worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL @@ -80,7 +80,7 @@ armor_type = /datum/armor/general/medieval/light icon = 'icons/clothing/suit/armor/medieval/bastard.dmi' icon_state = "bastard" - carry_weight = CARRY_WEIGHT_ARMOR_MEDIEVAL_CHAIN + carry_weight = ITEM_WEIGHT_ARMOR_MEDIEVAL_CHAIN encumbrance = ITEM_ENCUMBRANCE_ARMOR_MEDIEVAL_CHAIN /obj/item/clothing/suit/armor/medieval/paladin @@ -89,7 +89,7 @@ armor_type = /datum/armor/general/medieval/mesh icon = 'icons/clothing/suit/armor/medieval/paladin.dmi' icon_state = "paladin" - carry_weight = CARRY_WEIGHT_ARMOR_MEDIEVAL_CHAIN + carry_weight = ITEM_WEIGHT_ARMOR_MEDIEVAL_CHAIN encumbrance = ITEM_ENCUMBRANCE_ARMOR_MEDIEVAL_CHAIN //Crusader stuff diff --git a/code/modules/clothing/suits/utility.dm b/code/modules/clothing/suits/utility.dm index 4a80632a7609..d1eb54dd2ca0 100644 --- a/code/modules/clothing/suits/utility.dm +++ b/code/modules/clothing/suits/utility.dm @@ -19,7 +19,7 @@ body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS allowed = list(/obj/item/flashlight,/obj/item/tank/emergency/oxygen,/obj/item/extinguisher) carry_encumberence = ITEM_ENCUMBRANCE_ARMOR_FIRE_SUIT - carry_weight = CARRY_WEIGHT_ARMOR_FIRE_SUIT + carry_weight = ITEM_WEIGHT_ARMOR_FIRE_SUIT inv_hide_flags = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER clothing_flags = 0 heat_protection = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS @@ -78,7 +78,7 @@ clothing_flags = CLOTHING_THICK_MATERIAL body_cover_flags = HEAD|FACE|EYES armor_type = /datum/armor/general/radsuit - carry_weight = CARRY_WEIGHT_ARMOR_BIORADSUIT_HELMET + carry_weight = ITEM_WEIGHT_ARMOR_BIORADSUIT_HELMET encumbrance = ITEM_ENCUMBRANCE_ARMOR_BIORAD_HELMET /obj/item/clothing/suit/radiation @@ -90,7 +90,7 @@ permeability_coefficient = 0.50 body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS|HANDS|FEET allowed = list(/obj/item/flashlight,/obj/item/tank/emergency/oxygen,/obj/item/clothing/head/radiation,/obj/item/clothing/mask/gas) - carry_weight = CARRY_WEIGHT_ARMOR_BIORADSUIT + carry_weight = ITEM_WEIGHT_ARMOR_BIORADSUIT armor_type = /datum/armor/general/radsuit inv_hide_flags = HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER clothing_flags = CLOTHING_THICK_MATERIAL diff --git a/code/modules/clothing/under/nanotrasen_vr.dm b/code/modules/clothing/under/nanotrasen_vr.dm index 7b536b8342bf..097bc8b5bdb2 100644 --- a/code/modules/clothing/under/nanotrasen_vr.dm +++ b/code/modules/clothing/under/nanotrasen_vr.dm @@ -52,4 +52,4 @@ icon_state = "webvest" item_state_slots = list(SLOT_ID_RIGHT_HAND = "swat", SLOT_ID_LEFT_HAND = "swat") armor_type = /datum/armor/station/tactical - carry_weight = CARRY_WEIGHT_ARMOR_LIGHT + carry_weight = ITEM_WEIGHT_ARMOR_LIGHT diff --git a/code/modules/fishing/fish.dm b/code/modules/fishing/fish.dm index 8d4a4068424a..6138d24cb885 100644 --- a/code/modules/fishing/fish.dm +++ b/code/modules/fishing/fish.dm @@ -14,9 +14,9 @@ /// Average size for this fish type in centimeters. Will be used as gaussian distribution with 20% deviation for fishing, bought fish are always standard size var/average_size = 50 /// Weight in grams - var/weight = 1000 - /// Average weight for this fish type in grams - var/average_weight = 1000 + var/fish_weight = 1000 + /// Average fish_weight for this fish type in grams + var/average_fish_weight = 1000 //? icon @@ -114,22 +114,22 @@ START_PROCESSING(SSobj, src) size = average_size - weight = average_weight + fish_weight = average_fish_weight /obj/item/fish/examine(mob/user, dist) . = ..() - // All spacemen have magic eyes of fish weight perception until fish scale (get it?) is implemented. + // All spacemen have magic eyes of fish fish_weight perception until fish scale (get it?) is implemented. . += SPAN_NOTICE("It's [size] cm long.") - . += SPAN_NOTICE("It weighs [weight] g.") + . += SPAN_NOTICE("It weighs [fish_weight] g.") /obj/item/fish/proc/randomize_weight_and_size(modifier = 0) var/size_deviation = 0.2 * average_size var/size_mod = modifier * average_size size = max(1,gaussian(average_size + size_mod, size_deviation)) - var/weight_deviation = 0.2 * average_weight - var/weight_mod = modifier * average_weight - weight = max(1,gaussian(average_weight + weight_mod, weight_deviation)) + var/weight_deviation = 0.2 * average_fish_weight + var/weight_mod = modifier * average_fish_weight + fish_weight = max(1,gaussian(average_fish_weight + weight_mod, weight_deviation)) /obj/item/fish/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change) . = ..() diff --git a/code/modules/projectiles/guns/magnetic/magnetic_railgun.dm b/code/modules/projectiles/guns/magnetic/magnetic_railgun.dm index 8cda78331515..f8c78196bb7a 100644 --- a/code/modules/projectiles/guns/magnetic/magnetic_railgun.dm +++ b/code/modules/projectiles/guns/magnetic/magnetic_railgun.dm @@ -12,7 +12,7 @@ heavy = TRUE slot_flags = SLOT_BELT loaded = /obj/item/rcd_ammo/large - slowdown = CARRY_WEIGHT_GUN_BULKY // Slowdown equals slowdown_worn, until we decide to import the system to differentiate between held and worn items + slowdown = ITEM_WEIGHT_GUN_BULKY // Slowdown equals slowdown_worn, until we decide to import the system to differentiate between held and worn items fire_delay = 1 var/initial_cell_type = /obj/item/cell/hyper @@ -62,7 +62,7 @@ initial_capacitor_type = /obj/item/stock_parts/capacitor/super fire_delay = 0 - slowdown = CARRY_WEIGHT_GUN_RIDICULOUS + slowdown = ITEM_WEIGHT_GUN_RIDICULOUS slot_flags = SLOT_BACK w_class = ITEMSIZE_NO_CONTAINER @@ -91,7 +91,7 @@ slot_flags = SLOT_BACK - slowdown = CARRY_WEIGHT_GUN_LIGHT + slowdown = ITEM_WEIGHT_GUN_LIGHT power_cost = 100 load_type = /obj/item/magnetic_ammo @@ -121,7 +121,7 @@ slot_flags = SLOT_BACK - slowdown = CARRY_WEIGHT_GUN_LIGHT + slowdown = ITEM_WEIGHT_GUN_LIGHT power_cost = 400 projectile_type = /obj/projectile/bullet/magnetic/heated @@ -177,7 +177,7 @@ slot_flags = SLOT_BACK - slowdown = CARRY_WEIGHT_GUN_NORMAL + slowdown = ITEM_WEIGHT_GUN_NORMAL power_cost = 200 projectile_type = /obj/projectile/bullet/magnetic/flechette/hunting From 2355d1d3ea7f2870d9be0f8f394a4a458e82e8a5 Mon Sep 17 00:00:00 2001 From: silicons Date: Thu, 27 Jul 2023 01:02:12 -0700 Subject: [PATCH 10/62] sigh --- .../inventory/{weight.dm => carry_weight.dm} | 2 +- code/game/objects/items.dm | 6 ++-- code/modules/mob/inventory/items.dm | 2 ++ code/modules/mob/living/inventory.dm | 34 ++++++++----------- code/modules/mob/living/living_defines.dm | 2 ++ 5 files changed, 23 insertions(+), 23 deletions(-) rename code/__DEFINES/inventory/{weight.dm => carry_weight.dm} (97%) diff --git a/code/__DEFINES/inventory/weight.dm b/code/__DEFINES/inventory/carry_weight.dm similarity index 97% rename from code/__DEFINES/inventory/weight.dm rename to code/__DEFINES/inventory/carry_weight.dm index 6233184960fa..c229bd8b89bf 100644 --- a/code/__DEFINES/inventory/weight.dm +++ b/code/__DEFINES/inventory/carry_weight.dm @@ -1,4 +1,4 @@ -//? Despite this being weight.dm, this contains defines for: +//? Despite this being carry_weight.dm, this contains defines for: //? carry strength - how much someone can carry //? weight - how much stuff weighs //? encumberence - how hard it is to move with an item diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 4b3fd8de45e8..024d31811d3e 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -45,11 +45,11 @@ /// and then max()'d with carry weight for the final slowdown used. var/encumbrance = ITEM_ENCUMBRANCE_BASELINE /// registered encumbrance - null if not in inventory - var/encumbrance_cached + var/encumbrance_registered /// carry weight in kgs. this might be generalized later so KEEP IT REALISTIC. - var/carry_weight = ITEM_WEIGHT_BASELINE + var/weight = ITEM_WEIGHT_BASELINE /// registered carry weight - null if not in inventory. - var/carry_weight_cached + var/weight_registered /// Hard slowdown. Applied before carry weight. /// This affects multiplicative movespeed. #warn regex to slowdown again diff --git a/code/modules/mob/inventory/items.dm b/code/modules/mob/inventory/items.dm index 0bd5ab9e052a..95887c6da480 100644 --- a/code/modules/mob/inventory/items.dm +++ b/code/modules/mob/inventory/items.dm @@ -108,6 +108,7 @@ var/mob/living/L = user L.remove_current_carry_weight(carry_weight_cached) carry_weight_cached = null + #warn *scream return ((. & COMPONENT_ITEM_DROPPED_RELOCATE)? ITEM_RELOCATED_BY_DROPPED : NONE) @@ -135,6 +136,7 @@ if(isliving(user)) var/mob/living/L = user L.add_current_carry_weight(carry_weight_cached) + #warn *scream /** * get the slowdown we incur when we're worn diff --git a/code/modules/mob/living/inventory.dm b/code/modules/mob/living/inventory.dm index 7ae2a20c840c..88523a817fef 100644 --- a/code/modules/mob/living/inventory.dm +++ b/code/modules/mob/living/inventory.dm @@ -258,12 +258,14 @@ //* carry weight +#warn rework encumbrance + // don't call this you shouldn't need to -/mob/living/proc/update_carry_weight() - recalculate_carry_weight() - update_carry_weight_slowdown() +/mob/living/proc/update_carry() + recalculate_carry() + update_carry_slowdown() -/mob/living/proc/recalculate_carry_weight() +/mob/living/proc/recalculate_carry() var/tally = 0 for(var/obj/item/I as anything in get_equipped_items()) tally += I.get_carry_weight() @@ -272,34 +274,28 @@ cached_carry_weight = tally update_carry_weight_slowdown() -/mob/living/proc/add_current_carry_weight(amount) +/mob/living/proc/adjust_current_carry_weight(amount) if(!amount) return cached_carry_weight += amount update_carry_weight_slowdown() -/mob/living/proc/remove_current_carry_weight(amount) - if(!amount) - return - cached_carry_weight -= amount - update_carry_weight_slowdown() +/mob/living/proc/adjust_current_carry_encumbrance(amount) + #warn impl -/mob/living/proc/adjust_current_carry_weight(amount) - if(!amount) - return - cached_carry_weight += tally - update_carry_weight_slowdown() +/mob/living/proc/carry_weight_to_slowdown(amount) + return 0 + +/mob/living/proc/carry_encumbrance_to_slowdown(amount) + return 0 -/mob/living/proc/update_carry_weight_slowdown() +/mob/living/proc/update_carry_slowdown() var/slowdown = carry_weight_to_slowdown(cached_carry_weight) if(slowdown) add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/mob_carry_weight, multiplicative_slowdown = slowdown) else remove_movespeed_modifier(/datum/movespeed_modifier/mob_carry_weight) -/mob/living/proc/carry_weight_to_slowdown(amount) - return 0 - //* hard movespeed slowdown /mob/living/proc/update_item_movespeed() diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index 4689cd20b70d..74dca58b91c0 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -127,6 +127,8 @@ // todo: put all this on /datum/inventory after hand refactor /// cached carry weight of all items var/cached_carry_weight = 0 + /// cached encumbrance of all items + var/cached_encumbrance = 0 //? movement /// are we currently pushing (or trying to push) (or otherwise inside Bump() handling that deals with this crap) another atom? From e2d2fdaf9f832a0af4e3ad77b3c498fdb090517e Mon Sep 17 00:00:00 2001 From: silicons Date: Thu, 27 Jul 2023 01:04:37 -0700 Subject: [PATCH 11/62] sigh --- citadel.dme | 2 +- code/game/objects/items.dm | 19 +++++++++++++++---- code/game/objects/items/storage/_storage.dm | 6 ++++++ code/modules/clothing/clothing.dm | 9 +++++---- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/citadel.dme b/citadel.dme index 30d9acfc9d21..58f2d5513762 100644 --- a/citadel.dme +++ b/citadel.dme @@ -190,12 +190,12 @@ #include "code\__DEFINES\fishing\fishing.dm" #include "code\__DEFINES\inventory\accessories.dm" #include "code\__DEFINES\inventory\bodytypes.dm" +#include "code\__DEFINES\inventory\carry_weight.dm" #include "code\__DEFINES\inventory\icons.dm" #include "code\__DEFINES\inventory\misc.dm" #include "code\__DEFINES\inventory\procs.dm" #include "code\__DEFINES\inventory\rendering.dm" #include "code\__DEFINES\inventory\slots.dm" -#include "code\__DEFINES\inventory\weight.dm" #include "code\__DEFINES\items\hypospray.dm" #include "code\__DEFINES\items\inducer.dm" #include "code\__DEFINES\items\nifs.dm" diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 024d31811d3e..fb3aa85e2afb 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -776,10 +776,16 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. //* Carry Weight -/obj/item/proc/get_carry_weight() +#warn rework encumbrance + +/obj/item/proc/get_weight() return isnull(carry_encumberence)? carry_weight : carry_encumberence -/obj/item/proc/update_carry_weight() +/obj/item/proc/get_encumbrance() + #warn impl + +/obj/item/proc/update_weight() + #warn impl if(isnull(carry_weight_cached)) return null . = get_carry_weight() @@ -790,7 +796,11 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. if(istype(wearer)) wearer.adjust_current_carry_weight(.) -/obj/item/proc/set_carry_weight(amount) +/obj/item/proc/update_encumbrance() + #warn impl + +/obj/item/proc/set_weight(amount) + #warn impl if(amount == carry_weight) return carry_weight = amount @@ -799,7 +809,8 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. return update_carry_weight() -/obj/item/proc/set_carry_encumberence(amount) +/obj/item/proc/set_encumberence(amount) + #warn impl if(amount == carry_encumberence) return carry_encumberence = amount diff --git a/code/game/objects/items/storage/_storage.dm b/code/game/objects/items/storage/_storage.dm index 811c90be8cb8..f28a33ab54c9 100644 --- a/code/game/objects/items/storage/_storage.dm +++ b/code/game/objects/items/storage/_storage.dm @@ -38,6 +38,12 @@ var/last_message = 0 + #warn hook + /// carry weight mitigation, static. applied after multiplicative + var/weight_mitigation = 0 + /// carry weight mitigation, multiplicative. + var/weight_multiply = 1 + /obj/item/storage/Destroy() close_all() QDEL_NULL(boxes) diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 52a22484e6fe..c4312a52fc40 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -62,10 +62,11 @@ var/list/accessories //* Carry Weight - /// carry weight compensation for accessories - flat. can't be negative, that makes no sense. - var/weight_compensation_flat = 0 - /// carry weight compensation for accessories - multiplier. applied before flat. 0 to 1. - var/weight_compensation_mult = 0 + #warn hook + /// encumbrance compensation for accessories - flat. + var/encumbrance_mitigation = 0 + /// encumbrance multiplier for accessories. + var/encumbrance_multiply = 1 /obj/item/clothing/Initialize(mapload) . = ..() From 84292d8733bbca9b688650ce4d23cf3c3f683991 Mon Sep 17 00:00:00 2001 From: silicons Date: Thu, 27 Jul 2023 02:17:18 -0700 Subject: [PATCH 12/62] a --- code/__DEFINES/inventory/carry_weight.dm | 47 +++++++++++++++++-- code/game/objects/items.dm | 14 ++++-- .../game/objects/items/weapons/tanks/tanks.dm | 2 + code/modules/clothing/clothing_accessories.dm | 2 +- code/modules/clothing/shoes/colour.dm | 6 +-- code/modules/clothing/spacesuits/plasman.dm | 8 ++-- .../modules/clothing/spacesuits/void/event.dm | 16 +++---- code/modules/clothing/spacesuits/void/merc.dm | 5 +- .../clothing/spacesuits/void/station.dm | 11 +++-- code/modules/clothing/spacesuits/void/void.dm | 17 ++++++- code/modules/fishing/fish.dm | 10 ++-- code/modules/mob/inventory.dm | 8 ++++ code/modules/mob/living/carbon/inventory.dm | 3 ++ code/modules/mob/living/inventory.dm | 35 +++++++------- code/modules/mob/living/living_defines.dm | 2 +- code/modules/movespeed/modifiers/mob.dm | 2 +- .../projectiles/guns/projectile/automatic.dm | 1 - code/modules/vehicles_legacy/construction.dm | 2 +- .../xenoarcheaology/tools/equipment.dm | 9 +++- 19 files changed, 146 insertions(+), 54 deletions(-) diff --git a/code/__DEFINES/inventory/carry_weight.dm b/code/__DEFINES/inventory/carry_weight.dm index c229bd8b89bf..39fce1b1cb1b 100644 --- a/code/__DEFINES/inventory/carry_weight.dm +++ b/code/__DEFINES/inventory/carry_weight.dm @@ -35,6 +35,13 @@ #define ITEM_ENCUMBRANCE_ARMOR_MEDIEVAL_PLATE 20 #define ITEM_ENCUMBRANCE_ARMOR_MEDIEVAL_CHAIN 15 +#define ITEM_ENCUMBRANCE_ARMOR_ANOMALY 10 +#define ITEM_ENCUMBRANCE_ARMOR_ANOMALY_HELMET 2.5 + +//* Clothing + +#define ITEM_ENCUMBRANCE_SHOES_CUFFED 50 + //* Factions #define ITEM_ENCUMBRANCE_CULT_VOIDSUIT 15 @@ -44,8 +51,19 @@ #define ITEM_ENCUMBRANCE_SOFTSUIT 15 #define ITEM_ENCUMBRANCE_SOFTSUIT_HELMET 1 + #define ITEM_ENCUMBRANCE_VOIDSUIT 15 -#define ITEM_ENCUMBRANCE_VOIDSUIT_HELMET 1 +#define ITEM_ENCUMBRANCE_VOIDSUIT_HELMET 0 +#define ITEM_ENCUMBRANCE_VOIDSUIT_LIGHT 10 +#define ITEM_ENCUMBRANCE_VOIDSUIT_HELMET_LIGHT 0 +#define ITEM_ENCUMBRANCE_VOIDSUIT_HEAVY 20 +#define ITEM_ENCUMBRANCE_VOIDSUIT_HELMET_HEAVY 0 +#define ITEM_ENCUMBRANCE_VOIDSUIT_ULTRALIGHT 5 +#define ITEM_ENCUMBRANCE_VOIDSUIT_HELMET_ULTRALIGHT 0 + +#define ITEM_ENCUMBRANCE_VOIDSUIT_ANOMALY 10 +#define ITEM_ENCUMBRANCE_VOIDSUIT_ANOMALY_HELMET 2.5 + #define ITEM_ENCUMBRANCE_RIGSUIT 15 //* Storage @@ -53,6 +71,11 @@ #define ITEM_ENCUMBRANCE_STORAGE_BACKPACK 5 #define ITEM_ENCUMBRANCE_STORAGE_DUFFLEBAG 15 +//* Species + +#define ITEM_ENCUMBRANCE_PHORONOID_SUIT 20 +#define ITEM_ENCUMBRANCE_PHORONOID_HELMET 2 + //* Weapons #define ITEM_ENCUMBRANCE_MELEE_SPEAR 15 @@ -79,9 +102,15 @@ #define ITEM_WEIGHT_ARMOR_MEDIEVAL_PLATE 20 #define ITEM_WEIGHT_ARMOR_MEDIEVAL_CHAIN 15 -//* Shoes +#define ITEM_WEIGHT_ARMOR_ANOMALY 10 +#define ITEM_WEIGHT_ARMOR_ANOMALY_HELMET 2.5 -#define ITEM_WEIGHT_SHOES_CUFFED 150 +//* Clothing + +//* Items + +#define ITEM_WEIGHT_GAS_TANK 3 +#define ITEM_WEIGHT_VEHICLE_FRAME 50 //* Weapons @@ -97,6 +126,18 @@ //* Spacesuits / RIGs +#define ITEM_WEIGHT_VOIDSUIT 15 +#define ITEM_WEIGHT_VOIDSUIT_HELMET 5 +#define ITEM_WEIGHT_VOIDSUIT_LIGHT 10 +#define ITEM_WEIGHT_VOIDSUIT_HELMET_LIGHT 2.5 +#define ITEM_WEIGHT_VOIDSUIT_HEAVY 20 +#define ITEM_WEIGHT_VOIDSUIT_HELMET_HEAVY 7.5 +#define ITEM_WEIGHT_VOIDSUIT_ULTRALIGHT 5 +#define ITEM_WEIGHT_VOIDSUIT_HELMET_ULTRALIGHT 0 + +#define ITEM_WEIGHT_VOIDSUIT_ANOMALY 10 +#define ITEM_WEIGHT_VOIDSUIT_ANOMALY_HELMET 2.5 + #define ITEM_WEIGHT_LEGACY_RIG_TECHNICIAN 10 #define ITEM_WEIGHT_LEGACY_RIG_PARAMEDIC 10 #define ITEM_WEIGHT_LEGACY_RIG_COMBAT 15 diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index fb3aa85e2afb..a2e311498a76 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -256,7 +256,7 @@ /obj/item/examine(mob/user, dist) . = ..() . += "[gender == PLURAL ? "They are" : "It is"] a [weightclass2text(w_class)] item." - switch(get_carry_weight()) + switch(max(get_encumbrance(), get_weight())) if(-INFINITY to 0.1) . += "It looks like it weighs practically nothing." if(0.1 to 0.75) @@ -774,7 +774,7 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. // . = ..() // update_action_buttons() -//* Carry Weight +//? Carry Weight #warn rework encumbrance @@ -809,13 +809,21 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. return update_carry_weight() -/obj/item/proc/set_encumberence(amount) +/obj/item/proc/set_encumbrance(amount) #warn impl if(amount == carry_encumberence) return carry_encumberence = amount update_carry_weight() +/obj/item/proc/set_slowdown(amount) + if(amount == hard_slowdown) + return + hard_slowdown = amount + worn_mob()?.update_item_slowdown() + +//? Attack Verbs + /** * grabs an attack verb to use * diff --git a/code/game/objects/items/weapons/tanks/tanks.dm b/code/game/objects/items/weapons/tanks/tanks.dm index 792dd885b539..8faf98c4c3b7 100644 --- a/code/game/objects/items/weapons/tanks/tanks.dm +++ b/code/game/objects/items/weapons/tanks/tanks.dm @@ -25,6 +25,8 @@ var/list/global/tank_gauge_cache = list() throw_speed = 1 throw_range = 4 + weight = ITEM_WEIGHT_GAS_TANK + var/datum/gas_mixture/air_contents = null var/distribute_pressure = ONE_ATMOSPHERE integrity = 20 diff --git a/code/modules/clothing/clothing_accessories.dm b/code/modules/clothing/clothing_accessories.dm index c906df2d3deb..994aee6cc073 100644 --- a/code/modules/clothing/clothing_accessories.dm +++ b/code/modules/clothing/clothing_accessories.dm @@ -15,7 +15,7 @@ return accessory_host.update_worn_icon() return ..() -/obj/item/clothing/get_carry_weight() +/obj/item/clothing/get_weight() . = ..() var/tally = 0 for(var/obj/item/I as anything in accessories) diff --git a/code/modules/clothing/shoes/colour.dm b/code/modules/clothing/shoes/colour.dm index 111636ec19e6..ac842ba48028 100644 --- a/code/modules/clothing/shoes/colour.dm +++ b/code/modules/clothing/shoes/colour.dm @@ -98,8 +98,7 @@ return chained = cuffs // todo: refactor - carry_encumberence = ITEM_WEIGHT_SHOES_CUFFED - update_carry_weight() + set_encumbrance(ITEM_ENCUMBRANCE_SHOES_CUFFED) icon_state = "orange1" /obj/item/clothing/shoes/orange/proc/remove_cuffs(mob/user as mob) @@ -110,8 +109,7 @@ chained.add_fingerprint(user) // todo: refactor - carry_encumberence = initial(carry_encumberence) - update_carry_weight() + set_encumbrance(initial(carry_encumberence)) icon_state = "orange" chained = null diff --git a/code/modules/clothing/spacesuits/plasman.dm b/code/modules/clothing/spacesuits/plasman.dm index 9ae6ec43a363..c1e84360c7e8 100644 --- a/code/modules/clothing/spacesuits/plasman.dm +++ b/code/modules/clothing/spacesuits/plasman.dm @@ -6,8 +6,8 @@ icon_state = "plasmaman_suit" icon_override = 'icons/mob/plasmeme/suits.dmi' desc = "A suit designed by NT to keep phoronoids from coming into contact with incompatible atmosphere. Seems like it doesn't protect from much else." - carry_weight = ITEM_WEIGHT_PHORONOID_SUIT - encumbrance = ITEM_ENCUMBRANCE_SOFTSUIT + weight = ITEM_WEIGHT_PHORONOID_SUIT + encumbrance = ITEM_ENCUMBRANCE_PHORONOID_SUIT clothing_flags = ALLOWINTERNALS armor_type = /datum/armor/phoronoid allowed = list(/obj/item/tank) @@ -36,8 +36,8 @@ clothing_flags = ALLOWINTERNALS | FLEXIBLEMATERIAL armor_type = /datum/armor/phoronoid light_overlay = "plasmaman_overlay" - carry_weight = ITEM_WEIGHT_PHORONOID_HELMET - encumbrance = ITEM_ENCUMBRANCE_SOFTSUIT_HELMET + weight = ITEM_WEIGHT_PHORONOID_HELMET + encumbrance = ITEM_ENCUMBRANCE_PHORONOID_HELMET // // SEC diff --git a/code/modules/clothing/spacesuits/void/event.dm b/code/modules/clothing/spacesuits/void/event.dm index fcfbc95dd36a..517c33a705bd 100644 --- a/code/modules/clothing/spacesuits/void/event.dm +++ b/code/modules/clothing/spacesuits/void/event.dm @@ -11,13 +11,16 @@ item_state_slots = list(SLOT_ID_RIGHT_HAND = "syndicate-helm-black", SLOT_ID_LEFT_HAND = "syndicate-helm-black") armor_type = /datum/armor/vintage/space light_overlay = "helmet_light" + encumbrance = ITEM_ENCUMBRANCE_VOIDSUIT_HELMET_LIGHT + weight = ITEM_WEIGHT_VOIDSUIT_HELMET_LIGHT /obj/item/clothing/suit/space/void/refurb name = "vintage crewman's voidsuit" desc = "A refurbished early contact era voidsuit of human design. These things aren't especially good against modern weapons but they're sturdy, incredibly easy to come by, and there are lots of spare parts for repairs. Many old-timer spacers swear by these old things, even if new powered hardsuits have more features and better armor. This one is devoid of any identifying markings or rank indicators." icon_state = "rig-vintagecrew" item_state_slots = list(SLOT_ID_RIGHT_HAND = "sec_voidsuitTG", SLOT_ID_LEFT_HAND = "sec_voidsuitTG") - slowdown = 0.5 + encumbrance = ITEM_ENCUMBRANCE_VOIDSUIT_LIGHT + weight = ITEM_WEIGHT_VOIDSUIT_LIGHT armor_type = /datum/armor/vintage/space allowed = list(/obj/item/flashlight, /obj/item/tank, @@ -47,7 +50,6 @@ desc = "A refurbished early contact era voidsuit of human design. These things aren't especially good against modern weapons but they're sturdy, incredibly easy to come by, and there are lots of spare parts for repairs. This one in particular seems to be an ode to the Ship of Theseus, but the insulation and radiation proofing are top-notch. The chestplate bears the logo of an old shipyard - though you don't recognize the name." icon_state = "rig-vintageengi" item_state_slots = list(SLOT_ID_RIGHT_HAND = "sec_voidsuitTG", SLOT_ID_LEFT_HAND = "sec_voidsuitTG") - slowdown = 1 armor_type = /datum/armor/vintage/space/engi min_pressure_protection = 0 * ONE_ATMOSPHERE max_pressure_protection = 15 * ONE_ATMOSPHERE @@ -93,7 +95,6 @@ desc = "A refurbished early contact era voidsuit of human design. These things aren't especially good against modern weapons but they're sturdy, incredibly easy to come by, and there are lots of spare parts for repairs. Many old-timer spacers swear by these old things, even if new powered hardsuits have more features and better armor. The green and white markings indicate this as a medic's suit." icon_state = "rig-vintagemedic" item_state_slots = list(SLOT_ID_RIGHT_HAND = "sec_voidsuitTG", SLOT_ID_LEFT_HAND = "sec_voidsuitTG") - slowdown = 0.5 armor_type = /datum/armor/vintage/space/med allowed = list(/obj/item/flashlight, /obj/item/tank, @@ -124,7 +125,6 @@ desc = "A refurbished early contact era voidsuit of human design. These things aren't especially good against modern weapons but they're sturdy, incredibly easy to come by, and there are lots of spare parts for repairs. Many old-timer marines swear by these old things, even if new powered hardsuits have more features and better armor. The blue markings indicate this as the marine/guard variant, likely from a merchant ship." icon_state = "rig-vintagemarine" item_state_slots = list(SLOT_ID_RIGHT_HAND = "sec_voidsuitTG", SLOT_ID_LEFT_HAND = "sec_voidsuitTG") - slowdown = 1 armor_type = /datum/armor/vintage/space/marine siemens_coefficient = 0.8 allowed = list(/obj/item/gun, @@ -160,7 +160,6 @@ desc = "A refurbished early contact era voidsuit of human design. These things aren't especially good against modern weapons but they're sturdy, incredibly easy to come by, and there are lots of spare parts for repairs. Many old-timer spacers swear by these old things, even if new powered hardsuits have more features and better armor. This variant appears to be an officer's, and has the best protection of all the old models." icon_state = "rig-vintageofficer" item_state_slots = list(SLOT_ID_RIGHT_HAND = "sec_voidsuitTG", SLOT_ID_LEFT_HAND = "sec_voidsuitTG") - slowdown = 1 armor_type = /datum/armor/vintage/space/officer siemens_coefficient = 0.7 allowed = list(/obj/item/gun, @@ -201,7 +200,6 @@ desc = "A refurbished early contact era voidsuit of human design. These things aren't especially good against modern weapons but they're sturdy, incredibly easy to come by, and there are lots of spare parts for repairs. Many old-timer spacers swear by these old things, even if new powered hardsuits have more features and better armor. The royal blue markings indicate this is the pilot's variant; low protection but ultra-lightweight." icon_state = "rig-vintagepilot" item_state_slots = list(SLOT_ID_RIGHT_HAND = "sec_voidsuitTG", SLOT_ID_LEFT_HAND = "sec_voidsuitTG") - slowdown = 0.25 armor_type = /datum/armor/vintage/space/pilot siemens_coefficient = 0.9 allowed = list(/obj/item/flashlight, @@ -232,7 +230,6 @@ desc = "A refurbished early contact era voidsuit of human design. These things aren't especially good against modern weapons but they're sturdy, incredibly easy to come by, and there are lots of spare parts for repairs. Many old-timer spacers swear by these old things, even if new powered hardsuits have more features and better armor. The purple markings indicate this as a scientist's suit. Keep your eyes open for ropes." icon_state = "rig-vintagescientist" item_state_slots = list(SLOT_ID_RIGHT_HAND = "sec_voidsuitTG", SLOT_ID_LEFT_HAND = "sec_voidsuitTG") - slowdown = 0.5 armor_type = /datum/armor/vintage/space/science siemens_coefficient = 0.8 allowed = list(/obj/item/flashlight, @@ -267,13 +264,16 @@ item_state_slots = list(SLOT_ID_RIGHT_HAND = "syndicate-helm-black", SLOT_ID_LEFT_HAND = "syndicate-helm-black") armor_type = /datum/armor/vintage/space/merc siemens_coefficient = 0.6 + encumbrance = ITEM_ENCUMBRANCE_VOIDSUIT_HELMET_HEAVY + weight = ITEM_WEIGHT_VOIDSUIT_HELMET_HEAVY /obj/item/clothing/suit/space/void/refurb/mercenary name = "vintage mercenary voidsuit" desc = "A refurbished early contact era voidsuit of human design. These things aren't especially good against modern weapons but they're sturdy, incredibly easy to come by, and there are lots of spare parts for repairs. Many old-timer mercs swear by these old things, even if new powered hardsuits have more features and better armor. The red markings indicate this as the mercenary variant. The company ID has been scratched off." icon_state = "rig-vintagemerc" item_state_slots = list(SLOT_ID_RIGHT_HAND = "sec_voidsuitTG", SLOT_ID_LEFT_HAND = "sec_voidsuitTG") - slowdown = 1.5 //the tradeoff for being hot shit almost on par with a crimson suit is that it slows you down even more + encumbrance = ITEM_ENCUMBRANCE_VOIDSUIT_HEAVY + weight = ITEM_WEIGHT_VOIDSUIT_HEAVY armor_type = /datum/armor/vintage/space/merc siemens_coefficient = 0.6 allowed = list(/obj/item/gun, diff --git a/code/modules/clothing/spacesuits/void/merc.dm b/code/modules/clothing/spacesuits/void/merc.dm index 84d6c50b2110..5858ddf20e18 100644 --- a/code/modules/clothing/spacesuits/void/merc.dm +++ b/code/modules/clothing/spacesuits/void/merc.dm @@ -6,6 +6,8 @@ item_state_slots = list(SLOT_ID_RIGHT_HAND = "syndie_helm", SLOT_ID_LEFT_HAND = "syndie_helm") armor_type = /datum/armor/merc/space siemens_coefficient = 0.6 + encumbrance = ITEM_ENCUMBRANCE_VOIDSUIT_HELMET + weight = ITEM_WEIGHT_VOIDSUIT_HELMET camera_networks = list(NETWORK_MERCENARY) light_overlay = "helmet_light_green" //todo: species-specific light overlays @@ -14,7 +16,8 @@ name = "blood-red voidsuit" desc = "An advanced suit that protects against injuries during special operations. Property of Gorlex Marauders." item_state_slots = list(SLOT_ID_RIGHT_HAND = "syndie_voidsuit", SLOT_ID_LEFT_HAND = "syndie_voidsuit") - slowdown = 1 + encumbrance = ITEM_ENCUMBRANCE_VOIDSUIT + weight = ITEM_WEIGHT_VOIDSUIT w_class = ITEMSIZE_NORMAL armor_type = /datum/armor/merc/space allowed = list(/obj/item/flashlight,/obj/item/tank,/obj/item/suit_cooling_unit,/obj/item/gun,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/melee/baton,/obj/item/melee/energy/sword,/obj/item/handcuffs) diff --git a/code/modules/clothing/spacesuits/void/station.dm b/code/modules/clothing/spacesuits/void/station.dm index 007848b460a4..e2f2fba25558 100644 --- a/code/modules/clothing/spacesuits/void/station.dm +++ b/code/modules/clothing/spacesuits/void/station.dm @@ -14,7 +14,6 @@ desc = "A special suit that protects against hazardous, low pressure environments. Has radiation shielding." icon_state = "rig-engineering" item_state_slots = list(SLOT_ID_RIGHT_HAND = "eng_voidsuit", SLOT_ID_LEFT_HAND = "eng_voidsuit") - slowdown = 1 armor_type = /datum/armor/engineering/space allowed = list(/obj/item/flashlight,/obj/item/tank,/obj/item/suit_cooling_unit,/obj/item/storage/bag/ore,/obj/item/t_scanner,/obj/item/pickaxe, /obj/item/rcd) min_pressure_protection = 0 * ONE_ATMOSPHERE @@ -162,6 +161,8 @@ icon_state = "rig0-medicalalt" armor_type = /datum/armor/medical/space light_overlay = "helmet_light_dual_blue" + encumbrance = ITEM_ENCUMBRANCE_VOIDSUIT_HELMET_ULTRALIGHT + weight = ITEM_WEIGHT_VOIDSUIT_HELMET_ULTRALIGHT /obj/item/clothing/head/helmet/space/void/medical/alt_plated name = "streamlined medical voidsuit helmet" @@ -169,19 +170,23 @@ icon_state = "rig0-medicalalt2" armor_type = /datum/armor/medical/space/upgraded light_overlay = "helmet_light_dual_blue" + encumbrance = ITEM_ENCUMBRANCE_VOIDSUIT_HELMET_ULTRALIGHT + weight = ITEM_WEIGHT_VOIDSUIT_HELMET_ULTRALIGHT /obj/item/clothing/suit/space/void/medical/alt icon_state = "rig-medicalalt" name = "streamlined medical voidsuit" desc = "A more recent model of Vey-Med voidsuit, exchanging physical protection for fully unencumbered movement and a complete range of motion." - slowdown = 0 + encumbrance = ITEM_ENCUMBRANCE_VOIDSUIT_ULTRALIGHT + weight = ITEM_WEIGHT_VOIDSUIT_ULTRALIGHT armor_type = /datum/armor/medical/space /obj/item/clothing/suit/space/void/medical/alt_plated icon_state = "rig-medicalalt2" name = "plated medical voidsuit" desc = "An iteration of an existing Vey-Med voidsuit, allowing full biohazard, radiation and increased close-quarters protection, at the expense of projectile and ranged layers." - slowdown = 0 + encumbrance = ITEM_ENCUMBRANCE_VOIDSUIT_ULTRALIGHT + weight = ITEM_WEIGHT_VOIDSUIT_ULTRALIGHT armor_type = /datum/armor/medical/space/upgraded //Security diff --git a/code/modules/clothing/spacesuits/void/void.dm b/code/modules/clothing/spacesuits/void/void.dm index 1931d2d7e215..ac3f96256ae4 100644 --- a/code/modules/clothing/spacesuits/void/void.dm +++ b/code/modules/clothing/spacesuits/void/void.dm @@ -9,6 +9,9 @@ max_heat_protection_temperature = SPACE_SUIT_MAX_HEAT_PROTECTION_TEMPERATURE min_pressure_protection = 0 * ONE_ATMOSPHERE max_pressure_protection = 10 * ONE_ATMOSPHERE + encumbrance = ITEM_ENCUMBRANCE_VOIDSUIT_HELMET + weight = ITEM_WEIGHT_VOIDSUIT_HELMET + // inv_hide_flags = HIDEEARS|BLOCKHAIR @@ -37,7 +40,8 @@ icon_state = "void" item_state_slots = list(SLOT_ID_RIGHT_HAND = "space_suit_syndicate", SLOT_ID_LEFT_HAND = "space_suit_syndicate") desc = "A high-tech dark red space suit. Used for AI satellite maintenance." - slowdown = 1 + encumbrance = ITEM_ENCUMBRANCE_VOIDSUIT + weight = ITEM_WEIGHT_VOIDSUIT armor_type = /datum/armor/general/space/armored allowed = list(/obj/item/flashlight,/obj/item/tank,/obj/item/suit_cooling_unit) heat_protection = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS @@ -81,6 +85,17 @@ action_button_name = "Toggle Helmet" +/obj/item/clothing/suit/space/void/get_weight() + . = ..() + if(boots.loc == src) + . += boots.get_weight() + if(helmet.loc == src) + . += helmet.get_weight() + if(tank.loc == src) + . += tank.get_weight() + if(cooler.loc == src) + . += cooler.get_weight() + /obj/item/clothing/suit/space/void/examine(mob/user, dist) . = ..() var/list/part_list = new diff --git a/code/modules/fishing/fish.dm b/code/modules/fishing/fish.dm index 6138d24cb885..8f96c42bf57f 100644 --- a/code/modules/fishing/fish.dm +++ b/code/modules/fishing/fish.dm @@ -16,7 +16,7 @@ /// Weight in grams var/fish_weight = 1000 /// Average fish_weight for this fish type in grams - var/average_fish_weight = 1000 + var/average_weight = 1000 //? icon @@ -114,7 +114,7 @@ START_PROCESSING(SSobj, src) size = average_size - fish_weight = average_fish_weight + fish_weight = average_weight /obj/item/fish/examine(mob/user, dist) . = ..() @@ -127,9 +127,9 @@ var/size_mod = modifier * average_size size = max(1,gaussian(average_size + size_mod, size_deviation)) - var/weight_deviation = 0.2 * average_fish_weight - var/weight_mod = modifier * average_fish_weight - fish_weight = max(1,gaussian(average_fish_weight + weight_mod, weight_deviation)) + var/weight_deviation = 0.2 * average_weight + var/weight_mod = modifier * average_weight + fish_weight = max(1,gaussian(average_weight + weight_mod, weight_deviation)) /obj/item/fish/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change) . = ..() diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 866f9c3df63a..42fce6a6208e 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -57,3 +57,11 @@ // todo: actual flag like BUCKLING_IS_CONSIDERED_RESTRICTING or something if(buckled?.buckle_flags & (BUCKLING_NO_DEFAULT_RESIST | BUCKLING_NO_DEFAULT_UNBUCKLE)) unbuckle(BUCKLE_OP_FORCE) + +//* Carry Weight + +/mob/proc/update_carry_slowdown() + return + +/mob/proc/update_item_slowdown() + return diff --git a/code/modules/mob/living/carbon/inventory.dm b/code/modules/mob/living/carbon/inventory.dm index e255864a9bec..df789a8d8079 100644 --- a/code/modules/mob/living/carbon/inventory.dm +++ b/code/modules/mob/living/carbon/inventory.dm @@ -49,3 +49,6 @@ /mob/living/carbon/carry_weight_to_slowdown(amount) #warn impl + +/mob/living/carbon/carry_encumbrance_to_slowdown(amount) + #warn impl diff --git a/code/modules/mob/living/inventory.dm b/code/modules/mob/living/inventory.dm index 88523a817fef..f86c6c459db8 100644 --- a/code/modules/mob/living/inventory.dm +++ b/code/modules/mob/living/inventory.dm @@ -261,44 +261,47 @@ #warn rework encumbrance // don't call this you shouldn't need to -/mob/living/proc/update_carry() +/mob/living/proc/update_carry_slowdown() recalculate_carry() - update_carry_slowdown() + update_carry() /mob/living/proc/recalculate_carry() - var/tally = 0 + var/tally_weight = 0 + var/tally_encumbrance = 0 for(var/obj/item/I as anything in get_equipped_items()) - tally += I.get_carry_weight() - if(cached_carry_weight == tally) - return - cached_carry_weight = tally - update_carry_weight_slowdown() + tally_weight += I.get_weight() + tally_encumbrance += I.get_encumbrance() + cached_carry_weight = tally_weight + cached_carry_encumbrance = tally_encumbrance /mob/living/proc/adjust_current_carry_weight(amount) if(!amount) return cached_carry_weight += amount - update_carry_weight_slowdown() + update_carry() /mob/living/proc/adjust_current_carry_encumbrance(amount) - #warn impl + if(!amount) + return + cached_carry_encumbrance += amount + update_carry() /mob/living/proc/carry_weight_to_slowdown(amount) - return 0 + return 0 /mob/living/proc/carry_encumbrance_to_slowdown(amount) return 0 -/mob/living/proc/update_carry_slowdown() - var/slowdown = carry_weight_to_slowdown(cached_carry_weight) +/mob/living/proc/update_carry() + var/slowdown = max(carry_weight_to_slowdown(cached_carry_weight), carry_encumbrance_to_slowdown(cached_carry_encumbrance)) if(slowdown) - add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/mob_carry_weight, multiplicative_slowdown = slowdown) + add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/mob_inventory_carry, multiplicative_slowdown = slowdown) else - remove_movespeed_modifier(/datum/movespeed_modifier/mob_carry_weight) + remove_movespeed_modifier(/datum/movespeed_modifier/mob_inventory_carry) //* hard movespeed slowdown -/mob/living/proc/update_item_movespeed() +/mob/living/proc/update_item_slowdown() var/tally = 0 for(var/obj/item/I as anything in get_equipped_items()) tally += I.hard_slowdown diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index 74dca58b91c0..835ac172ec88 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -128,7 +128,7 @@ /// cached carry weight of all items var/cached_carry_weight = 0 /// cached encumbrance of all items - var/cached_encumbrance = 0 + var/cached_carry_encumbrance = 0 //? movement /// are we currently pushing (or trying to push) (or otherwise inside Bump() handling that deals with this crap) another atom? diff --git a/code/modules/movespeed/modifiers/mob.dm b/code/modules/movespeed/modifiers/mob.dm index 7d5facc08943..9f777c1bef8d 100644 --- a/code/modules/movespeed/modifiers/mob.dm +++ b/code/modules/movespeed/modifiers/mob.dm @@ -4,7 +4,7 @@ /datum/movespeed_modifier/mob_staggered variable = TRUE -/datum/movespeed_modifier/mob_carry_weight +/datum/movespeed_modifier/mob_inventory_carry variable = TRUE /datum/movespeed_modifier/mob_item_slowdown diff --git a/code/modules/projectiles/guns/projectile/automatic.dm b/code/modules/projectiles/guns/projectile/automatic.dm index 5974e8fd0986..b68c6db58d74 100644 --- a/code/modules/projectiles/guns/projectile/automatic.dm +++ b/code/modules/projectiles/guns/projectile/automatic.dm @@ -546,7 +546,6 @@ slot_flags = SLOT_BACK load_method = SPEEDLOADER ammo_type = /obj/item/ammo_casing/a762 - slowdown = 0.5 max_shells = 15 burst = 3 fire_delay = 7.2 diff --git a/code/modules/vehicles_legacy/construction.dm b/code/modules/vehicles_legacy/construction.dm index f290ab767cac..6da492e2f5df 100644 --- a/code/modules/vehicles_legacy/construction.dm +++ b/code/modules/vehicles_legacy/construction.dm @@ -11,7 +11,7 @@ item_state = "buildpipe" density = TRUE - slowdown = 10 //It's a vehicle frame, what do you expect? + weight = ITEM_WEIGHT_VEHICLE_FRAME w_class = 5 pixel_x = -16 diff --git a/code/modules/xenoarcheaology/tools/equipment.dm b/code/modules/xenoarcheaology/tools/equipment.dm index 554668ad21a7..327169c1b7d4 100644 --- a/code/modules/xenoarcheaology/tools/equipment.dm +++ b/code/modules/xenoarcheaology/tools/equipment.dm @@ -7,6 +7,8 @@ armor_type = /datum/armor/general/biosuit/anomaly max_pressure_protection = 5 * ONE_ATMOSPHERE // Not very good protection, but if an anomaly starts doing gas stuff you're not screwed min_pressure_protection = 0.4 * ONE_ATMOSPHERE + encumbrance = ITEM_ENCUMBRANCE_ARMOR_ANOMALY + weight = ITEM_WEIGHT_ARMOR_ANOMALY /obj/item/clothing/head/bio_hood/anomaly name = "Anomaly hood" @@ -16,6 +18,8 @@ armor_type = /datum/armor/general/biosuit/anomaly max_pressure_protection = 5 * ONE_ATMOSPHERE // Not very good protection, but if an anomaly starts doing gas stuff you're not screwed min_pressure_protection = 0.4 * ONE_ATMOSPHERE + encumbrance = ITEM_ENCUMBRANCE_ARMOR_ANOMALY_HELMET + weight = ITEM_WEIGHT_ARMOR_ANOMALY_HELMET /obj/item/clothing/suit/space/anomaly name = "Excavation suit" @@ -24,7 +28,8 @@ item_state = "cespace_suit" armor_type = /datum/armor/general/biosuit/anomaly allowed = list(/obj/item/flashlight,/obj/item/tank,/obj/item/suit_cooling_unit,/obj/item/pickaxe) - slowdown = 1 + encumbrance = ITEM_ENCUMBRANCE_VOIDSUIT_ANOMALY + weight = ITEM_WEIGHT_VOIDSUIT_ANOMALY // Pressure protection inherited from space suits /obj/item/clothing/head/helmet/space/anomaly @@ -33,3 +38,5 @@ icon_state = "cespace_helmet" item_state = "cespace_helmet" armor_type = /datum/armor/general/biosuit/anomaly + encumbrance = ITEM_ENCUMBRANCE_VOIDSUIT_ANOMALY_HELMET + weight = ITEM_WEIGHT_VOIDSUIT_ANOMALY_HELMET From 0ad91ecdcacd352b65d771ddb985f3e25f870fe7 Mon Sep 17 00:00:00 2001 From: silicons Date: Thu, 27 Jul 2023 02:37:43 -0700 Subject: [PATCH 13/62] b --- .../game/gamemodes/changeling/powers/armor.dm | 2 +- code/game/gamemodes/cult/cult_items.dm | 4 +- code/game/gamemodes/technomancer/core_obj.dm | 2 +- .../technomancer/devices/shield_armor.dm | 2 +- .../technomancer/devices/tesla_armor.dm | 2 +- code/game/objects/items.dm | 41 ++++++++++--------- code/game/objects/items/storage/_storage.dm | 6 ++- code/game/objects/items/storage/backpack.dm | 8 ++-- code/game/objects/items/tools/screwdriver.dm | 2 +- code/game/objects/items/tools/weldingtool.dm | 2 +- code/game/objects/items/tools/wirecutters.dm | 2 +- code/game/objects/items/tools/wrench.dm | 2 +- .../items/weapons/material/twohanded.dm | 2 +- code/game/objects/items/weapons/melee/misc.dm | 2 +- code/modules/clothing/clothing_accessories.dm | 4 +- code/modules/clothing/suits/armor.dm | 2 +- code/modules/clothing/suits/bio.dm | 4 +- code/modules/clothing/suits/medieval_armor.dm | 6 +-- code/modules/clothing/suits/utility.dm | 6 +-- code/modules/clothing/under/nanotrasen_vr.dm | 2 +- code/modules/mob/living/inventory.dm | 2 +- 21 files changed, 57 insertions(+), 48 deletions(-) diff --git a/code/game/gamemodes/changeling/powers/armor.dm b/code/game/gamemodes/changeling/powers/armor.dm index de3825dfc55f..24ab18397abe 100644 --- a/code/game/gamemodes/changeling/powers/armor.dm +++ b/code/game/gamemodes/changeling/powers/armor.dm @@ -97,7 +97,7 @@ armor_type = /datum/armor/changeling/chitin siemens_coefficient = 0.3 max_heat_protection_temperature = FIRESUIT_MAX_HEAT_PROTECTION_TEMPERATURE - carry_weight = ITEM_WEIGHT_CHANGELING_ARMOR + weight = ITEM_WEIGHT_CHANGELING_ARMOR /obj/item/clothing/suit/space/changeling/armored/Initialize(mapload) . = ..() diff --git a/code/game/gamemodes/cult/cult_items.dm b/code/game/gamemodes/cult/cult_items.dm index 59701732829a..2941c09df866 100644 --- a/code/game/gamemodes/cult/cult_items.dm +++ b/code/game/gamemodes/cult/cult_items.dm @@ -108,7 +108,7 @@ origin_tech = list(TECH_MATERIAL = 3, TECH_ARCANE = 1) armor_type = /datum/armor/cult/space encumbrance = ITEM_ENCUMBRANCE_CULT_VOIDSUIT_HELMET - carry_weight = ITEM_WEIGHT_CULT_VOIDSUIT_HELMET + weight = ITEM_WEIGHT_CULT_VOIDSUIT_HELMET siemens_coefficient = 0 /obj/item/clothing/head/helmet/space/cult/cultify() @@ -121,7 +121,7 @@ desc = "A bulky suit of armour, bristling with spikes. It looks space-worthy." w_class = ITEMSIZE_NORMAL allowed = list(/obj/item/book/tome,/obj/item/melee/cultblade,/obj/item/tank/emergency/oxygen,/obj/item/suit_cooling_unit) - carry_weight = ITEM_WEIGHT_CULT_VOIDSUIT + weight = ITEM_WEIGHT_CULT_VOIDSUIT encumbrance = ITEM_ENCUMBRANCE_CULT_VOIDSUIT armor_type = /datum/armor/cult/space siemens_coefficient = 0 diff --git a/code/game/gamemodes/technomancer/core_obj.dm b/code/game/gamemodes/technomancer/core_obj.dm index 94771497e814..969012419559 100644 --- a/code/game/gamemodes/technomancer/core_obj.dm +++ b/code/game/gamemodes/technomancer/core_obj.dm @@ -262,7 +262,7 @@ energy = 20000 max_energy = 20000 regen_rate = 25 //800 seconds to full - carry_weight = ITEM_WEIGHT_TECHNOMANCER_BULKY_CORE + weight = ITEM_WEIGHT_TECHNOMANCER_BULKY_CORE instability_modifier = 1.0 spell_power_modifier = 1.4 diff --git a/code/game/gamemodes/technomancer/devices/shield_armor.dm b/code/game/gamemodes/technomancer/devices/shield_armor.dm index 08e23187cde7..9317fb7f230f 100644 --- a/code/game/gamemodes/technomancer/devices/shield_armor.dm +++ b/code/game/gamemodes/technomancer/devices/shield_armor.dm @@ -16,7 +16,7 @@ require a very potent supply of an energy of some kind in order to function." icon_state = "shield_armor_0" blood_overlay_type = "armor" - carry_weight = 0 + weight = ITEM_WEIGHT_BASELINE armor_type = /datum/armor/none action_button_name = "Toggle Shield Projector" var/active = 0 diff --git a/code/game/gamemodes/technomancer/devices/tesla_armor.dm b/code/game/gamemodes/technomancer/devices/tesla_armor.dm index 85d73a4ecee3..534079ef42b2 100644 --- a/code/game/gamemodes/technomancer/devices/tesla_armor.dm +++ b/code/game/gamemodes/technomancer/devices/tesla_armor.dm @@ -12,7 +12,7 @@ desc = "This rather dangerous looking armor will hopefully shock your enemies, and not you in the process." icon_state = "tesla_armor_1" //wip blood_overlay_type = "armor" - carry_weight = 0 + weight = ITEM_WEIGHT_BASELINE armor_type = /datum/armor/none action_button_name = "Toggle Tesla Armor" var/active = 1 //Determines if the armor will zap or block diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index a2e311498a76..b33e7af70f65 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -779,42 +779,45 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. #warn rework encumbrance /obj/item/proc/get_weight() - return isnull(carry_encumberence)? carry_weight : carry_encumberence + return weight /obj/item/proc/get_encumbrance() - #warn impl + return encumbrance /obj/item/proc/update_weight() - #warn impl - if(isnull(carry_weight_cached)) + if(isnull(weight_registered)) return null - . = get_carry_weight() - if(. == carry_weight_cached) + . = get_weight() + if(. == weight_registered) return 0 - . -= carry_weight_cached + . -= weight_registered var/mob/living/wearer = worn_mob() if(istype(wearer)) wearer.adjust_current_carry_weight(.) /obj/item/proc/update_encumbrance() - #warn impl + if(isnull(encumbrance_registered)) + return null + . = get_encumbrance() + if(. == encumbrance_registered) + return 0 + . -= encumbrance_registered + var/mob/living/wearer = worn_mob() + if(istype(wearer)) + wearer.adjust_current_carry_encumbrance(.) + /obj/item/proc/set_weight(amount) - #warn impl - if(amount == carry_weight) - return - carry_weight = amount - if(!isnull(carry_encumberence)) - // we're being overridden, don't bother + if(amount == weight) return - update_carry_weight() + weight = amount + update_weight() /obj/item/proc/set_encumbrance(amount) - #warn impl - if(amount == carry_encumberence) + if(amount == encumbrance) return - carry_encumberence = amount - update_carry_weight() + encumberence = amount + update_encumbrance() /obj/item/proc/set_slowdown(amount) if(amount == hard_slowdown) diff --git a/code/game/objects/items/storage/_storage.dm b/code/game/objects/items/storage/_storage.dm index f28a33ab54c9..cf020cd3542d 100644 --- a/code/game/objects/items/storage/_storage.dm +++ b/code/game/objects/items/storage/_storage.dm @@ -39,6 +39,8 @@ var/last_message = 0 #warn hook + /// carry weight in us + var/weight_cached = 0 /// carry weight mitigation, static. applied after multiplicative var/weight_mitigation = 0 /// carry weight mitigation, multiplicative. @@ -56,7 +58,9 @@ QDEL_NULL(closer) return ..() - +/obj/item/storage/get_weight() + . = ..() + . += weight_cached /obj/item/storage/AltClick(mob/user) if(user in is_seeing) diff --git a/code/game/objects/items/storage/backpack.dm b/code/game/objects/items/storage/backpack.dm index 7f8bc87c23cf..d25e8e480685 100644 --- a/code/game/objects/items/storage/backpack.dm +++ b/code/game/objects/items/storage/backpack.dm @@ -10,7 +10,7 @@ w_class = ITEMSIZE_LARGE slot_flags = SLOT_BACK max_w_class = ITEMSIZE_LARGE - carry_weight = ITEM_WEIGHT_STORAGE_BACKPACK + weight = ITEM_WEIGHT_STORAGE_BACKPACK encumbrance = ITEM_ENCUMBRANCE_STORAGE_BACKPACK max_storage_space = INVENTORY_STANDARD_SPACE var/flippable = 0 @@ -165,7 +165,7 @@ desc = "A large dufflebag for holding extra things." icon_state = "duffle" item_state_slots = list(SLOT_ID_RIGHT_HAND = "duffle", SLOT_ID_LEFT_HAND = "duffle") - carry_weight = ITEM_WEIGHT_STORAGE_DUFFLEBAG + weight = ITEM_WEIGHT_STORAGE_DUFFLEBAG encumbrance = ITEM_ENCUMBRANCE_STORAGE_BACKPACK max_storage_space = INVENTORY_DUFFLEBAG_SPACE @@ -174,7 +174,7 @@ desc = "A large dufflebag for holding extra tactical supplies. This one appears to be made out of lighter material than usual." icon_state = "duffle-syndie" item_state_slots = list(SLOT_ID_RIGHT_HAND = "duffle_syndie", SLOT_ID_LEFT_HAND = "duffle_syndie") - carry_weight = ITEM_WEIGHT_BASELINE + weight = ITEM_WEIGHT_BASELINE /obj/item/storage/backpack/dufflebag/syndie/med name = "medical dufflebag" @@ -588,7 +588,7 @@ icon_state = "saddlebag" max_storage_space = INVENTORY_DUFFLEBAG_SPACE //Saddlebags can hold more, like dufflebags encumbrance = ITEM_ENCUMBRANCE_STORAGE_DUFFLEBAG - carry_weight = ITEM_WEIGHT_STORAGE_DUFFLEBAG + weight = ITEM_WEIGHT_STORAGE_DUFFLEBAG var/taurtype = /datum/sprite_accessory/tail/taur/horse //Acceptable taur type to be wearing this var/no_message = "You aren't the appropriate taur type to wear this!" diff --git a/code/game/objects/items/tools/screwdriver.dm b/code/game/objects/items/tools/screwdriver.dm index 165f878f115b..23677846cb63 100644 --- a/code/game/objects/items/tools/screwdriver.dm +++ b/code/game/objects/items/tools/screwdriver.dm @@ -113,7 +113,7 @@ icon_state = "hybscrewdriver" item_state = "screwdriver_black" origin_tech = list(TECH_MATERIAL = 3, TECH_ENGINEERING = 3) - carry_weight = ITEM_WEIGHT_HYBRID_TOOLS + weight = ITEM_WEIGHT_HYBRID_TOOLS w_class = ITEMSIZE_NORMAL tool_sound = 'sound/effects/uncloak.ogg' tool_speed = 0.4 diff --git a/code/game/objects/items/tools/weldingtool.dm b/code/game/objects/items/tools/weldingtool.dm index a02085bcc126..987ffd156691 100644 --- a/code/game/objects/items/tools/weldingtool.dm +++ b/code/game/objects/items/tools/weldingtool.dm @@ -453,7 +453,7 @@ icon_state = "hybwelder" max_fuel = 80 eye_safety_modifier = -2 // Brighter than the sun. Literally, you can look at the sun with a welding mask of proper grade, this will burn through that. - carry_weight = ITEM_WEIGHT_HYBRID_TOOLS + weight = ITEM_WEIGHT_HYBRID_TOOLS tool_speed = 0.25 w_class = ITEMSIZE_LARGE flame_intensity = 5 diff --git a/code/game/objects/items/tools/wirecutters.dm b/code/game/objects/items/tools/wirecutters.dm index 5c800123cb68..aad6ae7ee72b 100644 --- a/code/game/objects/items/tools/wirecutters.dm +++ b/code/game/objects/items/tools/wirecutters.dm @@ -107,7 +107,7 @@ catalogue_data = list(/datum/category_item/catalogue/anomalous/precursor_a/alien_wirecutters) icon_state = "hybcutters" w_class = ITEMSIZE_NORMAL - carry_weight = ITEM_WEIGHT_HYBRID_TOOLS + weight = ITEM_WEIGHT_HYBRID_TOOLS origin_tech = list(TECH_MATERIAL = 3, TECH_ENGINEERING = 3, TECH_PHORON = 2) attack_verb = list("pinched", "nipped", "warped", "blasted") tool_sound = 'sound/effects/stealthoff.ogg' diff --git a/code/game/objects/items/tools/wrench.dm b/code/game/objects/items/tools/wrench.dm index 1a0cf123f922..c05c30db45d8 100644 --- a/code/game/objects/items/tools/wrench.dm +++ b/code/game/objects/items/tools/wrench.dm @@ -81,7 +81,7 @@ damage_force = 8 throw_force = 10 w_class = ITEMSIZE_NORMAL - carry_weight = ITEM_WEIGHT_HYBRID_TOOLS + weight = ITEM_WEIGHT_HYBRID_TOOLS origin_tech = list(TECH_MATERIAL = 3, TECH_ENGINEERING = 3, TECH_PHORON = 2) attack_verb = list("bashed", "battered", "bludgeoned", "whacked", "warped", "blasted") tool_sound = 'sound/effects/stealthoff.ogg' diff --git a/code/game/objects/items/weapons/material/twohanded.dm b/code/game/objects/items/weapons/material/twohanded.dm index e3b4e4da86a8..57c9f1a3ba19 100644 --- a/code/game/objects/items/weapons/material/twohanded.dm +++ b/code/game/objects/items/weapons/material/twohanded.dm @@ -219,7 +219,7 @@ fragile = 1 //It's a haphazard thing of glass, wire, and steel reach = 2 // Spears are long. attackspeed = 20 - carry_weight = ITEM_WEIGHT_MELEE_SPEAR + weight = ITEM_WEIGHT_MELEE_SPEAR var/obj/item/grenade/explosive = null var/war_cry = "AAAAARGH!!!" diff --git a/code/game/objects/items/weapons/melee/misc.dm b/code/game/objects/items/weapons/melee/misc.dm index 130044590ea4..1b88198c6a26 100644 --- a/code/game/objects/items/weapons/melee/misc.dm +++ b/code/game/objects/items/weapons/melee/misc.dm @@ -387,7 +387,7 @@ edge = 1 attack_verb = list("attacked", "smashed", "crushed", "wacked", "pounded") armor_penetration = 50 - carry_weight = ITEM_WEIGHT_BASELINE + weight = ITEM_WEIGHT_BASELINE //This currently just kills the user. lol /* diff --git a/code/modules/clothing/clothing_accessories.dm b/code/modules/clothing/clothing_accessories.dm index 994aee6cc073..57b359c5150c 100644 --- a/code/modules/clothing/clothing_accessories.dm +++ b/code/modules/clothing/clothing_accessories.dm @@ -15,7 +15,9 @@ return accessory_host.update_worn_icon() return ..() -/obj/item/clothing/get_weight() +/obj/item/clothing/get_encumbrance() + . = ..() + #warn aaa . = ..() var/tally = 0 for(var/obj/item/I as anything in accessories) diff --git a/code/modules/clothing/suits/armor.dm b/code/modules/clothing/suits/armor.dm index 87211429fca7..28bdccd2add6 100644 --- a/code/modules/clothing/suits/armor.dm +++ b/code/modules/clothing/suits/armor.dm @@ -70,7 +70,7 @@ item_state_slots = list(SLOT_ID_RIGHT_HAND = "armor", SLOT_ID_LEFT_HAND = "armor") blood_overlay_type = "armor" encumbrance = ITEM_ENCUMBRANCE_ARMOR_SPECIALIZED_VEST - carry_weight = ITEM_WEIGHT_ARMOR_SPECIALIZED_VEST + weight = ITEM_WEIGHT_ARMOR_SPECIALIZED_VEST armor_type = /datum/armor/station/ballistic siemens_coefficient = 0.7 diff --git a/code/modules/clothing/suits/bio.dm b/code/modules/clothing/suits/bio.dm index 0c4896832d03..f6f252b0edb5 100644 --- a/code/modules/clothing/suits/bio.dm +++ b/code/modules/clothing/suits/bio.dm @@ -20,7 +20,7 @@ gas_transfer_coefficient = 0.01 permeability_coefficient = 0.01 body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS|HANDS|FEET - carry_weight = ITEM_WEIGHT_ARMOR_BIORADSUIT + weight = ITEM_WEIGHT_ARMOR_BIORADSUIT allowed = list(/obj/item/tank/emergency/oxygen,/obj/item/pen,/obj/item/flashlight/pen) armor_type = /datum/armor/general/biosuit inv_hide_flags = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER @@ -114,7 +114,7 @@ gas_transfer_coefficient = 0.01 permeability_coefficient = 0.01 body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS|HANDS|FEET - carry_weight = ITEM_WEIGHT_ARMOR_BIORADSUIT + weight = ITEM_WEIGHT_ARMOR_BIORADSUIT allowed = list(/obj/item/tank/emergency/oxygen,/obj/item/pen,/obj/item/flashlight/pen) armor_type = /datum/armor/general/beekeeper inv_hide_flags = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER diff --git a/code/modules/clothing/suits/medieval_armor.dm b/code/modules/clothing/suits/medieval_armor.dm index 833d1509a3f4..af2177f8be52 100644 --- a/code/modules/clothing/suits/medieval_armor.dm +++ b/code/modules/clothing/suits/medieval_armor.dm @@ -51,7 +51,7 @@ icon = 'icons/clothing/suit/armor/medieval/knight.dmi' icon_state = "knight" encumbrance = ITEM_ENCUMBRANCE_ARMOR_MEDIEVAL_PLATE - carry_weight = ITEM_WEIGHT_ARMOR_MEDIEVIAL_PLATE + weight = ITEM_WEIGHT_ARMOR_MEDIEVIAL_PLATE inv_hide_flags = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETIE|HIDEHOLSTER body_cover_flags = UPPER_TORSO|LOWER_TORSO|ARMS|HANDS|LEGS|FEET worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL @@ -80,7 +80,7 @@ armor_type = /datum/armor/general/medieval/light icon = 'icons/clothing/suit/armor/medieval/bastard.dmi' icon_state = "bastard" - carry_weight = ITEM_WEIGHT_ARMOR_MEDIEVAL_CHAIN + weight = ITEM_WEIGHT_ARMOR_MEDIEVAL_CHAIN encumbrance = ITEM_ENCUMBRANCE_ARMOR_MEDIEVAL_CHAIN /obj/item/clothing/suit/armor/medieval/paladin @@ -89,7 +89,7 @@ armor_type = /datum/armor/general/medieval/mesh icon = 'icons/clothing/suit/armor/medieval/paladin.dmi' icon_state = "paladin" - carry_weight = ITEM_WEIGHT_ARMOR_MEDIEVAL_CHAIN + weight = ITEM_WEIGHT_ARMOR_MEDIEVAL_CHAIN encumbrance = ITEM_ENCUMBRANCE_ARMOR_MEDIEVAL_CHAIN //Crusader stuff diff --git a/code/modules/clothing/suits/utility.dm b/code/modules/clothing/suits/utility.dm index d1eb54dd2ca0..eb87e5bd2e3f 100644 --- a/code/modules/clothing/suits/utility.dm +++ b/code/modules/clothing/suits/utility.dm @@ -19,7 +19,7 @@ body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS allowed = list(/obj/item/flashlight,/obj/item/tank/emergency/oxygen,/obj/item/extinguisher) carry_encumberence = ITEM_ENCUMBRANCE_ARMOR_FIRE_SUIT - carry_weight = ITEM_WEIGHT_ARMOR_FIRE_SUIT + weight = ITEM_WEIGHT_ARMOR_FIRE_SUIT inv_hide_flags = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER clothing_flags = 0 heat_protection = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS @@ -78,7 +78,7 @@ clothing_flags = CLOTHING_THICK_MATERIAL body_cover_flags = HEAD|FACE|EYES armor_type = /datum/armor/general/radsuit - carry_weight = ITEM_WEIGHT_ARMOR_BIORADSUIT_HELMET + weight = ITEM_WEIGHT_ARMOR_BIORADSUIT_HELMET encumbrance = ITEM_ENCUMBRANCE_ARMOR_BIORAD_HELMET /obj/item/clothing/suit/radiation @@ -90,7 +90,7 @@ permeability_coefficient = 0.50 body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS|HANDS|FEET allowed = list(/obj/item/flashlight,/obj/item/tank/emergency/oxygen,/obj/item/clothing/head/radiation,/obj/item/clothing/mask/gas) - carry_weight = ITEM_WEIGHT_ARMOR_BIORADSUIT + weight = ITEM_WEIGHT_ARMOR_BIORADSUIT armor_type = /datum/armor/general/radsuit inv_hide_flags = HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER clothing_flags = CLOTHING_THICK_MATERIAL diff --git a/code/modules/clothing/under/nanotrasen_vr.dm b/code/modules/clothing/under/nanotrasen_vr.dm index 097bc8b5bdb2..273643cd59e0 100644 --- a/code/modules/clothing/under/nanotrasen_vr.dm +++ b/code/modules/clothing/under/nanotrasen_vr.dm @@ -52,4 +52,4 @@ icon_state = "webvest" item_state_slots = list(SLOT_ID_RIGHT_HAND = "swat", SLOT_ID_LEFT_HAND = "swat") armor_type = /datum/armor/station/tactical - carry_weight = ITEM_WEIGHT_ARMOR_LIGHT + weight = ITEM_WEIGHT_ARMOR_LIGHT diff --git a/code/modules/mob/living/inventory.dm b/code/modules/mob/living/inventory.dm index f86c6c459db8..e40a12e51560 100644 --- a/code/modules/mob/living/inventory.dm +++ b/code/modules/mob/living/inventory.dm @@ -271,7 +271,7 @@ for(var/obj/item/I as anything in get_equipped_items()) tally_weight += I.get_weight() tally_encumbrance += I.get_encumbrance() - cached_carry_weight = tally_weight + cached_weight = tally_weight cached_carry_encumbrance = tally_encumbrance /mob/living/proc/adjust_current_carry_weight(amount) From 00730f81597545037120555724a9251642ea19c1 Mon Sep 17 00:00:00 2001 From: silicons Date: Fri, 28 Jul 2023 22:35:14 -0700 Subject: [PATCH 14/62] d --- code/__DEFINES/inventory/carry_weight.dm | 11 +++++++---- code/modules/mob/physiology.dm | 5 +++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/code/__DEFINES/inventory/carry_weight.dm b/code/__DEFINES/inventory/carry_weight.dm index 39fce1b1cb1b..6e04d1b585f8 100644 --- a/code/__DEFINES/inventory/carry_weight.dm +++ b/code/__DEFINES/inventory/carry_weight.dm @@ -6,10 +6,13 @@ //? Carry strength - flat strength #define CARRY_STRENGTH_BASELINE 15 -#define CARRY_STRENGTH_UNATHI 20 -#define CARRY_STRENGTH_PROTEAN 22.5 -#define CARRY_STRENGTH_LIGHTADAPT_NEPID 17.5 -#define CARRY_STRENGTH +#define CARRY_STRENGTH_UNATHI 17.5 +#define CARRY_STRENGTH_PROTEAN 17.5 +#define CARRY_STRENGTH_MOTH_LIGHT 17.5 +#define CARRY_STRENGTH_MOTH_DARK 12.5 +#define CARRY_STRENGTH_TAJARAN 12.5 +#define CARRY_STRENGTH_XENOCHIMERA 20 +#define CARRY_STRENGTH_XENOHYBRID 20 //? Carry strength - multiplier for over-limit penalty diff --git a/code/modules/mob/physiology.dm b/code/modules/mob/physiology.dm index 3909f19ed840..de1e8dd84b5a 100644 --- a/code/modules/mob/physiology.dm +++ b/code/modules/mob/physiology.dm @@ -7,6 +7,11 @@ // todo: /datum/global_physiology should hold global body physiology, limbs should hold modifiers/whatever themselves. // this way biologies can be supported as efficiently as possible. + /// carry weight baseline modify +- + var/carry_weight_baseline = 0 + /// carry weight penalty divisor +- + var/carry_weight_penalty + /datum/global_physiology/proc/apply(datum/physiology_modifier/modifier) // todo: modifier/apply_global, modifier/apply_bodypart From 394da2ca7b1eb729f62c2b9b4b889483310cb248 Mon Sep 17 00:00:00 2001 From: silicons Date: Sat, 29 Jul 2023 05:21:00 -0700 Subject: [PATCH 15/62] fix --- code/__DEFINES/inventory/carry_weight.dm | 29 ++++++++++++++----- .../game/gamemodes/changeling/powers/armor.dm | 7 ++--- code/game/gamemodes/technomancer/core_obj.dm | 2 +- .../technomancer/devices/boots_of_speed.dm | 2 +- code/game/objects/items.dm | 4 +-- code/game/objects/items/storage/backpack.dm | 4 +-- .../items/weapons/material/material_armor.dm | 4 ++- .../items/weapons/material/twohanded.dm | 2 +- code/game/objects/items/weapons/nullrod.dm | 5 ++-- code/game/objects/items/weapons/shields.dm | 2 +- code/modules/clothing/clothing_accessories.dm | 13 ++++----- code/modules/clothing/shoes/colour.dm | 2 +- code/modules/clothing/shoes/magboots.dm | 8 ++--- .../mob/living/carbon/human/movement.dm | 17 ----------- code/modules/mob/living/carbon/inventory.dm | 5 ++++ code/modules/mob/living/inventory.dm | 9 ++++-- .../guns/magnetic/magnetic_railgun.dm | 15 ++++++---- 17 files changed, 68 insertions(+), 62 deletions(-) diff --git a/code/__DEFINES/inventory/carry_weight.dm b/code/__DEFINES/inventory/carry_weight.dm index 6e04d1b585f8..96c0472fc11d 100644 --- a/code/__DEFINES/inventory/carry_weight.dm +++ b/code/__DEFINES/inventory/carry_weight.dm @@ -44,9 +44,13 @@ //* Clothing #define ITEM_ENCUMBRANCE_SHOES_CUFFED 50 +#define ITEM_ENCUMRBANCE_SHOES_MAGBOOTS 10 +#define ITEM_ENCUMBRANCE_SHOES_MAGBOOTS_PULSE 20 //* Factions +#define ITEM_ENCUMBRANCE_CHANGELING_MAGBOOTS 5 +#define ITEM_ENCUMBRANCE_CHANGELING_MAGBOOTS_PULSE 15 #define ITEM_ENCUMBRANCE_CULT_VOIDSUIT 15 #define ITEM_ENCUMBRANCE_CULT_VOIDSUIT_HELMET 1 @@ -81,7 +85,18 @@ //* Weapons +#define ITEM_ENCUMBRANCE_GUN_LIGHT 3 +#define ITEM_ENCUMBRANCE_GUN_NORMAL 5 +#define ITEM_ENCUMBRANCE_GUN_LARGE 7.5 +#define ITEM_ENCUMBRANCE_GUN_BULKY 10 +#define ITEM_ENCUMBRANCE_GUN_UNREASONABLE 15 +#define ITEM_ENCUMBRANCE_GUN_RIDICULOUS 30 +#define ITEM_ENCUMBRANCE_GUN_VEHICLE 60 + #define ITEM_ENCUMBRANCE_MELEE_SPEAR 15 +#define ITEM_ENCUMBRANCE_MELEE_SLEDGEHAMMER 15 + +#define ITEM_ENCUMBRANCE_SHIELD_TOWER 15 //? Item Weight defines @@ -117,13 +132,13 @@ //* Weapons -#define ITEM_WEIGHT_GUN_LIGHT 3 -#define ITEM_WEIGHT_GUN_NORMAL 5 -#define ITEM_WEIGHT_GUN_LARGE 7.5 -#define ITEM_WEIGHT_GUN_BULKY 10 -#define ITEM_WEIGHT_GUN_UNREASONABLE 15 -#define ITEM_WEIGHT_GUN_RIDICULOUS 30 -#define ITEM_WEIGHT_GUN_VEHICLE 60 +#define ITEM_WEIGHT_GUN_LIGHT 2 +#define ITEM_WEIGHT_GUN_NORMAL 4 +#define ITEM_WEIGHT_GUN_LARGE 6 +#define ITEM_WEIGHT_GUN_BULKY 8 +#define ITEM_WEIGHT_GUN_UNREASONABLE 14 +#define ITEM_WEIGHT_GUN_RIDICULOUS 20 +#define ITEM_WEIGHT_GUN_VEHICLE 30 #define ITEM_WEIGHT_MELEE_SPEAR 10 diff --git a/code/game/gamemodes/changeling/powers/armor.dm b/code/game/gamemodes/changeling/powers/armor.dm index 24ab18397abe..fec2083c9f33 100644 --- a/code/game/gamemodes/changeling/powers/armor.dm +++ b/code/game/gamemodes/changeling/powers/armor.dm @@ -64,11 +64,8 @@ action_button_name = "Toggle Grippers" clothing_flags = NONE item_flags = ITEM_DROPDEL - -/obj/item/clothing/shoes/magboots/changeling/set_slowdown() - slowdown = worn_over? max(SHOES_SLOWDOWN, worn_over.slowdown): SHOES_SLOWDOWN //So you can't put on magboots to make you walk faster. - if (magpulse) - slowdown += 1 //It's already tied to a slowdown suit, 6 slowdown is huge. + encumbrance = ITEM_ENCUMBRANCE_CHANGELING_MAGBOOTS + encumbrance_on = ITEM_ENCUMBRANCE_CHANGELING_MAGBOOTS_PULSE /obj/item/clothing/shoes/magboots/changeling/attack_self(mob/user) . = ..() diff --git a/code/game/gamemodes/technomancer/core_obj.dm b/code/game/gamemodes/technomancer/core_obj.dm index 969012419559..d9531533c97b 100644 --- a/code/game/gamemodes/technomancer/core_obj.dm +++ b/code/game/gamemodes/technomancer/core_obj.dm @@ -248,7 +248,7 @@ energy = 7000 max_energy = 7000 regen_rate = 70 //100 seconds to full - slowdown = -1 + hard_slowdown = -1 instability_modifier = 0.9 cooldown_modifier = 0.9 diff --git a/code/game/gamemodes/technomancer/devices/boots_of_speed.dm b/code/game/gamemodes/technomancer/devices/boots_of_speed.dm index a000ae841c4f..990507999a4b 100644 --- a/code/game/gamemodes/technomancer/devices/boots_of_speed.dm +++ b/code/game/gamemodes/technomancer/devices/boots_of_speed.dm @@ -11,7 +11,7 @@ icon_state = "swat" clothing_flags = NOSLIP siemens_coefficient = 0.6 - slowdown = -1 + hard_slowdown = -1 cold_protection = FEET min_cold_protection_temperature = SHOE_MIN_COLD_PROTECTION_TEMPERATURE diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index b33e7af70f65..a290f73ddeca 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -776,8 +776,6 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. //? Carry Weight -#warn rework encumbrance - /obj/item/proc/get_weight() return weight @@ -816,7 +814,7 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. /obj/item/proc/set_encumbrance(amount) if(amount == encumbrance) return - encumberence = amount + encumbrance = amount update_encumbrance() /obj/item/proc/set_slowdown(amount) diff --git a/code/game/objects/items/storage/backpack.dm b/code/game/objects/items/storage/backpack.dm index d25e8e480685..540222eef6a3 100644 --- a/code/game/objects/items/storage/backpack.dm +++ b/code/game/objects/items/storage/backpack.dm @@ -619,8 +619,8 @@ item_state = "saddlebag" icon_state = "saddlebag" var/icon_base = "saddlebag" + encumbrance = ITEM_ENCUMBRANCE_STORAGE_DUFFLEBAG max_storage_space = INVENTORY_DUFFLEBAG_SPACE //Saddlebags can hold more, like dufflebags - slowdown = 1 //And are slower, too...Unless you're a macro, that is. var/no_message = "You aren't the appropriate taur type to wear this!" /obj/item/storage/backpack/saddlebag_common/can_equip(mob/M, slot, mob/user, flags) @@ -675,7 +675,7 @@ icon_state = "taurvest" icon_base = "taurvest" max_storage_space = INVENTORY_STANDARD_SPACE - slowdown = 0 + encumbrance = ITEM_ENCUMBRANCE_STORAGE_BACKPACK /obj/item/storage/backpack/dufflebag/fluff //Black dufflebag without syndie buffs. name = "plain black dufflebag" diff --git a/code/game/objects/items/weapons/material/material_armor.dm b/code/game/objects/items/weapons/material/material_armor.dm index 0e452784d695..ee35de346383 100644 --- a/code/game/objects/items/weapons/material/material_armor.dm +++ b/code/game/objects/items/weapons/material/material_armor.dm @@ -192,7 +192,9 @@ Protectiveness | Armor % if(!isnull(material.conductivity)) siemens_coefficient = clamp( material.conductivity / 10, 0, 10) - slowdown = clamp(0, round(material.weight / 10, 0.1) * material_weight_factor, 6) + var/legacy_whatever = clamp(0, round(material.weight / 10, 0.1) * material_weight_factor, 6) * 10 + set_weight(legacy_whatever * 2) + set_encumbrance(legacy_whatever * 4) /obj/item/clothing/suit/armor/material name = "armor" diff --git a/code/game/objects/items/weapons/material/twohanded.dm b/code/game/objects/items/weapons/material/twohanded.dm index 57c9f1a3ba19..2c85cc4bfa21 100644 --- a/code/game/objects/items/weapons/material/twohanded.dm +++ b/code/game/objects/items/weapons/material/twohanded.dm @@ -302,7 +302,7 @@ force_divisor = 0.6 // 9/36 with hardness 60 (steel) and 0.25 unwielded divisor hitsound = 'sound/weapons/heavysmash.ogg' w_class = ITEMSIZE_HUGE - slowdown = 1.5 + encumbrance = ITEM_ENCUMBRANCE_MELEE_SLEDGEHAMMER dulled_divisor = 0.95 //Still metal on a stick sharp = 0 edge = 1 diff --git a/code/game/objects/items/weapons/nullrod.dm b/code/game/objects/items/weapons/nullrod.dm index e9a3926575af..2eaf0abd5d98 100644 --- a/code/game/objects/items/weapons/nullrod.dm +++ b/code/game/objects/items/weapons/nullrod.dm @@ -412,8 +412,9 @@ hitsound = 'sound/weapons/bladeslice.ogg' attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") -/obj/item/nullrod/tribal_knife/process(delta_time) - slowdown = rand(-2, 2) +// no this is hrp +// /obj/item/nullrod/tribal_knife/process(delta_time) +// slowdown = rand(-2, 2) /obj/item/nullrod/pitchfork icon_state = "pitchfork0" diff --git a/code/game/objects/items/weapons/shields.dm b/code/game/objects/items/weapons/shields.dm index 13ca9fae3b61..6eb99b7b3c4d 100644 --- a/code/game/objects/items/weapons/shields.dm +++ b/code/game/objects/items/weapons/shields.dm @@ -191,7 +191,7 @@ item_state = "metal" icon_state = "metal" damage_force = 16 - slowdown = 2 + encumbrance = ITEM_ENCUMBRANCE_SHIELD_TOWER throw_force = 15 //Massive piece of metal w_class = ITEMSIZE_HUGE diff --git a/code/modules/clothing/clothing_accessories.dm b/code/modules/clothing/clothing_accessories.dm index 57b359c5150c..078113dd4bf9 100644 --- a/code/modules/clothing/clothing_accessories.dm +++ b/code/modules/clothing/clothing_accessories.dm @@ -16,14 +16,12 @@ return ..() /obj/item/clothing/get_encumbrance() - . = ..() - #warn aaa . = ..() var/tally = 0 for(var/obj/item/I as anything in accessories) - tally += I.get_carry_weight() - tally *= (1 - weight_compensation_mult) - tally = max(0, tally - weight_compensation_flat) + tally += I.get_encumbrance() + tally *= (1 - encumbrance_multiply) + tally = max(0, tally - encumbrance_mitigation) . += tally /obj/item/clothing/equipped(mob/user, slot, flags) @@ -222,16 +220,15 @@ A.on_attached(src, user) add_obj_verb(src, /obj/item/clothing/proc/removetie_verb) update_worn_icon() - update_carry_weight() + update_encumbrance() /obj/item/clothing/proc/remove_accessory(mob/user, obj/item/clothing/accessory/A) if(!LAZYLEN(accessories) || !(A in accessories)) return - A.on_removed(user) accessories -= A update_worn_icon() - update_carry_weight() + update_encumbrance() /obj/item/clothing/proc/removetie_verb() set name = "Remove Accessory" diff --git a/code/modules/clothing/shoes/colour.dm b/code/modules/clothing/shoes/colour.dm index ac842ba48028..664c2e9c60ad 100644 --- a/code/modules/clothing/shoes/colour.dm +++ b/code/modules/clothing/shoes/colour.dm @@ -109,7 +109,7 @@ chained.add_fingerprint(user) // todo: refactor - set_encumbrance(initial(carry_encumberence)) + set_encumbrance(initial(encumbrance)) icon_state = "orange" chained = null diff --git a/code/modules/clothing/shoes/magboots.dm b/code/modules/clothing/shoes/magboots.dm index 52b8110e09ad..921807218379 100644 --- a/code/modules/clothing/shoes/magboots.dm +++ b/code/modules/clothing/shoes/magboots.dm @@ -9,18 +9,18 @@ overshoes = 1 shoes_under_pants = -1 //These things are huge preserve_item = 1 + encumbrance = ITEM_ENCUMBRANCE_SHOES_MAGBOOTS var/magpulse = 0 - var/slowdown_on = 3 var/icon_base = "magboots" action_button_name = "Toggle Magboots" step_volume_mod = 1.3 drop_sound = 'sound/items/drop/metalboots.ogg' pickup_sound = 'sound/items/pickup/toolbox.ogg' + var/encumbrance_on = ITEM_ENCUMBRANCE_SHOES_MAGBOOT_PULSE + /obj/item/clothing/shoes/magboots/proc/set_slowdown() - slowdown = worn_over? max(SHOES_SLOWDOWN, worn_over.slowdown): SHOES_SLOWDOWN //So you can't put on magboots to make you walk faster. - if (magpulse) - slowdown += slowdown_on + set_encumbrance(initial(encumbrance) + (magpulse? encumbrance_on : 0)) /obj/item/clothing/shoes/magboots/attack_self(mob/user) . = ..() diff --git a/code/modules/mob/living/carbon/human/movement.dm b/code/modules/mob/living/carbon/human/movement.dm index 3c013c27671c..ff2b01a96267 100644 --- a/code/modules/mob/living/carbon/human/movement.dm +++ b/code/modules/mob/living/carbon/human/movement.dm @@ -103,23 +103,6 @@ return max(HUMAN_LOWEST_SLOWDOWN, tally + . + config_legacy.human_delay) // Minimum return should be the same as force_max_speed -// This calculates the amount of slowdown to receive from items worn. This does NOT include species modifiers. -// It is in a seperate place to avoid an infinite loop situation with dragging mobs dragging each other. -// Also its nice to have these things seperated. -/mob/living/carbon/human/proc/calculate_item_encumbrance() - if(!buckled && shoes) // Shoes can make you go faster. - . += shoes.slowdown - - // Loop through some slots, and add up their slowdowns. - // Includes slots which can provide armor, the back slot, and suit storage. - for(var/obj/item/I in list(wear_suit, w_uniform, back, gloves, head, s_store)) - . += I.slowdown - - // Hands are also included, to make the 'take off your armor instantly and carry it with you to go faster' trick no longer viable. - // This is done seperately to disallow negative numbers (so you can't hold shoes in your hands to go faster). - for(var/obj/item/I in list(r_hand, l_hand)) - . += max(I.slowdown, 0) - // Similar to above, but for turf slowdown. /mob/living/carbon/human/proc/calculate_turf_slowdown(turf/T, direct) if(!T) diff --git a/code/modules/mob/living/carbon/inventory.dm b/code/modules/mob/living/carbon/inventory.dm index df789a8d8079..6977001e0fc7 100644 --- a/code/modules/mob/living/carbon/inventory.dm +++ b/code/modules/mob/living/carbon/inventory.dm @@ -52,3 +52,8 @@ /mob/living/carbon/carry_encumbrance_to_slowdown(amount) #warn impl + +/mob/living/carbon/get_item_slowdown() + . = ..() + if(!isnull(species)) + . *= species.item_slowdown_mod diff --git a/code/modules/mob/living/inventory.dm b/code/modules/mob/living/inventory.dm index e40a12e51560..869f8c4de7fe 100644 --- a/code/modules/mob/living/inventory.dm +++ b/code/modules/mob/living/inventory.dm @@ -302,10 +302,13 @@ //* hard movespeed slowdown /mob/living/proc/update_item_slowdown() - var/tally = 0 - for(var/obj/item/I as anything in get_equipped_items()) - tally += I.hard_slowdown + var/tally = get_item_slowdown() if(tally) add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/mob_item_slowdown) else remove_movespeed_modifier(/datum/movespeed_modifier/mob_item_slowdown) + +/mob/living/proc/get_item_slowdown() + . = 0 + for(var/obj/item/I as anything in get_equipped_items()) + . += I.hard_slowdown diff --git a/code/modules/projectiles/guns/magnetic/magnetic_railgun.dm b/code/modules/projectiles/guns/magnetic/magnetic_railgun.dm index f8c78196bb7a..73aaa29d0c20 100644 --- a/code/modules/projectiles/guns/magnetic/magnetic_railgun.dm +++ b/code/modules/projectiles/guns/magnetic/magnetic_railgun.dm @@ -12,7 +12,8 @@ heavy = TRUE slot_flags = SLOT_BELT loaded = /obj/item/rcd_ammo/large - slowdown = ITEM_WEIGHT_GUN_BULKY // Slowdown equals slowdown_worn, until we decide to import the system to differentiate between held and worn items + weight = ITEM_WEIGHT_GUN_BULKY + encumbrance = ITEM_ENCUMBRANCE_GUN_BULKY fire_delay = 1 var/initial_cell_type = /obj/item/cell/hyper @@ -62,7 +63,8 @@ initial_capacitor_type = /obj/item/stock_parts/capacitor/super fire_delay = 0 - slowdown = ITEM_WEIGHT_GUN_RIDICULOUS + weight = ITEM_WEIGHT_GUN_RIDICULOUS + encumbrance = ITEM_ENCUMBRANCE_GUN_RIDICULOUS slot_flags = SLOT_BACK w_class = ITEMSIZE_NO_CONTAINER @@ -91,7 +93,8 @@ slot_flags = SLOT_BACK - slowdown = ITEM_WEIGHT_GUN_LIGHT + weight = ITEM_WEIGHT_GUN_LIGHT + encumbrance = ITEM_ENCUMBRANCE_GUN_LIGHT power_cost = 100 load_type = /obj/item/magnetic_ammo @@ -121,7 +124,8 @@ slot_flags = SLOT_BACK - slowdown = ITEM_WEIGHT_GUN_LIGHT + weight = ITEM_WEIGHT_GUN_LIGHT + encumbrance = ITEM_ENCUMBRANCE_GUN_LIGHT power_cost = 400 projectile_type = /obj/projectile/bullet/magnetic/heated @@ -177,7 +181,8 @@ slot_flags = SLOT_BACK - slowdown = ITEM_WEIGHT_GUN_NORMAL + weight = ITEM_WEIGHT_GUN_NORMAL + encumbrance = ITEM_ENCUMBRANCE_GUN_NORMAL power_cost = 200 projectile_type = /obj/projectile/bullet/magnetic/flechette/hunting From 917475109009d2f4d76fed683075065992821c4d Mon Sep 17 00:00:00 2001 From: silicons Date: Sat, 29 Jul 2023 05:24:32 -0700 Subject: [PATCH 16/62] Fix --- code/__DEFINES/inventory/carry_weight.dm | 2 +- code/modules/clothing/shoes/magboots.dm | 4 ++-- code/modules/clothing/suits/bio.dm | 4 ++-- code/modules/clothing/suits/medieval_armor.dm | 2 +- code/modules/hardsuits/modules/utility.dm | 4 ++-- code/modules/mob/living/inventory.dm | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/code/__DEFINES/inventory/carry_weight.dm b/code/__DEFINES/inventory/carry_weight.dm index 96c0472fc11d..5c9f4dd40c31 100644 --- a/code/__DEFINES/inventory/carry_weight.dm +++ b/code/__DEFINES/inventory/carry_weight.dm @@ -44,7 +44,7 @@ //* Clothing #define ITEM_ENCUMBRANCE_SHOES_CUFFED 50 -#define ITEM_ENCUMRBANCE_SHOES_MAGBOOTS 10 +#define ITEM_ENCUMBRANCE_SHOES_MAGBOOTS 10 #define ITEM_ENCUMBRANCE_SHOES_MAGBOOTS_PULSE 20 //* Factions diff --git a/code/modules/clothing/shoes/magboots.dm b/code/modules/clothing/shoes/magboots.dm index 921807218379..d53a5e645198 100644 --- a/code/modules/clothing/shoes/magboots.dm +++ b/code/modules/clothing/shoes/magboots.dm @@ -118,7 +118,7 @@ /obj/item/clothing/shoes/magboots/advanced name = "advanced magboots" icon_state = "advmag0" - slowdown_on = 0 + encumbrance_on = 0 icon_base = "advmag" /obj/item/clothing/shoes/magboots/syndicate @@ -126,4 +126,4 @@ desc = "Prior to its dissolution, many Syndicate agents were tasked with stealing NanoTrasen's prototype advanced magboots. Reverse engineering these rare tactical boots was achieved shortly before the end of the conflict." icon_state = "syndiemag0" icon_base = "syndiemag" - slowdown_on = 0 + encumbrance_on = 0 diff --git a/code/modules/clothing/suits/bio.dm b/code/modules/clothing/suits/bio.dm index f6f252b0edb5..da3851ca62af 100644 --- a/code/modules/clothing/suits/bio.dm +++ b/code/modules/clothing/suits/bio.dm @@ -20,7 +20,7 @@ gas_transfer_coefficient = 0.01 permeability_coefficient = 0.01 body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS|HANDS|FEET - weight = ITEM_WEIGHT_ARMOR_BIORADSUIT + weight = ITEM_WEIGHT_ARMOR_BIORAD_SUIT allowed = list(/obj/item/tank/emergency/oxygen,/obj/item/pen,/obj/item/flashlight/pen) armor_type = /datum/armor/general/biosuit inv_hide_flags = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER @@ -114,7 +114,7 @@ gas_transfer_coefficient = 0.01 permeability_coefficient = 0.01 body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS|HANDS|FEET - weight = ITEM_WEIGHT_ARMOR_BIORADSUIT + weight = ITEM_WEIGHT_ARMOR_BIORAD_SUIT allowed = list(/obj/item/tank/emergency/oxygen,/obj/item/pen,/obj/item/flashlight/pen) armor_type = /datum/armor/general/beekeeper inv_hide_flags = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER diff --git a/code/modules/clothing/suits/medieval_armor.dm b/code/modules/clothing/suits/medieval_armor.dm index af2177f8be52..19235b21c59c 100644 --- a/code/modules/clothing/suits/medieval_armor.dm +++ b/code/modules/clothing/suits/medieval_armor.dm @@ -51,7 +51,7 @@ icon = 'icons/clothing/suit/armor/medieval/knight.dmi' icon_state = "knight" encumbrance = ITEM_ENCUMBRANCE_ARMOR_MEDIEVAL_PLATE - weight = ITEM_WEIGHT_ARMOR_MEDIEVIAL_PLATE + weight = ITEM_WEIGHT_ARMOR_MEDIEVAL_PLATE inv_hide_flags = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETIE|HIDEHOLSTER body_cover_flags = UPPER_TORSO|LOWER_TORSO|ARMS|HANDS|LEGS|FEET worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL diff --git a/code/modules/hardsuits/modules/utility.dm b/code/modules/hardsuits/modules/utility.dm index b305c592f76b..8070b6f373a2 100644 --- a/code/modules/hardsuits/modules/utility.dm +++ b/code/modules/hardsuits/modules/utility.dm @@ -651,7 +651,7 @@ to_chat(H, "You activate the suit's sprint mode.") - holder.slowdown -= sprint_speed + holder.hard_slowdown -= sprint_speed /obj/item/hardsuit_module/sprinter/deactivate() @@ -662,7 +662,7 @@ to_chat(H, "Your hardsuit returns to normal speed.") - holder.slowdown += sprint_speed + holder.hard_slowdown += sprint_speed /obj/item/hardsuit_module/device/hand_defib name = "\improper Hand-mounted Defibrillator" diff --git a/code/modules/mob/living/inventory.dm b/code/modules/mob/living/inventory.dm index 869f8c4de7fe..9bad8f6765d8 100644 --- a/code/modules/mob/living/inventory.dm +++ b/code/modules/mob/living/inventory.dm @@ -271,7 +271,7 @@ for(var/obj/item/I as anything in get_equipped_items()) tally_weight += I.get_weight() tally_encumbrance += I.get_encumbrance() - cached_weight = tally_weight + cached_carry_weight = tally_weight cached_carry_encumbrance = tally_encumbrance /mob/living/proc/adjust_current_carry_weight(amount) From 0fe8e07d0957f8991e862c22570de24b3b6141d8 Mon Sep 17 00:00:00 2001 From: silicons Date: Sat, 29 Jul 2023 05:30:23 -0700 Subject: [PATCH 17/62] Fix --- code/modules/clothing/shoes/magboots.dm | 2 +- code/modules/clothing/suits/utility.dm | 4 ++-- code/modules/mob/inventory/items.dm | 20 ++++++++----------- .../mob/living/carbon/human/movement.dm | 9 --------- 4 files changed, 11 insertions(+), 24 deletions(-) diff --git a/code/modules/clothing/shoes/magboots.dm b/code/modules/clothing/shoes/magboots.dm index d53a5e645198..f0ef8d12d2ba 100644 --- a/code/modules/clothing/shoes/magboots.dm +++ b/code/modules/clothing/shoes/magboots.dm @@ -17,7 +17,7 @@ drop_sound = 'sound/items/drop/metalboots.ogg' pickup_sound = 'sound/items/pickup/toolbox.ogg' - var/encumbrance_on = ITEM_ENCUMBRANCE_SHOES_MAGBOOT_PULSE + var/encumbrance_on = ITEM_ENCUMBRANCE_SHOES_MAGBOOTS_PULSE /obj/item/clothing/shoes/magboots/proc/set_slowdown() set_encumbrance(initial(encumbrance) + (magpulse? encumbrance_on : 0)) diff --git a/code/modules/clothing/suits/utility.dm b/code/modules/clothing/suits/utility.dm index eb87e5bd2e3f..fdd6b6ff4e6a 100644 --- a/code/modules/clothing/suits/utility.dm +++ b/code/modules/clothing/suits/utility.dm @@ -78,7 +78,7 @@ clothing_flags = CLOTHING_THICK_MATERIAL body_cover_flags = HEAD|FACE|EYES armor_type = /datum/armor/general/radsuit - weight = ITEM_WEIGHT_ARMOR_BIORADSUIT_HELMET + weight = ITEM_WEIGHT_ARMOR_BIORAD_SUIT_HELMET encumbrance = ITEM_ENCUMBRANCE_ARMOR_BIORAD_HELMET /obj/item/clothing/suit/radiation @@ -90,7 +90,7 @@ permeability_coefficient = 0.50 body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS|HANDS|FEET allowed = list(/obj/item/flashlight,/obj/item/tank/emergency/oxygen,/obj/item/clothing/head/radiation,/obj/item/clothing/mask/gas) - weight = ITEM_WEIGHT_ARMOR_BIORADSUIT + weight = ITEM_WEIGHT_ARMOR_BIORAD_SUIT armor_type = /datum/armor/general/radsuit inv_hide_flags = HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER clothing_flags = CLOTHING_THICK_MATERIAL diff --git a/code/modules/mob/inventory/items.dm b/code/modules/mob/inventory/items.dm index 95887c6da480..24547c031b2d 100644 --- a/code/modules/mob/inventory/items.dm +++ b/code/modules/mob/inventory/items.dm @@ -101,14 +101,12 @@ if(zoom) zoom() //binoculars, scope, etc - // todo: remove assertion for performance - if(isnull(carry_weight_cached)) - STACK_TRACE("carry weight cached was not null on pickup") if(isliving(user)) var/mob/living/L = user - L.remove_current_carry_weight(carry_weight_cached) - carry_weight_cached = null - #warn *scream + L.adjust_current_carry_weight(-weight_registered) + L.adjust_current_carry_encumbrance(-encumbrance_registered) + weight_registered = null + encumbrance_registered = null return ((. & COMPONENT_ITEM_DROPPED_RELOCATE)? ITEM_RELOCATED_BY_DROPPED : NONE) @@ -129,14 +127,12 @@ if(isturf(oldLoc) && !(flags & (INV_OP_SILENT | INV_OP_DIRECTLY_EQUIPPING))) playsound(src, pickup_sound, 20, ignore_walls = FALSE) - // todo: remove assertion for performance - if(!isnull(carry_weight_cached)) - STACK_TRACE("carry weight cached was not null on pickup") - carry_weight_cached = get_carry_weight() + weight_registered = get_weight() + encumbrance_registered = get_encumbrance() if(isliving(user)) var/mob/living/L = user - L.add_current_carry_weight(carry_weight_cached) - #warn *scream + L.adjust_current_carry_weight(weight_registered) + L.adjust_current_carry_encumbrance(encumbrance_registered) /** * get the slowdown we incur when we're worn diff --git a/code/modules/mob/living/carbon/human/movement.dm b/code/modules/mob/living/carbon/human/movement.dm index ff2b01a96267..6ed3cd1242cd 100644 --- a/code/modules/mob/living/carbon/human/movement.dm +++ b/code/modules/mob/living/carbon/human/movement.dm @@ -87,15 +87,6 @@ if(CE_SPEEDBOOST in chem_effects) tally -= 0.5 - // Item related slowdown. - var/item_tally = calculate_item_encumbrance() - if(item_tally > 0) // is it greater than 0? run the wacky shit - item_tally *= species.item_slowdown_mod // your item slowdown kicks in, but - if(!(CE_SPEEDBOOST in chem_effects)) // hyperzine users ignore item slow - tally += item_tally // no hyperzine? slowed down by things - else - tally += item_tally // if it's less than 0 that means it speeds you up, theoretically, so, hit it - if(CE_SLOWDOWN in chem_effects) if (tally >= 0 ) tally = (tally + tally/4) //Add a quarter of penalties on top. From 7241c2473743f2c09c616c59a46d690822112d95 Mon Sep 17 00:00:00 2001 From: silicons Date: Sun, 30 Jul 2023 10:59:56 -0700 Subject: [PATCH 18/62] fix --- code/__DEFINES/inventory/carry_weight.dm | 73 +++++++++++-------- .../modules/clothing/spacesuits/spacesuits.dm | 7 +- code/modules/clothing/spacesuits/syndi.dm | 1 - code/modules/clothing/suits/aliens/tajara.dm | 3 +- code/modules/clothing/suits/armor.dm | 4 +- code/modules/clothing/suits/utility.dm | 7 +- .../clothing/under/accessories/armor.dm | 3 +- code/modules/mining/vertibore.dm | 3 +- code/modules/mob/inventory/items.dm | 6 -- 9 files changed, 58 insertions(+), 49 deletions(-) diff --git a/code/__DEFINES/inventory/carry_weight.dm b/code/__DEFINES/inventory/carry_weight.dm index 5c9f4dd40c31..7520c4c763f5 100644 --- a/code/__DEFINES/inventory/carry_weight.dm +++ b/code/__DEFINES/inventory/carry_weight.dm @@ -29,11 +29,11 @@ #define ITEM_ENCUMBRANCE_ARMOR_SPECIALIZED_VEST 5 #define ITEM_ENCUMBRANCE_ARMOR_BIORAD_SUIT 15 -#define ITEM_ENCUMBRANCE_ARMOR_BIORAD_HELMET 1 +#define ITEM_ENCUMBRANCE_ARMOR_BIORAD_HELMET 0 #define ITEM_ENCUMBRANCE_ARMOR_BOMB_SUIT 15 -#define ITEM_ENCUMBRANCE_ARMOR_BOMB_HELMET 1 +#define ITEM_ENCUMBRANCE_ARMOR_BOMB_HELMET 0 #define ITEM_ENCUMBRANCE_ARMOR_FIRE_SUIT 15 -#define ITEM_ENCUMBRANCE_ARMOR_FIRE_HELMET 1 +#define ITEM_ENCUMBRANCE_ARMOR_FIRE_HELMET 0 #define ITEM_ENCUMBRANCE_ARMOR_MEDIEVAL_PLATE 20 #define ITEM_ENCUMBRANCE_ARMOR_MEDIEVAL_CHAIN 15 @@ -57,7 +57,7 @@ //* Spacesuits #define ITEM_ENCUMBRANCE_SOFTSUIT 15 -#define ITEM_ENCUMBRANCE_SOFTSUIT_HELMET 1 +#define ITEM_ENCUMBRANCE_SOFTSUIT_HELMET 0 #define ITEM_ENCUMBRANCE_VOIDSUIT 15 #define ITEM_ENCUMBRANCE_VOIDSUIT_HELMET 0 @@ -77,11 +77,13 @@ #define ITEM_ENCUMBRANCE_STORAGE_BACKPACK 5 #define ITEM_ENCUMBRANCE_STORAGE_DUFFLEBAG 15 +#define ITEM_ENCUMBRANCE_STORAGE_POUCH_LARGE 5 //* Species #define ITEM_ENCUMBRANCE_PHORONOID_SUIT 20 -#define ITEM_ENCUMBRANCE_PHORONOID_HELMET 2 +#define ITEM_ENCUMBRANCE_PHORONOID_HELMET 0 +#define ITEM_WEIGHT_TAJARAN_SWORDSMAN_ARMOR 10 //* Weapons @@ -102,20 +104,18 @@ #define ITEM_WEIGHT_BASELINE 0 -//* Tools - -#define ITEM_WEIGHT_HYBRID_TOOLS 1 - //* Armor #define ITEM_WEIGHT_ARMOR_LIGHT 5 #define ITEM_WEIGHT_ARMOR_SPECIALIZED_VEST 10 -#define ITEM_WEIGHT_ARMOR_BIORAD_SUIT 17.5 -#define ITEM_WEIGHT_ARMOR_BIORAD_SUIT_HELMET 7.5 -#define ITEM_WEIGHT_ARMOR_FIRE_SUIT 17.5 -#define ITEM_WEIGHT_ARMOR_FIRE_SUIT_HELMET 7.5 +#define ITEM_WEIGHT_ARMOR_BIORAD_SUIT 12.5 +#define ITEM_WEIGHT_ARMOR_BIORAD_SUIT_HELMET 2.5 +#define ITEM_WEIGHT_ARMOR_BOMB_SUIT 12.5 +#define ITEM_WEIGHT_ARMOR_BOMB_HELMET 2.5 +#define ITEM_WEIGHT_ARMOR_FIRE_SUIT 12.5 +#define ITEM_WEIGHT_ARMOR_FIRE_SUIT_HELMET 2.5 #define ITEM_WEIGHT_ARMOR_MEDIEVAL_PLATE 20 #define ITEM_WEIGHT_ARMOR_MEDIEVAL_CHAIN 15 @@ -130,20 +130,11 @@ #define ITEM_WEIGHT_GAS_TANK 3 #define ITEM_WEIGHT_VEHICLE_FRAME 50 -//* Weapons - -#define ITEM_WEIGHT_GUN_LIGHT 2 -#define ITEM_WEIGHT_GUN_NORMAL 4 -#define ITEM_WEIGHT_GUN_LARGE 6 -#define ITEM_WEIGHT_GUN_BULKY 8 -#define ITEM_WEIGHT_GUN_UNREASONABLE 14 -#define ITEM_WEIGHT_GUN_RIDICULOUS 20 -#define ITEM_WEIGHT_GUN_VEHICLE 30 - -#define ITEM_WEIGHT_MELEE_SPEAR 10 - //* Spacesuits / RIGs +#define ITEM_WEIGHT_SOFTSUIT 10 +#define ITEM_WEIGHT_SOFTSUIT_HELMET 2.5 + #define ITEM_WEIGHT_VOIDSUIT 15 #define ITEM_WEIGHT_VOIDSUIT_HELMET 5 #define ITEM_WEIGHT_VOIDSUIT_LIGHT 10 @@ -161,15 +152,9 @@ #define ITEM_WEIGHT_LEGACY_RIG_COMBAT 15 #define ITEM_WEIGHT_LEGACY_RIG_MILITARY 20 -//* Antags - -#define ITEM_WEIGHT_CHANGELING_ARMOR 20 -#define ITEM_WEIGHT_CULT_VOIDSUIT_HELMET 5 -#define ITEM_WEIGHT_CULT_VOIDSUIT 20 -#define ITEM_WEIGHT_TECHNOMANCER_BULKY_CORE 10 - //* Species +#define ITEM_WEIGHT_TAJARAN_SWORDSMAN_ARMOR 7.5 #define ITEM_WEIGHT_PHORONOID_SUIT 20 #define ITEM_WEIGHT_PHORONOID_HELMET 5 @@ -177,3 +162,27 @@ #define ITEM_WEIGHT_STORAGE_DUFFLEBAG 15 #define ITEM_WEIGHT_STORAGE_BACKPACK 10 +#define ITEM_WEIGHT_STORAGE_POUCH_LARGE 2 + +//* Tools + +#define ITEM_WEIGHT_HYBRID_TOOLS 1 + +//* Weapons + +#define ITEM_WEIGHT_GUN_LIGHT 2 +#define ITEM_WEIGHT_GUN_NORMAL 4 +#define ITEM_WEIGHT_GUN_LARGE 6 +#define ITEM_WEIGHT_GUN_BULKY 8 +#define ITEM_WEIGHT_GUN_UNREASONABLE 14 +#define ITEM_WEIGHT_GUN_RIDICULOUS 20 +#define ITEM_WEIGHT_GUN_VEHICLE 30 + +#define ITEM_WEIGHT_MELEE_SPEAR 10 + +//* Antags + +#define ITEM_WEIGHT_CHANGELING_ARMOR 20 +#define ITEM_WEIGHT_CULT_VOIDSUIT_HELMET 5 +#define ITEM_WEIGHT_CULT_VOIDSUIT 20 +#define ITEM_WEIGHT_TECHNOMANCER_BULKY_CORE 10 diff --git a/code/modules/clothing/spacesuits/spacesuits.dm b/code/modules/clothing/spacesuits/spacesuits.dm index 78dc09161d17..45de5eee2684 100644 --- a/code/modules/clothing/spacesuits/spacesuits.dm +++ b/code/modules/clothing/spacesuits/spacesuits.dm @@ -21,7 +21,9 @@ preserve_item = 1 flash_protection = FLASH_PROTECTION_MAJOR valid_accessory_slots = null - + weight = ITEM_WEIGHT_SOFTSUIT_HELMET + encumbrance = ITEM_ENCUMBRANCE_SOFTSUIT_HELMET + var/obj/machinery/camera/camera var/list/camera_networks @@ -73,7 +75,6 @@ clothing_flags = CLOTHING_THICK_MATERIAL | CLOTHING_INJECTION_PORT body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS allowed = list(/obj/item/flashlight,/obj/item/tank/emergency/oxygen,/obj/item/suit_cooling_unit) - slowdown = 1 armor_type = /datum/armor/general/space inv_hide_flags = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER cold_protection = UPPER_TORSO | LOWER_TORSO | LEGS | FEET | ARMS | HANDS @@ -84,6 +85,8 @@ species_restricted = list("exclude",SPECIES_DIONA) preserve_item = 1 valid_accessory_slots = (ACCESSORY_SLOT_OVER | ACCESSORY_SLOT_ARMBAND | ACCESSORY_SLOT_DECOR) + weight = ITEM_WEIGHT_SOFTSUIT + encumbrance = ITEM_ENCUMBRANCE_SOFTSUIT var/list/supporting_limbs //If not-null, automatically splints breaks. Checked when removing the suit. /obj/item/clothing/suit/space/equipped(mob/M, slot, accessory, silent, creation) diff --git a/code/modules/clothing/spacesuits/syndi.dm b/code/modules/clothing/spacesuits/syndi.dm index 2f1a9d056053..aa7a625237fa 100644 --- a/code/modules/clothing/spacesuits/syndi.dm +++ b/code/modules/clothing/spacesuits/syndi.dm @@ -12,7 +12,6 @@ desc = "A crimson spacesuit sporting clean lines and durable plating. Robust, reliable, and slightly suspicious." w_class = ITEMSIZE_NORMAL allowed = list(/obj/item/gun,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/melee/baton,/obj/item/melee/energy/sword,/obj/item/handcuffs,/obj/item/tank/emergency/oxygen) - slowdown = 1 armor_type = /datum/armor/agent/space siemens_coefficient = 0.6 diff --git a/code/modules/clothing/suits/aliens/tajara.dm b/code/modules/clothing/suits/aliens/tajara.dm index 379ed1cca5fb..2a481fd6b166 100644 --- a/code/modules/clothing/suits/aliens/tajara.dm +++ b/code/modules/clothing/suits/aliens/tajara.dm @@ -30,7 +30,8 @@ inv_hide_flags = HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER species_restricted = list(SPECIES_TAJ) armor_type = /datum/armor/general/medieval - slowdown = 0.5 + weight = ITEM_WEIGHT_TAJARAN_SWORDSMAN_ARMOR + encumbrance = ITEM_ENCUMBRANCE_TAJARAN_SWORDSMAN_ARMOR siemens_coefficient = 0.35 //Coats no hoods diff --git a/code/modules/clothing/suits/armor.dm b/code/modules/clothing/suits/armor.dm index 28bdccd2add6..32f690cabfb2 100644 --- a/code/modules/clothing/suits/armor.dm +++ b/code/modules/clothing/suits/armor.dm @@ -238,7 +238,7 @@ icon_state = "alien_speed" blood_overlay_type = "armor" item_state_slots = list(SLOT_ID_RIGHT_HAND = "armor", SLOT_ID_LEFT_HAND = "armor") - slowdown = -1 + hard_slowdown = -1 body_cover_flags = UPPER_TORSO|LOWER_TORSO armor_type = /datum/armor/alien/medium siemens_coefficient = 0.4 @@ -250,7 +250,7 @@ desc = "It's really resilient yet lightweight, so it's probably meant to be armor. Strangely enough it seems to have been designed for a humanoid shape." description_info = "It has a 40% chance to completely nullify an incoming attack." icon_state = "alien_tank" - slowdown = 0 + hard_slowdown = 0 body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS armor_type = /datum/armor/alien/heavy block_chance = 40 diff --git a/code/modules/clothing/suits/utility.dm b/code/modules/clothing/suits/utility.dm index fdd6b6ff4e6a..41a5e2265d88 100644 --- a/code/modules/clothing/suits/utility.dm +++ b/code/modules/clothing/suits/utility.dm @@ -18,7 +18,7 @@ permeability_coefficient = 0.50 body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS allowed = list(/obj/item/flashlight,/obj/item/tank/emergency/oxygen,/obj/item/extinguisher) - carry_encumberence = ITEM_ENCUMBRANCE_ARMOR_FIRE_SUIT + encumbrance = ITEM_ENCUMBRANCE_ARMOR_FIRE_SUIT weight = ITEM_WEIGHT_ARMOR_FIRE_SUIT inv_hide_flags = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER clothing_flags = 0 @@ -43,6 +43,8 @@ inv_hide_flags = HIDEMASK|HIDEEARS|HIDEEYES|BLOCKHAIR body_cover_flags = HEAD|FACE|EYES siemens_coefficient = 0 + encumbrance = ITEM_ENCUMBRANCE_ARMOR_BOMB_HELMET + weight = ITEM_WEIGHT_ARMOR_BOMB_HELMET /obj/item/clothing/suit/bomb_suit name = "bomb suit" @@ -51,7 +53,8 @@ w_class = ITEMSIZE_LARGE//bulky item gas_transfer_coefficient = 0.01 permeability_coefficient = 0.01 - slowdown = 2 + encumbrance = ITEM_ENCUMBRANCE_ARMOR_BOMB_SUIT + weight = ITEM_WEIGHT_ARMOR_BOMB_SUIT armor_type = /datum/armor/station/bomb inv_hide_flags = HIDEJUMPSUIT|HIDETAIL|HIDETIE|HIDEHOLSTER heat_protection = UPPER_TORSO|LOWER_TORSO diff --git a/code/modules/clothing/under/accessories/armor.dm b/code/modules/clothing/under/accessories/armor.dm index dbdadcb1fbd7..8a0cb4f81b04 100644 --- a/code/modules/clothing/under/accessories/armor.dm +++ b/code/modules/clothing/under/accessories/armor.dm @@ -63,7 +63,8 @@ desc = "A collection of black pouches that can be attached to a plate carrier. Carries up to four items." icon_state = "lpouches" slots = 4 - slowdown = 0.25 + weight = ITEM_WEIGHT_STORAGE_POUCH_LARGE + encumbrance = ITEM_ENCUMBRANCE_STORAGE_POUCH_LARGE /obj/item/clothing/accessory/storage/pouches/large/blue desc = "A collection of blue pouches that can be attached to a plate carrier. Carries up to four items." diff --git a/code/modules/mining/vertibore.dm b/code/modules/mining/vertibore.dm index bfc0b32e6fc9..c163e411f876 100644 --- a/code/modules/mining/vertibore.dm +++ b/code/modules/mining/vertibore.dm @@ -5,8 +5,7 @@ description_fluff = "A phoron bore used for rapidly digging through rock that has been modified to allow it to fire straight down at a much higher power. However, this has resulted in a loss of power and resource efficiency, compactness, and modularity as the proprietary capacitor and manipulator cannot be swapped." w_class = ITEMSIZE_NO_CONTAINER //haha harold can't powergame itemsize with BoHs if it doesn't even fit in a BoH //he's just going to locker it isn't he - slowdown = 1 //chonker bore is heavy boy - icon = 'icons/obj/mining.dmi' += icon = 'icons/obj/mining.dmi' icon_state = "vertibore" item_state = "vertibore" diff --git a/code/modules/mob/inventory/items.dm b/code/modules/mob/inventory/items.dm index 24547c031b2d..dc7d367d790e 100644 --- a/code/modules/mob/inventory/items.dm +++ b/code/modules/mob/inventory/items.dm @@ -134,12 +134,6 @@ L.adjust_current_carry_weight(weight_registered) L.adjust_current_carry_encumbrance(encumbrance_registered) -/** - * get the slowdown we incur when we're worn - */ -/obj/item/proc/get_equipment_speed_mod() - return slowdown - /** * update our worn icon if we can */ From db39e914b1f68ba8543da2a348a9d417f0870897 Mon Sep 17 00:00:00 2001 From: silicons Date: Sun, 30 Jul 2023 12:20:18 -0700 Subject: [PATCH 19/62] fix --- code/__DEFINES/inventory/carry_weight.dm | 5 +- code/game/objects/items.dm | 11 +- code/game/objects/items/storage/_storage.dm | 152 +++++++++++------- code/modules/clothing/clothing.dm | 1 - code/modules/clothing/clothing_accessories.dm | 20 ++- code/modules/clothing/shoes/miscellaneous.dm | 10 +- code/modules/materials/material_sheets.dm | 1 - code/modules/mining/vertibore.dm | 5 +- code/modules/mob/living/inventory.dm | 2 - 9 files changed, 128 insertions(+), 79 deletions(-) diff --git a/code/__DEFINES/inventory/carry_weight.dm b/code/__DEFINES/inventory/carry_weight.dm index 7520c4c763f5..e0a7c5090157 100644 --- a/code/__DEFINES/inventory/carry_weight.dm +++ b/code/__DEFINES/inventory/carry_weight.dm @@ -46,6 +46,9 @@ #define ITEM_ENCUMBRANCE_SHOES_CUFFED 50 #define ITEM_ENCUMBRANCE_SHOES_MAGBOOTS 10 #define ITEM_ENCUMBRANCE_SHOES_MAGBOOTS_PULSE 20 +#define ITEM_ENCUMBRANCE_SHOES_CLOWN 10 +#define ITEM_ENCUMBRANCE_SHOES_FINS 10 +#define ITEM_ENCUMBRANCE_SHOES_GALOSHES 10 //* Factions @@ -83,7 +86,7 @@ #define ITEM_ENCUMBRANCE_PHORONOID_SUIT 20 #define ITEM_ENCUMBRANCE_PHORONOID_HELMET 0 -#define ITEM_WEIGHT_TAJARAN_SWORDSMAN_ARMOR 10 +#define ITEM_ENCUMBRANCE_TAJARAN_SWORDSMAN_ARMOR 10 //* Weapons diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index a290f73ddeca..61ed734a417d 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -804,12 +804,13 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. if(istype(wearer)) wearer.adjust_current_carry_encumbrance(.) - /obj/item/proc/set_weight(amount) if(amount == weight) return + var/old = weight weight = amount update_weight() + propagate_weight(old, weight) /obj/item/proc/set_encumbrance(amount) if(amount == encumbrance) @@ -823,6 +824,14 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. hard_slowdown = amount worn_mob()?.update_item_slowdown() +/obj/item/proc/propagate_weight(old_weight, new_weight) + if(!(item_flags & ITEM_IN_STORAGE)) + return + var/obj/item/storage/S = loc + if(!istype(S)) + return + S.stored_weight_changed(src, old_weight, new_weight) + //? Attack Verbs /** diff --git a/code/game/objects/items/storage/_storage.dm b/code/game/objects/items/storage/_storage.dm index cf020cd3542d..2dbda152e487 100644 --- a/code/game/objects/items/storage/_storage.dm +++ b/code/game/objects/items/storage/_storage.dm @@ -38,7 +38,6 @@ var/last_message = 0 - #warn hook /// carry weight in us var/weight_cached = 0 /// carry weight mitigation, static. applied after multiplicative @@ -46,6 +45,66 @@ /// carry weight mitigation, multiplicative. var/weight_multiply = 1 +/obj/item/storage/Initialize(mapload) + . = ..() + + if(allow_quick_empty) + add_obj_verb(src, /obj/item/storage/verb/quick_empty) + else + remove_obj_verb(src, /obj/item/storage/verb/quick_empty) + + if(allow_quick_gather) + add_obj_verb(src, /obj/item/storage/verb/toggle_gathering_mode) + else + remove_obj_verb(src, /obj/item/storage/verb/toggle_gathering_mode) + + src.boxes = new /atom/movable/screen/storage( ) + src.boxes.name = "storage" + src.boxes.master = src + src.boxes.icon_state = "block" + src.boxes.screen_loc = storage_ui_default + + src.storage_start = new /atom/movable/screen/storage( ) + src.storage_start.name = "storage" + src.storage_start.master = src + src.storage_start.icon_state = "storage_start" + src.storage_start.screen_loc = storage_ui_default + + src.storage_continue = new /atom/movable/screen/storage( ) + src.storage_continue.name = "storage" + src.storage_continue.master = src + src.storage_continue.icon_state = "storage_continue" + src.storage_continue.screen_loc = storage_ui_default + + src.storage_end = new /atom/movable/screen/storage( ) + src.storage_end.name = "storage" + src.storage_end.master = src + src.storage_end.icon_state = "storage_end" + src.storage_end.screen_loc = storage_ui_default + + src.stored_start = new /atom/movable //we just need these to hold the icon + src.stored_start.icon_state = "stored_start" + + src.stored_continue = new /atom/movable + src.stored_continue.icon_state = "stored_continue" + + src.stored_end = new /atom/movable + src.stored_end.icon_state = "stored_end" + + src.closer = new /atom/movable/screen/close( ) + src.closer.master = src + src.closer.icon_state = "storage_close" + src.closer.hud_layerise() + orient2hud() + + populate_contents_legacy() + + PopulateContents() + + //calibrate_size() //Let's not! + + reset_weight() + /obj/item/storage/Destroy() close_all() QDEL_NULL(boxes) @@ -60,7 +119,32 @@ /obj/item/storage/get_weight() . = ..() - . += weight_cached + . += max(0, (weight_cached * weight_multiply) - weight_mitigation) + +/obj/item/storage/proc/reset_weight() + var/old_weight_cached = weight_cached + weight_cached = 0 + for(var/obj/item/I in contents) + weight_cached += I.get_weight() + propagate_weight(old_weight_cached, weight_cached) + update_weight() + +/obj/item/storage/proc/stored_weight_changed(obj/item/I, old_weight, new_weight) + var/diff = new_weight - old_weight + var/old = weight_cached + weight_cached += diff + propagate_weight(old, weight_cached) + update_weight() + +/obj/item/storage/proc/reset_weight_recursive() + do_reset_weight_recursive(200) + +/obj/item/storage/proc/do_reset_weight_recursive(safety) + if(!(safety - 1)) + CRASH("out of safety") + for(var/obj/item/storage/S in contents) + S.do_reset_weight_recursive(safety - 1) + reset_weight() /obj/item/storage/AltClick(mob/user) if(user in is_seeing) @@ -369,6 +453,9 @@ W.forceMove(src) W.on_enter_storage(src) W.item_flags |= ITEM_IN_STORAGE + var/old_weight = weight_cached + weight_cached += W.get_weight() + propagate_weight(old_weight, weight_cached) if(user) if(!prevent_warning) for(var/mob/M in viewers(user)) @@ -417,6 +504,9 @@ W.maptext = "" W.on_exit_storage(src) W.item_flags &= ~ITEM_IN_STORAGE + var/old_weight = weight_cached + weight_cached -= W.get_weight() + propagate_weight(old_weight, weight_cached) update_icon() return 1 @@ -528,64 +618,6 @@ for(var/obj/item/I in contents) remove_from_storage(I, T) -/obj/item/storage/Initialize(mapload) - . = ..() - - if(allow_quick_empty) - add_obj_verb(src, /obj/item/storage/verb/quick_empty) - else - remove_obj_verb(src, /obj/item/storage/verb/quick_empty) - - if(allow_quick_gather) - add_obj_verb(src, /obj/item/storage/verb/toggle_gathering_mode) - else - remove_obj_verb(src, /obj/item/storage/verb/toggle_gathering_mode) - - src.boxes = new /atom/movable/screen/storage( ) - src.boxes.name = "storage" - src.boxes.master = src - src.boxes.icon_state = "block" - src.boxes.screen_loc = storage_ui_default - - src.storage_start = new /atom/movable/screen/storage( ) - src.storage_start.name = "storage" - src.storage_start.master = src - src.storage_start.icon_state = "storage_start" - src.storage_start.screen_loc = storage_ui_default - - src.storage_continue = new /atom/movable/screen/storage( ) - src.storage_continue.name = "storage" - src.storage_continue.master = src - src.storage_continue.icon_state = "storage_continue" - src.storage_continue.screen_loc = storage_ui_default - - src.storage_end = new /atom/movable/screen/storage( ) - src.storage_end.name = "storage" - src.storage_end.master = src - src.storage_end.icon_state = "storage_end" - src.storage_end.screen_loc = storage_ui_default - - src.stored_start = new /atom/movable //we just need these to hold the icon - src.stored_start.icon_state = "stored_start" - - src.stored_continue = new /atom/movable - src.stored_continue.icon_state = "stored_continue" - - src.stored_end = new /atom/movable - src.stored_end.icon_state = "stored_end" - - src.closer = new /atom/movable/screen/close( ) - src.closer.master = src - src.closer.icon_state = "storage_close" - src.closer.hud_layerise() - orient2hud() - - populate_contents_legacy() - - PopulateContents() - - //calibrate_size() //Let's not! - /obj/item/storage/proc/populate_contents_legacy() if(LAZYLEN(starts_with) && !empty) for(var/newtype in starts_with) diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index c4312a52fc40..f27e06514fca 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -62,7 +62,6 @@ var/list/accessories //* Carry Weight - #warn hook /// encumbrance compensation for accessories - flat. var/encumbrance_mitigation = 0 /// encumbrance multiplier for accessories. diff --git a/code/modules/clothing/clothing_accessories.dm b/code/modules/clothing/clothing_accessories.dm index 078113dd4bf9..b9e33f015bd1 100644 --- a/code/modules/clothing/clothing_accessories.dm +++ b/code/modules/clothing/clothing_accessories.dm @@ -17,12 +17,22 @@ /obj/item/clothing/get_encumbrance() . = ..() - var/tally = 0 + if(!isnull(accessory_host)) + . = max(0, . * accessory_host.encumbrance_multiply - accessory_host.encumbrance_mitigation) + +/obj/item/clothing/proc/set_encumbrance_mitigation(val, update) + encumbrance_mitigation = val + if(update) + update_accessory_encumbrance() + +/obj/item/clothing/proc/set_encumbrance_multiply(val, update) + encumbrance_multiply = val + if(update) + update_accessory_encumbrance() + +/obj/item/clothing/proc/update_accessory_encumbrance() for(var/obj/item/I as anything in accessories) - tally += I.get_encumbrance() - tally *= (1 - encumbrance_multiply) - tally = max(0, tally - encumbrance_mitigation) - . += tally + I.update_encumbrance() /obj/item/clothing/equipped(mob/user, slot, flags) . = ..() diff --git a/code/modules/clothing/shoes/miscellaneous.dm b/code/modules/clothing/shoes/miscellaneous.dm index ed23d34b7149..58c60b2f8796 100644 --- a/code/modules/clothing/shoes/miscellaneous.dm +++ b/code/modules/clothing/shoes/miscellaneous.dm @@ -24,12 +24,11 @@ permeability_coefficient = 0.05 siemens_coefficient = 0 //They're thick rubber boots! Of course they won't conduct electricity! clothing_flags = NOSLIP - slowdown = SHOES_SLOWDOWN+1 + encumbrance = ITEM_ENCUMBRANCE_SHOES_GALOSHES species_restricted = null drop_sound = 'sound/items/drop/rubber.ogg' pickup_sound = 'sound/items/pickup/rubber.ogg' - /obj/item/clothing/shoes/dress name = "dress shoes" desc = "Sharp looking low quarters, perfect for a formal uniform." @@ -65,7 +64,7 @@ desc = "The prankster's standard-issue clowning shoes. Damn they're huge!" name = "clown shoes" icon_state = "clown" - slowdown = SHOES_SLOWDOWN+1 + encumbrance = ITEM_ENCUMBRANCE_SHOES_CLOWN damage_force = 0 var/footstep = 1 //used for squeeks whilst walking species_restricted = null @@ -137,7 +136,7 @@ icon_state = "flippers" item_state_slots = list(SLOT_ID_RIGHT_HAND = "galoshes", SLOT_ID_LEFT_HAND = "galoshes") clothing_flags = NOSLIP - slowdown = SHOES_SLOWDOWN+1 + encumbrance = ITEM_ENCUMBRANCE_SHOES_FINS species_restricted = null /obj/item/clothing/shoes/flipflop @@ -260,6 +259,7 @@ icon_state = "ante" icon = 'icons/clothing/shoes/ante.dmi' worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL + // The things folks do for fashion... /obj/item/clothing/shoes/galoshes/black name = "black galoshes" @@ -270,7 +270,7 @@ name = "dark-purple semi-galoshes" desc = "A dark-purple rubber boots. They obviously don't smell like a cotton candy, roses and fresh roasted peanuts." icon_state = "galoshes_sc" - slowdown = SHOES_SLOWDOWN + encumbrance = ITEM_ENCUMBRANCE_BASELINE //More Warhammer Fun /obj/item/clothing/shoes/utilitarian diff --git a/code/modules/materials/material_sheets.dm b/code/modules/materials/material_sheets.dm index b9d32de0dea6..e10edf48647f 100644 --- a/code/modules/materials/material_sheets.dm +++ b/code/modules/materials/material_sheets.dm @@ -275,7 +275,6 @@ apply_colour = TRUE /obj/item/stack/material/supermatter/proc/update_mass() // Due to how dangerous they can be, the item will get heavier and larger the more are in the stack. - slowdown = amount / 10 w_class = min(5, round(amount / 10) + 1) throw_range = round(amount / 7) + 1 diff --git a/code/modules/mining/vertibore.dm b/code/modules/mining/vertibore.dm index c163e411f876..ab7e20091ed5 100644 --- a/code/modules/mining/vertibore.dm +++ b/code/modules/mining/vertibore.dm @@ -3,9 +3,8 @@ name = "portable shaft excavation device" desc = "A heavily modified shaft bore utilizing phorogenic blasts to tunnel vertically through rock. Much faster than a large industrial drill unit, but is very resource- and power-intensive." description_fluff = "A phoron bore used for rapidly digging through rock that has been modified to allow it to fire straight down at a much higher power. However, this has resulted in a loss of power and resource efficiency, compactness, and modularity as the proprietary capacitor and manipulator cannot be swapped." - w_class = ITEMSIZE_NO_CONTAINER //haha harold can't powergame itemsize with BoHs if it doesn't even fit in a BoH - //he's just going to locker it isn't he -= icon = 'icons/obj/mining.dmi' + w_class = ITEMSIZE_NO_CONTAINER + icon = 'icons/obj/mining.dmi' icon_state = "vertibore" item_state = "vertibore" diff --git a/code/modules/mob/living/inventory.dm b/code/modules/mob/living/inventory.dm index 9bad8f6765d8..a5e1dd4d8277 100644 --- a/code/modules/mob/living/inventory.dm +++ b/code/modules/mob/living/inventory.dm @@ -258,8 +258,6 @@ //* carry weight -#warn rework encumbrance - // don't call this you shouldn't need to /mob/living/proc/update_carry_slowdown() recalculate_carry() From b2b64a639e52c8ad40d540655b255a14af88e932 Mon Sep 17 00:00:00 2001 From: silicons Date: Tue, 22 Aug 2023 15:32:58 -0700 Subject: [PATCH 20/62] more --- code/__DEFINES/inventory/carry_weight.dm | 17 +++++++++---- .../clothing/spacesuits/miscellaneous.dm | 24 +++++++++++++------ code/modules/clothing/spacesuits/void/merc.dm | 1 - code/modules/hardsuits/_rig.dm | 6 ++++- code/modules/hardsuits/rig_pieces.dm | 12 +++++++++- code/modules/mob/living/inventory.dm | 3 ++- 6 files changed, 47 insertions(+), 16 deletions(-) diff --git a/code/__DEFINES/inventory/carry_weight.dm b/code/__DEFINES/inventory/carry_weight.dm index e0a7c5090157..9763dae4fa83 100644 --- a/code/__DEFINES/inventory/carry_weight.dm +++ b/code/__DEFINES/inventory/carry_weight.dm @@ -74,7 +74,12 @@ #define ITEM_ENCUMBRANCE_VOIDSUIT_ANOMALY 10 #define ITEM_ENCUMBRANCE_VOIDSUIT_ANOMALY_HELMET 2.5 -#define ITEM_ENCUMBRANCE_RIGSUIT 15 +#define ITEM_ENCUMBRANCE_LEGACY_RIG_LIGHT 10 +#define ITEM_ENCUMBRANCE_LEGACY_RIG 15 +#define ITEM_ENCUMBRANCE_LEGACY_RIG_HEAVY 25 + +#define ITEM_ENCUMBRANCE_EMERGENCY_SOFTSUIT 20 +#define ITEM_ENCUMBRANCE_EMERGENCY_SOFTSUIT_HELMET 0 //* Storage @@ -150,10 +155,12 @@ #define ITEM_WEIGHT_VOIDSUIT_ANOMALY 10 #define ITEM_WEIGHT_VOIDSUIT_ANOMALY_HELMET 2.5 -#define ITEM_WEIGHT_LEGACY_RIG_TECHNICIAN 10 -#define ITEM_WEIGHT_LEGACY_RIG_PARAMEDIC 10 -#define ITEM_WEIGHT_LEGACY_RIG_COMBAT 15 -#define ITEM_WEIGHT_LEGACY_RIG_MILITARY 20 +#define ITEM_WEIGHT_LEGACY_RIG_LIGHT 10 +#define ITEM_WEIGHT_LEGACY_RIG 15 +#define ITEM_WEIGHT_LEGACY_RIG_HEAVY 25 + +#define ITEM_WEIGHT_EMERGENCY_SOFTSUIT 15 +#define ITEM_WEIGHT_EMERGENCY_SOFTSUIT_HELMET 0 //* Species diff --git a/code/modules/clothing/spacesuits/miscellaneous.dm b/code/modules/clothing/spacesuits/miscellaneous.dm index 1825aea103b2..e507592a617c 100644 --- a/code/modules/clothing/spacesuits/miscellaneous.dm +++ b/code/modules/clothing/spacesuits/miscellaneous.dm @@ -11,6 +11,8 @@ min_cold_protection_temperature = SPACE_SUIT_MIN_COLD_PROTECTION_TEMPERATURE min_pressure_protection = 0 * ONE_ATMOSPHERE max_pressure_protection = 10 * ONE_ATMOSPHERE + weight = ITEM_WEIGHT_VOIDSUIT_HELMET + encumbrance = ITEM_ENCUMBRANCE_VOIDSUIT_HELMET //Captain's space suit This is not the proper path but I don't currently know enough about how this all works to mess with it. /obj/item/clothing/suit/armor/captain @@ -23,7 +25,8 @@ clothing_flags = 0 body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS allowed = list(/obj/item/tank/emergency/oxygen, /obj/item/flashlight,/obj/item/gun/energy, /obj/item/gun/ballistic, /obj/item/ammo_magazine, /obj/item/ammo_casing, /obj/item/melee/baton,/obj/item/handcuffs) - slowdown = 1.5 + encumbrance = ITEM_ENCUMBRANCE_VOIDSUIT + weight = ITEM_WEIGHT_VOIDSUIT armor_type = /datum/armor/station/tactical inv_hide_flags = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETAIL cold_protection = UPPER_TORSO | LOWER_TORSO | LEGS | FEET | ARMS | HANDS @@ -66,8 +69,9 @@ name = "Santa's suit" desc = "Festive!" icon_state = "santa" - slowdown = 0 - clothing_flags = 0 + weight = ITEM_WEIGHT_BASELINE + encumbrance = ITEM_ENCUMBRANCE_BASELINE + clothing_flags = NONE allowed = list(/obj/item) //for stuffing exta special presents //Space pirate outfit @@ -76,9 +80,11 @@ desc = "Yarr." icon_state = "pirate" armor_type = /datum/armor/pirate/medium - clothing_flags = 0 + weight = ITEM_WEIGHT_BASELINE + encumbrance = ITEM_ENCUMBRANCE_BASELINE + clothing_flags = NONE inv_hide_flags = BLOCKHAIR - body_cover_flags = 0 + body_cover_flags = NONE siemens_coefficient = 0.9 /obj/item/clothing/suit/space/pirate //Whhhhyyyyyyy??? @@ -87,7 +93,8 @@ icon_state = "pirate" w_class = ITEMSIZE_NORMAL allowed = list(/obj/item/gun,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/melee/baton,/obj/item/handcuffs,/obj/item/tank/emergency/oxygen) - slowdown = 0 + weight = ITEM_WEIGHT_BASELINE + encumbrance = ITEM_ENCUMBRANCE_BASELINE armor_type = /datum/armor/pirate/medium siemens_coefficient = 0.9 inv_hide_flags = HIDETAIL|HIDEHOLSTER @@ -99,12 +106,15 @@ icon_state = "syndicate-helm-orange" desc = "A simple helmet with a built in light, smells like mothballs." flash_protection = FLASH_PROTECTION_NONE + encumbrance = ITEM_ENCUMBRANCE_EMERGENCY_SOFTSUIT_HELMET + weight = ITEM_WEIGHT_EMERGENCY_SOFTSUIT_HELMET /obj/item/clothing/suit/space/emergency name = "Emergency Softsuit" icon_state = "syndicate-orange" desc = "A thin, ungainly softsuit colored in blaze orange for rescuers to easily locate, looks pretty fragile." - slowdown = 4 + encumbrance = ITEM_ENCUMBRANCE_EMERGENCY_SOFTSUIT + weight = ITEM_WEIGHT_EMERGENCY_SOFTSUIT //Russian Emergency Suit /obj/item/clothing/head/helmet/space/emergency/russian diff --git a/code/modules/clothing/spacesuits/void/merc.dm b/code/modules/clothing/spacesuits/void/merc.dm index 5858ddf20e18..1589e6780351 100644 --- a/code/modules/clothing/spacesuits/void/merc.dm +++ b/code/modules/clothing/spacesuits/void/merc.dm @@ -89,7 +89,6 @@ name = "clown commando voidsuit" desc = "An advanced suit that protects against injuries during special operations. An intricate bananium wafer in the shape of a banana bears the crest of Columbina." item_state_slots = list(SLOT_ID_RIGHT_HAND = "syndie_voidsuit", SLOT_ID_LEFT_HAND = "syndie_voidsuit") - slowdown = 1 w_class = ITEMSIZE_NORMAL armor_type = /datum/armor/merc/space/clown allowed = list(/obj/item/flashlight,/obj/item/tank,/obj/item/suit_cooling_unit,/obj/item/gun,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/melee/baton,/obj/item/melee/energy/sword,/obj/item/handcuffs) diff --git a/code/modules/hardsuits/_rig.dm b/code/modules/hardsuits/_rig.dm index 88057190c8e5..de0c81ff53cc 100644 --- a/code/modules/hardsuits/_rig.dm +++ b/code/modules/hardsuits/_rig.dm @@ -32,6 +32,11 @@ unacidable = 1 preserve_item = 1 + weight = ITEM_WEIGHT_BASELINE + encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG + var/offline_weight = ITEM_WEIGHT_LEGACY_RIG + var/offline_encumbrance = ITEM_WEIGHT_LEGACY_ENCUMBRANCE * 2 + // Activation /// activation state var/activation_state = RIG_ACTIVATION_OFF @@ -92,7 +97,6 @@ var/locked_down = 0 var/seal_delay = SEAL_DELAY - var/offline_slowdown = 3 // If the suit is deployed and unpowered, it sets slowdown to this. var/vision_restriction var/offline_vision_restriction = 1 // 0 - none, 1 - welder vision, 2 - blind. Maybe move this to helmets. var/airtight = 1 //If set, will adjust ALLOWINTERNALS flag and pressure protections on components. Otherwise it should leave them untouched. diff --git a/code/modules/hardsuits/rig_pieces.dm b/code/modules/hardsuits/rig_pieces.dm index f06fd025829c..c4070fef4f73 100644 --- a/code/modules/hardsuits/rig_pieces.dm +++ b/code/modules/hardsuits/rig_pieces.dm @@ -16,6 +16,9 @@ min_pressure_protection = null damage_force = 3 // if you're headbutting someone with something meant to protect you from space... + weight = 0 + encumbrance = 0 + species_restricted = list( SPECIES_AKULA, SPECIES_ALRAUNE, @@ -50,6 +53,9 @@ heat_protection = HANDS cold_protection = HANDS + weight = 0 + encumbrance = 0 + species_restricted = list( SPECIES_AKULA, SPECIES_ALRAUNE, @@ -87,6 +93,9 @@ icon_base = null damage_force = 5 // if you're kicking someone with something meant to keep you locked on a hunk of metal... + weight = 0 + encumbrance = 0 + species_restricted = list( SPECIES_AKULA, SPECIES_ALRAUNE, @@ -125,7 +134,8 @@ inv_hide_flags = HIDEJUMPSUIT|HIDETAIL heat_protection = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS - slowdown = NONE + weight = 0 + encumbrance = 0 // Will reach 10 breach damage after 25 laser carbine blasts, 3 revolver hits, or ~1 PTR hit. // Completely immune to smg or sts hits. diff --git a/code/modules/mob/living/inventory.dm b/code/modules/mob/living/inventory.dm index a5e1dd4d8277..7f07cd17d89d 100644 --- a/code/modules/mob/living/inventory.dm +++ b/code/modules/mob/living/inventory.dm @@ -285,13 +285,14 @@ update_carry() /mob/living/proc/carry_weight_to_slowdown(amount) - return 0 + return 0 /mob/living/proc/carry_encumbrance_to_slowdown(amount) return 0 /mob/living/proc/update_carry() var/slowdown = max(carry_weight_to_slowdown(cached_carry_weight), carry_encumbrance_to_slowdown(cached_carry_encumbrance)) + #warn throw alert if(slowdown) add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/mob_inventory_carry, multiplicative_slowdown = slowdown) else From eedca2ce76ba69d6263aeb18a2142fe8a43dae4e Mon Sep 17 00:00:00 2001 From: silicons Date: Wed, 23 Aug 2023 12:57:20 -0700 Subject: [PATCH 21/62] fix --- code/__DEFINES/inventory/carry_weight.dm | 10 +++-- .../clothing/spacesuits/miscellaneous.dm | 1 - .../clothing/spacesuits/void/zaddat.dm | 2 - code/modules/mob/living/carbon/inventory.dm | 8 +++- code/modules/mob/physiology.dm | 42 +++++++++++++++---- 5 files changed, 48 insertions(+), 15 deletions(-) diff --git a/code/__DEFINES/inventory/carry_weight.dm b/code/__DEFINES/inventory/carry_weight.dm index 9763dae4fa83..05d830d9d102 100644 --- a/code/__DEFINES/inventory/carry_weight.dm +++ b/code/__DEFINES/inventory/carry_weight.dm @@ -3,7 +3,7 @@ //? weight - how much stuff weighs //? encumberence - how hard it is to move with an item -//? Carry strength - flat strength +//? Carry strength - flat strength. you can carry up to this with no penalty. #define CARRY_STRENGTH_BASELINE 15 #define CARRY_STRENGTH_UNATHI 17.5 @@ -14,9 +14,13 @@ #define CARRY_STRENGTH_XENOCHIMERA 20 #define CARRY_STRENGTH_XENOHYBRID 20 -//? Carry strength - multiplier for over-limit penalty +//? Carry factor - divisor for over-limit weight to apply to penalty after exponent -#define CARRY_STRENGTH_FACTOR_BASELINE 10 +#define CARRY_FACTOR_BASELINE 7.5 + +//? Carry exponent - what's used in the formula for slowdown after extra weight is divided by divisor + +#define CARRY_EXPONENT_BASELINE (2 / 3) #warn AOIGHAOIGJOIWAJOIJ diff --git a/code/modules/clothing/spacesuits/miscellaneous.dm b/code/modules/clothing/spacesuits/miscellaneous.dm index e507592a617c..bb7a0a035882 100644 --- a/code/modules/clothing/spacesuits/miscellaneous.dm +++ b/code/modules/clothing/spacesuits/miscellaneous.dm @@ -127,4 +127,3 @@ name = "Sovjet Emergency Softsuit" icon_state = "russian" desc = "A chunky antique softsuit distributed to members of the Indo-Russian Diaspora. After all this time, it looks pretty fragile." - slowdown = 4 diff --git a/code/modules/clothing/spacesuits/void/zaddat.dm b/code/modules/clothing/spacesuits/void/zaddat.dm index 61456871d7a8..3502ce939f7d 100644 --- a/code/modules/clothing/spacesuits/void/zaddat.dm +++ b/code/modules/clothing/spacesuits/void/zaddat.dm @@ -5,7 +5,6 @@ item_state_slots = list(SLOT_ID_RIGHT_HAND = "syndicate", SLOT_ID_LEFT_HAND = "syndicate") heat_protection = HEAD body_cover_flags = HEAD|FACE|EYES - slowdown = 0.5 armor_type = /datum/armor/zaddat siemens_coefficient = 1 @@ -14,7 +13,6 @@ /obj/item/clothing/suit/space/void/zaddat name = "\improper Hegemony Shroud" desc = "A Hegemony environment suit, still favored by the Spacer Zaddat because of its durability and ease of manufacture." - slowdown = 1 armor_type = /datum/armor/zaddat siemens_coefficient = 1 allowed = list(/obj/item/flashlight,/obj/item/tank) diff --git a/code/modules/mob/living/carbon/inventory.dm b/code/modules/mob/living/carbon/inventory.dm index 6977001e0fc7..43b12c87887a 100644 --- a/code/modules/mob/living/carbon/inventory.dm +++ b/code/modules/mob/living/carbon/inventory.dm @@ -48,10 +48,14 @@ //* carry weight /mob/living/carbon/carry_weight_to_slowdown(amount) - #warn impl + . = max(0, amount - physiology.carry_strength) + if(.) + . = (. / physiology.carry_factor) ** physiology.carry_exponent /mob/living/carbon/carry_encumbrance_to_slowdown(amount) - #warn impl + . = max(0, amount - physiology.carry_strength) + if(.) + . = (. / physiology.carry_factor) ** physiology.carry_exponent /mob/living/carbon/get_item_slowdown() . = ..() diff --git a/code/modules/mob/physiology.dm b/code/modules/mob/physiology.dm index de1e8dd84b5a..aecdb0f51921 100644 --- a/code/modules/mob/physiology.dm +++ b/code/modules/mob/physiology.dm @@ -7,16 +7,37 @@ // todo: /datum/global_physiology should hold global body physiology, limbs should hold modifiers/whatever themselves. // this way biologies can be supported as efficiently as possible. - /// carry weight baseline modify +- - var/carry_weight_baseline = 0 - /// carry weight penalty divisor +- - var/carry_weight_penalty + /// carry weight baseline modify + var/carry_strength = CARRY_STRENGTH_BASELINE + /// carry weight penalty divisor + var/carry_factor = CARRY_FACTOR_BASELINE + /// carry weight exponent + var/carry_exponent = CARRY_EXPONENT_BASELINE + +/datum/global_physiology/proc/reset() + carry_strength = initial(carry_strength) + carry_factor = initial(carry_factor) + carry_exponent = initial(carry_exponent) /datum/global_physiology/proc/apply(datum/physiology_modifier/modifier) - // todo: modifier/apply_global, modifier/apply_bodypart + if(!isnull(modifier.carry_strength_add)) + carry_strength += modifier.carry_strength_add + if(!isnull(modifier.carry_factor_mult)) + carry_factor *= modifier.carry_factor_mult + if(!isnull(modifier.carry_exponent_mult)) + carry_exponent = carry_exponent ** modifier.carry_exponent_pow +/** + * return FALSE if we need to reset due to non-canonical operations + */ /datum/global_physiology/proc/revert(datum/physiology_modifier/modifier) - // todo: modifier/apply_global, modifier/apply_bodypart + . = TRUE + if(!isnull(modifier.carry_strength_add)) + carry_strength -= modifier.carry_strength_add + if(!isnull(modifier.carry_factor_mult)) + carry_factor /= modifier.carry_factor_mult + if(!isnull(modifier.carry_exponent_mult)) + carry_exponent = carry_exponent ** (1 / modifier.carry_exponent_pow) /** * physiology modifier @@ -29,6 +50,11 @@ // todo: on biologies update, we need to specify what biologies this applies to + //? global modifiers + var/carry_strength_add + var/carry_factor_mult + var/carry_exponent_pow + /** * subtype for hardcoded physiology modifiers */ @@ -80,7 +106,9 @@ GLOBAL_LIST_EMPTY(cached_physiology_modifiers) modifier = cached_physiology_modifier(modifier) ASSERT(modifier in physiology_modifiers) physiology_modifiers -= modifier - physiology.revert(modifier) + if(!physiology.revert(modifier)) + // todo: optimize with reset(). + rebuild_physiology() /** * completely rebuilds physiology from our modifiers From bf3423ca9cb345856989fd3787ceb8e8b202bb91 Mon Sep 17 00:00:00 2001 From: silicons Date: Wed, 23 Aug 2023 23:05:44 -0700 Subject: [PATCH 22/62] fixes --- code/__DEFINES/inventory/carry_weight.dm | 2 +- code/modules/species/species.dm | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/code/__DEFINES/inventory/carry_weight.dm b/code/__DEFINES/inventory/carry_weight.dm index 05d830d9d102..fe222cb1a365 100644 --- a/code/__DEFINES/inventory/carry_weight.dm +++ b/code/__DEFINES/inventory/carry_weight.dm @@ -22,7 +22,7 @@ #define CARRY_EXPONENT_BASELINE (2 / 3) -#warn AOIGHAOIGJOIWAJOIJ +#warn species physiology mods for above //? Item Encumbrance defines diff --git a/code/modules/species/species.dm b/code/modules/species/species.dm index f24a8524d320..130601b23a9d 100644 --- a/code/modules/species/species.dm +++ b/code/modules/species/species.dm @@ -44,6 +44,7 @@ /// Intrinsic datum traits to apply to the mob var/list/mob_traits // todo: list of physiologies to add. list, incase we want to have separate ones for separate biology flags. + #warn *scream //? Additional info /// what you see on tooltip/examine From 12419036fb3f30899e99d13ede311058785223ae Mon Sep 17 00:00:00 2001 From: silicons Date: Mon, 28 Aug 2023 19:37:42 -0700 Subject: [PATCH 23/62] stuff --- code/__DEFINES/vv.dm | 4 ++++ code/modules/mob/physiology.dm | 21 ++++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/code/__DEFINES/vv.dm b/code/__DEFINES/vv.dm index c911c5e2b3ed..74f97ebc4be1 100644 --- a/code/__DEFINES/vv.dm +++ b/code/__DEFINES/vv.dm @@ -96,6 +96,10 @@ #define VV_HK_EDIT_COLOR_MATRIX "edit_color_matrix" #define VV_HK_EDIT_ARMOR "edit_armor" +// /mob +#define VV_HK_ADD_PHYSIOLOGY_MODIFIER "add_physiology_mod" +#define VV_HK_REMOVE_PHYSIOLOGY_MODIFIER "remove_physiology_mod" + /* // /obj #define VV_HK_OSAY "osay" diff --git a/code/modules/mob/physiology.dm b/code/modules/mob/physiology.dm index aecdb0f51921..0b15b82f9605 100644 --- a/code/modules/mob/physiology.dm +++ b/code/modules/mob/physiology.dm @@ -12,6 +12,7 @@ /// carry weight penalty divisor var/carry_factor = CARRY_FACTOR_BASELINE /// carry weight exponent + // todo: a modifier var for this var/carry_exponent = CARRY_EXPONENT_BASELINE /datum/global_physiology/proc/reset() @@ -24,8 +25,6 @@ carry_strength += modifier.carry_strength_add if(!isnull(modifier.carry_factor_mult)) carry_factor *= modifier.carry_factor_mult - if(!isnull(modifier.carry_exponent_mult)) - carry_exponent = carry_exponent ** modifier.carry_exponent_pow /** * return FALSE if we need to reset due to non-canonical operations @@ -36,8 +35,6 @@ carry_strength -= modifier.carry_strength_add if(!isnull(modifier.carry_factor_mult)) carry_factor /= modifier.carry_factor_mult - if(!isnull(modifier.carry_exponent_mult)) - carry_exponent = carry_exponent ** (1 / modifier.carry_exponent_pow) /** * physiology modifier @@ -45,6 +42,8 @@ /datum/physiology_modifier abstract_type = /datum/physiology_modifier + /// our name + var/name /// is this a globally cached modifier? var/is_globally_cached = FALSE @@ -121,4 +120,16 @@ GLOBAL_LIST_EMPTY(cached_physiology_modifiers) continue physiology.apply(modifier) -// todo: admin vv verb via tgui to input new modifier +/mob/vv_get_dropdown() + . = ..() + VV_DROPDOWN_OPTION(null, "-----") + VV_DROPDOWN_OPTION(VV_HK_ADD_PHYSIOLOGY_MODIFIER, "Add PHysiology Modifier") + VV_DROPDOWN_OPTION(VV_HK_REMOVE_PHYSIOLOGY_MODIFIER, "Remove PHysiology Modifier") + +/mob/vv_do_topic(list/href_list) + . = ..() + if(href_list[VV_HK_ADD_PHYSIOLOGY_MODIFIER]) + #warn impl + if(href_list[VV_HK_REMOVE_PHYSIOLOGY_MODIFIER]) + #warn impl + From a3a73f7c76c0f402280863758ecf7c5e3742f1ff Mon Sep 17 00:00:00 2001 From: silicons Date: Sat, 9 Sep 2023 00:09:14 -0700 Subject: [PATCH 24/62] numbers balancing is going to be unfun --- code/__DEFINES/inventory/carry_weight.dm | 14 +++++++++----- code/modules/hardsuits/_rig.dm | 14 ++++++-------- code/modules/hardsuits/suits/combat.dm | 8 ++++---- code/modules/hardsuits/suits/light.dm | 5 ++--- code/modules/hardsuits/suits/merc.dm | 4 ++-- code/modules/hardsuits/suits/species/protean.dm | 4 ++-- code/modules/hardsuits/suits/species/unathi.dm | 4 ++-- code/modules/hardsuits/suits/species/vox.dm | 1 - code/modules/hardsuits/suits/station/cargo.dm | 2 -- .../modules/hardsuits/suits/station/engineering.dm | 10 +++++----- code/modules/mob/physiology.dm | 1 - code/modules/species/species.dm | 8 ++++++-- 12 files changed, 38 insertions(+), 37 deletions(-) diff --git a/code/__DEFINES/inventory/carry_weight.dm b/code/__DEFINES/inventory/carry_weight.dm index fe222cb1a365..9fd4d80d3426 100644 --- a/code/__DEFINES/inventory/carry_weight.dm +++ b/code/__DEFINES/inventory/carry_weight.dm @@ -1,7 +1,7 @@ //? Despite this being carry_weight.dm, this contains defines for: -//? carry strength - how much someone can carry -//? weight - how much stuff weighs -//? encumberence - how hard it is to move with an item +//? carry strength - how much someone can carry or move +//? weight - how much stuff weighs, recursive +//? encumberence - how hard it is to move with an item, non-recursive //? Carry strength - flat strength. you can carry up to this with no penalty. @@ -48,8 +48,12 @@ //* Clothing #define ITEM_ENCUMBRANCE_SHOES_CUFFED 50 -#define ITEM_ENCUMBRANCE_SHOES_MAGBOOTS 10 -#define ITEM_ENCUMBRANCE_SHOES_MAGBOOTS_PULSE 20 +/// magboots off +#define ITEM_ENCUMBRANCE_SHOES_MAGBOOTS 5 +/// normal magboots on +#define ITEM_ENCUMBRANCE_SHOES_MAGBOOTS_PULSE 10 +/// ce magboots on +#define ITEM_ENCUMBRANCE_SHOES_MAGBOOTS_PULSE_ADVANCED 5 #define ITEM_ENCUMBRANCE_SHOES_CLOWN 10 #define ITEM_ENCUMBRANCE_SHOES_FINS 10 #define ITEM_ENCUMBRANCE_SHOES_GALOSHES 10 diff --git a/code/modules/hardsuits/_rig.dm b/code/modules/hardsuits/_rig.dm index ced075b2b5a0..90b9fc307403 100644 --- a/code/modules/hardsuits/_rig.dm +++ b/code/modules/hardsuits/_rig.dm @@ -34,8 +34,8 @@ weight = ITEM_WEIGHT_BASELINE encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG - var/offline_weight = ITEM_WEIGHT_LEGACY_RIG - var/offline_encumbrance = ITEM_WEIGHT_LEGACY_ENCUMBRANCE * 2 + var/online_encumbrance + var/offline_encumbrance = ITEM_WEIGHT_LEGACY_RIG * 2 // Activation /// activation state @@ -565,13 +565,10 @@ last_online = FALSE for(var/obj/item/hardsuit_module/module in installed_modules) module.deactivate() - slowdown = offline_slowdown + set_encumbrance(offline_encumbrance) if(istype(wearer)) if(is_activated()) - if (offline_slowdown < 3) - to_chat(wearer, "Your suit beeps stridently, and suddenly goes dead.") - else - to_chat(wearer, "Your suit beeps stridently, and suddenly you're wearing a leaden mass of metal and plastic composites instead of a powered suit.") + to_chat(wearer, "Your suit beeps stridently, and suddenly you're wearing a leaden mass of metal and plastic composites instead of a powered suit.") if(offline_vision_restriction == 1) to_chat(wearer, "The suit optics flicker and die, leaving you with restricted vision.") else if(offline_vision_restriction == 2) @@ -584,7 +581,8 @@ last_online = TRUE if(istype(wearer) && !wearer.wearing_rig) wearer.wearing_rig = src - slowdown = initial(slowdown) + sprint_slowdown_modifier + set_encumbrance(isnull(online_encumbrance)? initial(encumbrance) : online_encumbrance) + hard_slowdown = initial(hard_slowdown) + sprint_slowdown_modifier if(cell && cell.charge > 0 && electrified > 0) electrified-- diff --git a/code/modules/hardsuits/suits/combat.dm b/code/modules/hardsuits/suits/combat.dm index 6f0dcf4db3fc..ae94a2f3f158 100644 --- a/code/modules/hardsuits/suits/combat.dm +++ b/code/modules/hardsuits/suits/combat.dm @@ -16,8 +16,8 @@ icon_state = "security_rig" suit_type = "combat hardsuit" armor_type = /datum/armor/hardsuit/combat - slowdown = 1 - offline_slowdown = 3 + encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG_HEAVY + offline_encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG_HEAVY * 2 offline_vision_restriction = 1 helm_type = /obj/item/clothing/head/helmet/space/hardsuit/combat @@ -65,8 +65,8 @@ icon_state = "military_rig" suit_type = "military hardsuit" armor_type = /datum/armor/hardsuit/military - slowdown = 1 - offline_slowdown = 3 + encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG_HEAVY + offline_encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG_HEAVY * 2 offline_vision_restriction = 1 allowed = list( /obj/item/flashlight, diff --git a/code/modules/hardsuits/suits/light.dm b/code/modules/hardsuits/suits/light.dm index da0613ba8262..59c745e9e3f4 100644 --- a/code/modules/hardsuits/suits/light.dm +++ b/code/modules/hardsuits/suits/light.dm @@ -14,9 +14,9 @@ allowed = list(/obj/item/gun,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/melee/baton,/obj/item/handcuffs,/obj/item/tank,/obj/item/suit_cooling_unit,/obj/item/cell) armor_type = /datum/armor/hardsuit/light emp_protection = 10 - slowdown = 0 + encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG_LIGHT + offline_encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG_LIGHT * 2 clothing_flags = CLOTHING_THICK_MATERIAL - offline_slowdown = 0 offline_vision_restriction = 0 chest_type = /obj/item/clothing/suit/space/hardsuit/light @@ -88,7 +88,6 @@ desc = "A unique suit of nano-enhanced armor designed for covert operations." icon_state = "ninja_rig" emp_protection = 40 //change this to 30 if too high. - slowdown = 0 chest_type = /obj/item/clothing/suit/space/hardsuit/light/ninja glove_type = /obj/item/clothing/gloves/gauntlets/hardsuit/light/ninja diff --git a/code/modules/hardsuits/suits/merc.dm b/code/modules/hardsuits/suits/merc.dm index 5dd2f90d1e99..72e78c098c70 100644 --- a/code/modules/hardsuits/suits/merc.dm +++ b/code/modules/hardsuits/suits/merc.dm @@ -17,8 +17,8 @@ icon_state = "merc_rig" suit_type = "crimson hardsuit" armor_type = /datum/armor/hardsuit/merc - slowdown = 1 - offline_slowdown = 3 + encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG_HEAVY + offline_encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG_HEAVY * 2 offline_vision_restriction = 1 siemens_coefficient = 0.3 glove_type = /obj/item/clothing/gloves/gauntlets/hardsuit/eva diff --git a/code/modules/hardsuits/suits/species/protean.dm b/code/modules/hardsuits/suits/species/protean.dm index 4f7073061634..499b7da77f4d 100644 --- a/code/modules/hardsuits/suits/species/protean.dm +++ b/code/modules/hardsuits/suits/species/protean.dm @@ -4,8 +4,8 @@ icon_state = "nanomachine_rig" armor_type = /datum/armor/hardsuit/protean siemens_coefficient = 0.5 - slowdown = 0 - offline_slowdown = 0 + encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG_LIGHT + offline_encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG_LIGHT * 2 seal_delay = 1 var/mob/living/carbon/human/myprotean initial_modules = list( diff --git a/code/modules/hardsuits/suits/species/unathi.dm b/code/modules/hardsuits/suits/species/unathi.dm index 90e804e7212d..6d0ca3859b96 100644 --- a/code/modules/hardsuits/suits/species/unathi.dm +++ b/code/modules/hardsuits/suits/species/unathi.dm @@ -5,8 +5,8 @@ icon_state = "breacher_hardsuit_cheap" armor_type = /datum/armor/hardsuit/breacher emp_protection = -20 - slowdown = 6 - offline_slowdown = 10 + encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG_HEAVY * 2 + offline_encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG_HEAVY * 4 vision_restriction = 1 offline_vision_restriction = 2 siemens_coefficient = 0.75 diff --git a/code/modules/hardsuits/suits/species/vox.dm b/code/modules/hardsuits/suits/species/vox.dm index 900e92d94fec..ce02abf6e3e8 100644 --- a/code/modules/hardsuits/suits/species/vox.dm +++ b/code/modules/hardsuits/suits/species/vox.dm @@ -7,7 +7,6 @@ atom_flags = PHORONGUARD clothing_flags = CLOTHING_THICK_MATERIAL siemens_coefficient = 0.2 - offline_slowdown = 5 allowed = list( /obj/item/gun, /obj/item/flashlight, diff --git a/code/modules/hardsuits/suits/station/cargo.dm b/code/modules/hardsuits/suits/station/cargo.dm index df54f98bd0df..0ec49ab57534 100644 --- a/code/modules/hardsuits/suits/station/cargo.dm +++ b/code/modules/hardsuits/suits/station/cargo.dm @@ -4,8 +4,6 @@ desc = "A heavy, powerful hardsuit used by construction crews and mining corporations." icon_state = "engineering_rig" armor_type = /datum/armor/hardsuit/industrial - slowdown = 1 - offline_slowdown = 10 offline_vision_restriction = 2 emp_protection = -20 siemens_coefficient= 0.75 diff --git a/code/modules/hardsuits/suits/station/engineering.dm b/code/modules/hardsuits/suits/station/engineering.dm index 6b5424544aa2..7f9a19eb7c53 100644 --- a/code/modules/hardsuits/suits/station/engineering.dm +++ b/code/modules/hardsuits/suits/station/engineering.dm @@ -4,8 +4,8 @@ desc = "A light hardsuit for repairs and maintenance to the outside of habitats and vessels." icon_state = "eva_rig" armor_type = /datum/armor/hardsuit/eva - slowdown = 0 - offline_slowdown = 1 + encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG_LIGHT + offline_encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG_LIGHT * 2 offline_vision_restriction = 1 siemens_coefficient= 0.75 seal_delay = 24 //Should be slightly faster than other hardsuits, giving Engineering faster response time for emergencies. @@ -57,8 +57,8 @@ desc = "An advanced voidsuit that protects against hazardous, low pressure environments. Shines with a high polish." icon_state = "ce_rig" armor_type = /datum/armor/hardsuit/ce - slowdown = 0 - offline_slowdown = 0 + encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG_LIGHT + offline_encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG_LIGHT * 2 offline_vision_restriction = 0 siemens_coefficient= 0.75 rigsuit_max_pressure = 20 * ONE_ATMOSPHERE // Max pressure the hardsuit protects against when sealed @@ -97,7 +97,7 @@ siemens_coefficient = 0 /obj/item/clothing/shoes/magboots/hardsuit/ce - slowdown_on = 0 + encumbrance_on = ITEM_ENCUMBRANCE_SHOES_MAGBOOTS_PULSE_ADVANCED /obj/item/hardsuit/ce/equipped initial_modules = list( diff --git a/code/modules/mob/physiology.dm b/code/modules/mob/physiology.dm index 0b15b82f9605..1bdcb442df89 100644 --- a/code/modules/mob/physiology.dm +++ b/code/modules/mob/physiology.dm @@ -52,7 +52,6 @@ //? global modifiers var/carry_strength_add var/carry_factor_mult - var/carry_exponent_pow /** * subtype for hardcoded physiology modifiers diff --git a/code/modules/species/species.dm b/code/modules/species/species.dm index 130601b23a9d..6debc29833a1 100644 --- a/code/modules/species/species.dm +++ b/code/modules/species/species.dm @@ -43,8 +43,8 @@ //? Traits / Physiology /// Intrinsic datum traits to apply to the mob var/list/mob_traits - // todo: list of physiologies to add. list, incase we want to have separate ones for separate biology flags. - #warn *scream + /// physiology modifier to add - path or instance + var/datum/physiology_modifier/mob_physiology_modifier //? Additional info /// what you see on tooltip/examine @@ -528,6 +528,8 @@ H.maxHealth = total_health + H.add_physiology_modifier(mob_physiology_modifier) + add_inherent_verbs(H) for(var/name in traits) @@ -554,6 +556,8 @@ remove_inherent_verbs(H) H.holder_type = null + H.remove_physiology_modifier(mob_physiology_modifier) + for(var/name in traits) var/datum/trait/T = all_traits[name] T.remove(src, H) From 1eb838ac927a63a0ad23280439d4523d298a08bd Mon Sep 17 00:00:00 2001 From: silicons Date: Sun, 24 Sep 2023 16:53:49 -0700 Subject: [PATCH 25/62] this really does make shit too complicated huh --- code/__DEFINES/inventory/carry_weight.dm | 156 ++++++++++++------ code/modules/clothing/head/helmet.dm | 4 + code/modules/clothing/shoes/leg_guards.dm | 6 +- .../clothing/spacesuits/void/station.dm | 6 +- .../clothing/spacesuits/void/void_vr.dm | 3 +- .../clothing/spacesuits/void/wizard.dm | 3 +- code/modules/clothing/suits/armor.dm | 27 ++- .../clothing/under/accessories/armor.dm | 9 +- .../hardsuits/suits/station/medical.dm | 4 +- code/modules/hardsuits/suits/station/misc.dm | 4 +- .../hardsuits/suits/station/science.dm | 4 +- .../hardsuits/suits/station/security.dm | 2 - code/modules/mob/mob.dm | 3 + code/modules/mob/physiology.dm | 55 ++++++ 14 files changed, 207 insertions(+), 79 deletions(-) diff --git a/code/__DEFINES/inventory/carry_weight.dm b/code/__DEFINES/inventory/carry_weight.dm index 9fd4d80d3426..35d3859245b2 100644 --- a/code/__DEFINES/inventory/carry_weight.dm +++ b/code/__DEFINES/inventory/carry_weight.dm @@ -30,7 +30,33 @@ //* Armor -#define ITEM_ENCUMBRANCE_ARMOR_SPECIALIZED_VEST 5 +#define ITEM_ENCUMBRANCE_ARMOR_ULTRALIGHT 1.25 +#define ITEM_ENCUMBRANCE_ARMOR_LIGHT 2.5 +#define ITEM_ENCUMBRANCE_ARMOR_MEDIUM 5 +#define ITEM_ENCUMBRANCE_ARMOR_HEAVY 7.5 +#define ITEM_ENCUMBRANCE_ARMOR_SUPERHEAVY 10 +#define ITEM_ENCUMBRANCE_ARMOR_SPECIALIZED 5 + +#define ITEM_ENCUMBRANCE_ARMOR_ULTRALIGHT_HELMET 0.5 +#define ITEM_ENCUMBRANCE_ARMOR_LIGHT_HELMET 1.25 +#define ITEM_ENCUMBRANCE_ARMOR_MEDIUM_HELMET 2.5 +#define ITEM_ENCUMBRANCE_ARMOR_HEAVY_HELMET 3.75 +#define ITEM_ENCUMBRANCE_ARMOR_SUPERHEAVY_HELMET 5 +#define ITEM_ENCUMBRANCE_ARMOR_SPECIALIZED_HELMET 5 + +#define ITEM_ENCUMBRANCE_ARMOR_ULTRALIGHT_GLOVES 0.5 +#define ITEM_ENCUMBRANCE_ARMOR_LIGHT_GLOVES 1.25 +#define ITEM_ENCUMBRANCE_ARMOR_MEDIUM_GLOVES 2.5 +#define ITEM_ENCUMBRANCE_ARMOR_HEAVY_GLOVES 3.75 +#define ITEM_ENCUMBRANCE_ARMOR_SUPERHEAVY_GLOVES 5 +#define ITEM_ENCUMBRANCE_ARMOR_SPECIALIZED_GLOVES 5 + +#define ITEM_ENCUMBRANCE_ARMOR_ULTRALIGHT_BOOTS 0.5 +#define ITEM_ENCUMBRANCE_ARMOR_LIGHT_BOOTS 1.25 +#define ITEM_ENCUMBRANCE_ARMOR_MEDIUM_BOOTS 2.5 +#define ITEM_ENCUMBRANCE_ARMOR_HEAVY_BOOTS 3.75 +#define ITEM_ENCUMBRANCE_ARMOR_SUPERHEAVY_BOOTS 5 +#define ITEM_ENCUMBRANCE_ARMOR_SPECIALIZED_BOOTS 5 #define ITEM_ENCUMBRANCE_ARMOR_BIORAD_SUIT 15 #define ITEM_ENCUMBRANCE_ARMOR_BIORAD_HELMET 0 @@ -122,85 +148,109 @@ //* Armor -#define ITEM_WEIGHT_ARMOR_LIGHT 5 - -#define ITEM_WEIGHT_ARMOR_SPECIALIZED_VEST 10 - -#define ITEM_WEIGHT_ARMOR_BIORAD_SUIT 12.5 -#define ITEM_WEIGHT_ARMOR_BIORAD_SUIT_HELMET 2.5 -#define ITEM_WEIGHT_ARMOR_BOMB_SUIT 12.5 -#define ITEM_WEIGHT_ARMOR_BOMB_HELMET 2.5 -#define ITEM_WEIGHT_ARMOR_FIRE_SUIT 12.5 -#define ITEM_WEIGHT_ARMOR_FIRE_SUIT_HELMET 2.5 - -#define ITEM_WEIGHT_ARMOR_MEDIEVAL_PLATE 20 -#define ITEM_WEIGHT_ARMOR_MEDIEVAL_CHAIN 15 - -#define ITEM_WEIGHT_ARMOR_ANOMALY 10 -#define ITEM_WEIGHT_ARMOR_ANOMALY_HELMET 2.5 +#define ITEM_WEIGHT_ARMOR_ULTRALIGHT 0 +#define ITEM_WEIGHT_ARMOR_LIGHT 0 +#define ITEM_WEIGHT_ARMOR_MEDIUM 0 +#define ITEM_WEIGHT_ARMOR_HEAVY 0 +#define ITEM_WEIGHT_ARMOR_SUPERHEAVY 0 +#define ITEM_WEIGHT_ARMOR_SPECIALIZED 0 + +#define ITEM_WEIGHT_ARMOR_ULTRALIGHT_HELMET 0 +#define ITEM_WEIGHT_ARMOR_LIGHT_HELMET 0 +#define ITEM_WEIGHT_ARMOR_MEDIUM_HELMET 0 +#define ITEM_WEIGHT_ARMOR_HEAVY_HELMET 0 +#define ITEM_WEIGHT_ARMOR_SUPERHEAVY_HELMET 0 +#define ITEM_WEIGHT_ARMOR_SPECIALIZED_HELMET 0 + +#define ITEM_WEIGHT_ARMOR_ULTRALIGHT_GLOVES 0 +#define ITEM_WEIGHT_ARMOR_LIGHT_GLOVES 0 +#define ITEM_WEIGHT_ARMOR_MEDIUM_GLOVES 0 +#define ITEM_WEIGHT_ARMOR_HEAVY_GLOVES 0 +#define ITEM_WEIGHT_ARMOR_SUPERHEAVY_GLOVES 0 +#define ITEM_WEIGHT_ARMOR_SPECIALIZED_GLOVES 0 + +#define ITEM_WEIGHT_ARMOR_ULTRALIGHT_BOOTS 0 +#define ITEM_WEIGHT_ARMOR_LIGHT_BOOTS 0 +#define ITEM_WEIGHT_ARMOR_MEDIUM_BOOTS 0 +#define ITEM_WEIGHT_ARMOR_HEAVY_BOOTS 0 +#define ITEM_WEIGHT_ARMOR_SUPERHEAVY_BOOTS 0 +#define ITEM_WEIGHT_ARMOR_SPECIALIZED_BOOTS 0 + +#define ITEM_WEIGHT_ARMOR_BIORAD_SUIT 0 +#define ITEM_WEIGHT_ARMOR_BIORAD_SUIT_HELMET 0 +#define ITEM_WEIGHT_ARMOR_BOMB_SUIT 0 +#define ITEM_WEIGHT_ARMOR_BOMB_HELMET 0 +#define ITEM_WEIGHT_ARMOR_FIRE_SUIT 0 +#define ITEM_WEIGHT_ARMOR_FIRE_SUIT_HELMET 0 + +#define ITEM_WEIGHT_ARMOR_MEDIEVAL_PLATE 0 +#define ITEM_WEIGHT_ARMOR_MEDIEVAL_CHAIN 0 + +#define ITEM_WEIGHT_ARMOR_ANOMALY 0 +#define ITEM_WEIGHT_ARMOR_ANOMALY_HELMET 0 //* Clothing //* Items -#define ITEM_WEIGHT_GAS_TANK 3 -#define ITEM_WEIGHT_VEHICLE_FRAME 50 +#define ITEM_WEIGHT_GAS_TANK 0 +#define ITEM_WEIGHT_VEHICLE_FRAME 0 //* Spacesuits / RIGs -#define ITEM_WEIGHT_SOFTSUIT 10 -#define ITEM_WEIGHT_SOFTSUIT_HELMET 2.5 +#define ITEM_WEIGHT_SOFTSUIT 0 +#define ITEM_WEIGHT_SOFTSUIT_HELMET 0 -#define ITEM_WEIGHT_VOIDSUIT 15 -#define ITEM_WEIGHT_VOIDSUIT_HELMET 5 -#define ITEM_WEIGHT_VOIDSUIT_LIGHT 10 -#define ITEM_WEIGHT_VOIDSUIT_HELMET_LIGHT 2.5 -#define ITEM_WEIGHT_VOIDSUIT_HEAVY 20 -#define ITEM_WEIGHT_VOIDSUIT_HELMET_HEAVY 7.5 -#define ITEM_WEIGHT_VOIDSUIT_ULTRALIGHT 5 +#define ITEM_WEIGHT_VOIDSUIT 0 +#define ITEM_WEIGHT_VOIDSUIT_HELMET 0 +#define ITEM_WEIGHT_VOIDSUIT_LIGHT 0 +#define ITEM_WEIGHT_VOIDSUIT_HELMET_LIGHT 0 +#define ITEM_WEIGHT_VOIDSUIT_HEAVY 0 +#define ITEM_WEIGHT_VOIDSUIT_HELMET_HEAVY 0 +#define ITEM_WEIGHT_VOIDSUIT_ULTRALIGHT 0 #define ITEM_WEIGHT_VOIDSUIT_HELMET_ULTRALIGHT 0 -#define ITEM_WEIGHT_VOIDSUIT_ANOMALY 10 -#define ITEM_WEIGHT_VOIDSUIT_ANOMALY_HELMET 2.5 +#define ITEM_WEIGHT_VOIDSUIT_ANOMALY 0 +#define ITEM_WEIGHT_VOIDSUIT_ANOMALY_HELMET 0 -#define ITEM_WEIGHT_LEGACY_RIG_LIGHT 10 -#define ITEM_WEIGHT_LEGACY_RIG 15 -#define ITEM_WEIGHT_LEGACY_RIG_HEAVY 25 +#define ITEM_WEIGHT_LEGACY_RIG_LIGHT 0 +#define ITEM_WEIGHT_LEGACY_RIG 0 +#define ITEM_WEIGHT_LEGACY_RIG_HEAVY 0 -#define ITEM_WEIGHT_EMERGENCY_SOFTSUIT 15 +#define ITEM_WEIGHT_EMERGENCY_SOFTSUIT 0 #define ITEM_WEIGHT_EMERGENCY_SOFTSUIT_HELMET 0 //* Species -#define ITEM_WEIGHT_TAJARAN_SWORDSMAN_ARMOR 7.5 -#define ITEM_WEIGHT_PHORONOID_SUIT 20 -#define ITEM_WEIGHT_PHORONOID_HELMET 5 +#define ITEM_WEIGHT_TAJARAN_SWORDSMAN_ARMOR 0 +#define ITEM_WEIGHT_PHORONOID_SUIT 0 +#define ITEM_WEIGHT_PHORONOID_HELMET 0 //* Storage -#define ITEM_WEIGHT_STORAGE_DUFFLEBAG 15 -#define ITEM_WEIGHT_STORAGE_BACKPACK 10 -#define ITEM_WEIGHT_STORAGE_POUCH_LARGE 2 +#define ITEM_WEIGHT_STORAGE_DUFFLEBAG 0 +#define ITEM_WEIGHT_STORAGE_BACKPACK 0 +#define ITEM_WEIGHT_STORAGE_POUCH_LARGE 0 //* Tools -#define ITEM_WEIGHT_HYBRID_TOOLS 1 +#define ITEM_WEIGHT_HYBRID_TOOLS 0 //* Weapons -#define ITEM_WEIGHT_GUN_LIGHT 2 -#define ITEM_WEIGHT_GUN_NORMAL 4 -#define ITEM_WEIGHT_GUN_LARGE 6 -#define ITEM_WEIGHT_GUN_BULKY 8 -#define ITEM_WEIGHT_GUN_UNREASONABLE 14 -#define ITEM_WEIGHT_GUN_RIDICULOUS 20 -#define ITEM_WEIGHT_GUN_VEHICLE 30 +#define ITEM_WEIGHT_GUN_LIGHT 0 +#define ITEM_WEIGHT_GUN_NORMAL 0 +#define ITEM_WEIGHT_GUN_LARGE 0 +#define ITEM_WEIGHT_GUN_BULKY 0 +#define ITEM_WEIGHT_GUN_UNREASONABLE 0 +#define ITEM_WEIGHT_GUN_RIDICULOUS 0 +#define ITEM_WEIGHT_GUN_VEHICLE 0 -#define ITEM_WEIGHT_MELEE_SPEAR 10 +#define ITEM_WEIGHT_MELEE_SPEAR 0 //* Antags -#define ITEM_WEIGHT_CHANGELING_ARMOR 20 -#define ITEM_WEIGHT_CULT_VOIDSUIT_HELMET 5 -#define ITEM_WEIGHT_CULT_VOIDSUIT 20 -#define ITEM_WEIGHT_TECHNOMANCER_BULKY_CORE 10 +#define ITEM_WEIGHT_CHANGELING_ARMOR 0 +#define ITEM_WEIGHT_CULT_VOIDSUIT_HELMET 0 +#define ITEM_WEIGHT_CULT_VOIDSUIT 0 +#define ITEM_WEIGHT_TECHNOMANCER_BULKY_CORE 0 diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index a6559ca8c673..0f3e54591375 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -16,6 +16,8 @@ ear_protection = 1 drop_sound = 'sound/items/drop/helm.ogg' pickup_sound = 'sound/items/pickup/helm.ogg' + encumbrance = ITEM_ENCUMBRANCE_ARMOR_MEDIUM_HELMET + weight = ITEM_WEIGHT_ARMOR_MEDIUM_HELMET /obj/item/clothing/head/helmet/ntsec name = "corpsec helmet" @@ -130,6 +132,8 @@ cold_protection = HEAD min_cold_protection_temperature = SPACE_HELMET_MIN_COLD_PROTECTION_TEMPERATURE siemens_coefficient = 0.5 + encumbrance = ITEM_ENCUMBRANCE_ARMOR_HEAVY_HELMET + weight = ITEM_WEIGHT_ARMOR_HEAVY_HELMET /obj/item/clothing/head/helmet/alien name = "alien helmet" diff --git a/code/modules/clothing/shoes/leg_guards.dm b/code/modules/clothing/shoes/leg_guards.dm index fdef4c976a0d..6bdb4650acf0 100644 --- a/code/modules/clothing/shoes/leg_guards.dm +++ b/code/modules/clothing/shoes/leg_guards.dm @@ -2,7 +2,8 @@ name = "leg guards" desc = "These will protect your legs and feet." body_cover_flags = LEGS|FEET - slowdown = SHOES_SLOWDOWN+0.5 + weight = ITEM_WEIGHT_ARMOR_MEDIUM_BOOTS + encumbrance = ITEM_ENCUMBRANCE_ARMOR_MEDIUM_BOOTS species_restricted = null //Unathi and Taj can wear leg armor now w_class = ITEMSIZE_NORMAL step_volume_mod = 1.3 @@ -68,7 +69,8 @@ icon_state = "leg_guards_flexitac" item_state_slots = list(SLOT_ID_RIGHT_HAND = "jackboots", SLOT_ID_LEFT_HAND = "jackboots") siemens_coefficient = 0.6 - slowdown = SHOES_SLOWDOWN+0.2 + weight = ITEM_WEIGHT_ARMOR_LIGHT_BOOTS + encumbrance = ITEM_ENCUMBRANCE_ARMOR_LIGHT_BOOTS armor_type = /datum/armor/station/tactical min_cold_protection_temperature = T0C - 20 cold_protection = LEGS diff --git a/code/modules/clothing/spacesuits/void/station.dm b/code/modules/clothing/spacesuits/void/station.dm index e2f2fba25558..2f43860e0a64 100644 --- a/code/modules/clothing/spacesuits/void/station.dm +++ b/code/modules/clothing/spacesuits/void/station.dm @@ -378,7 +378,6 @@ icon_state = "capsuit_void" armor_type = /datum/armor/station/tactical allowed = list(/obj/item/flashlight,/obj/item/tank,/obj/item/suit_cooling_unit,/obj/item/gun) - slowdown = 1.5 //Head of Security - update to the snowflake suit /obj/item/clothing/head/helmet/space/void/headofsecurity @@ -387,6 +386,8 @@ icon_state = "hosproto" armor_type = /datum/armor/security/hos/space camera_networks = list(NETWORK_SEC_HELMETS) + encumbrance = ITEM_ENCUMBRANCE_VOIDSUIT_HELMET_HEAVY + weight = ITEM_WEIGHT_VOIDSUIT_HELMET_HEAVY /obj/item/clothing/suit/space/void/headofsecurity desc = "A customized security voidsuit. Has additional composite armor." @@ -394,7 +395,8 @@ icon_state = "hosproto_void" armor_type = /datum/armor/security/hos/space allowed = list(/obj/item/flashlight,/obj/item/tank,/obj/item/suit_cooling_unit,/obj/item/gun) - slowdown = 1.5 + encumbrance = ITEM_ENCUMBRANCE_VOIDSUIT_HEAVY + weight = ITEM_WEIGHT_VOIDSUIT_HEAVY //PARA /obj/item/clothing/head/helmet/space/void/para diff --git a/code/modules/clothing/spacesuits/void/void_vr.dm b/code/modules/clothing/spacesuits/void/void_vr.dm index fa35d972d674..756207f9efc4 100644 --- a/code/modules/clothing/spacesuits/void/void_vr.dm +++ b/code/modules/clothing/spacesuits/void/void_vr.dm @@ -115,7 +115,8 @@ icon_state = "autoloksuit" item_state = "autoloksuit" armor_type = /datum/armor/autolok/space - slowdown = 0.5 + encumbrance = ITEM_ENCUMBRANCE_VOIDSUIT_LIGHT + weight = ITEM_WEIGHT_VOIDSUIT_LIGHT siemens_coefficient = 1 species_restricted = list("exclude",SPECIES_DIONA,SPECIES_VOX) //this thing can autoadapt breach_threshold = 6 //this thing is basically tissue paper diff --git a/code/modules/clothing/spacesuits/void/wizard.dm b/code/modules/clothing/spacesuits/void/wizard.dm index 5072351338bf..14c307259942 100644 --- a/code/modules/clothing/spacesuits/void/wizard.dm +++ b/code/modules/clothing/spacesuits/void/wizard.dm @@ -16,7 +16,8 @@ name = "gem-encrusted voidsuit" desc = "A bizarre gem-encrusted suit that radiates magical energies." item_state_slots = list(SLOT_ID_RIGHT_HAND = "wiz_voidsuit", SLOT_ID_LEFT_HAND = "wiz_voidsuit") - slowdown = 1 + encumbrance = ITEM_ENCUMBRANCE_VOIDSUIT_LIGHT + weight = ITEM_WEIGHT_VOIDSUIT_LIGHT w_class = ITEMSIZE_NORMAL unacidable = 1 armor_type = /datum/armor/wizard diff --git a/code/modules/clothing/suits/armor.dm b/code/modules/clothing/suits/armor.dm index 873d986ece75..57bc63918ce3 100644 --- a/code/modules/clothing/suits/armor.dm +++ b/code/modules/clothing/suits/armor.dm @@ -69,8 +69,8 @@ icon_state = "bulletproof" item_state_slots = list(SLOT_ID_RIGHT_HAND = "armor", SLOT_ID_LEFT_HAND = "armor") blood_overlay_type = "armor" - encumbrance = ITEM_ENCUMBRANCE_ARMOR_SPECIALIZED_VEST - weight = ITEM_WEIGHT_ARMOR_SPECIALIZED_VEST + encumbrance = ITEM_ENCUMBRANCE_ARMOR_SPECIALIZED + weight = ITEM_WEIGHT_ARMOR_SPECIALIZED armor_type = /datum/armor/station/ballistic siemens_coefficient = 0.7 @@ -116,7 +116,8 @@ desc = "A vest that protects the wearer from several common types of ranged weaponry." icon_state = "combat" blood_overlay_type = "armor" - slowdown = 0.5 + encumbrance = ITEM_ENCUMBRANCE_ARMOR_MEDIUM + weight = ITEM_WEIGHT_ARMOR_MEDIUM armor_type = /datum/armor/station/combat siemens_coefficient = 0.6 @@ -127,7 +128,8 @@ item_state_slots = list(SLOT_ID_RIGHT_HAND = "swat", SLOT_ID_LEFT_HAND = "swat") body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS inv_hide_flags = HIDETIE|HIDEHOLSTER - slowdown = 1 + encumbrance = ITEM_ENCUMBRANCE_ARMOR_LIGHT + weight = ITEM_WEIGHT_ARMOR_LIGHT armor_type = /datum/armor/station/tactical siemens_coefficient = 0.7 @@ -141,7 +143,8 @@ clothing_flags = CLOTHING_THICK_MATERIAL body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS allowed = list(/obj/item/gun,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/melee/baton,/obj/item/handcuffs,/obj/item/tank/emergency/oxygen,/obj/item/clothing/head/helmet) - slowdown = 1 + encumbrance = ITEM_ENCUMBRANCE_ARMOR_HEAVY + ITEM_ENCUMBRANCE_ARMOR_HEAVY_BOOTS + ITEM_ENCUMBRANCE_ARMOR_HEAVY_GLOVES + weight = ITEM_WEIGHT_ARMOR_HEAVY + ITEM_WEIGHT_ARMOR_HEAVY_BOOTS + ITEM_WEIGHT_ARMOR_HEAVY_GLOVES w_class = ITEMSIZE_HUGE armor_type = /datum/armor/centcom/deathsquad inv_hide_flags = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETIE|HIDEHOLSTER @@ -160,6 +163,8 @@ blood_overlay_type = "coat" inv_hide_flags = 0 body_cover_flags = UPPER_TORSO|ARMS + encumbrance = ITEM_ENCUMBRANCE_ARMOR_HEAVY + weight = ITEM_WEIGHT_ARMOR_HEAVY /obj/item/clothing/suit/armor/det_suit name = "armor" @@ -430,7 +435,8 @@ item_state = "flexitac" cold_protection = UPPER_TORSO|LOWER_TORSO min_cold_protection_temperature = T0C - 20 - slowdown = 0.3 + encumbrance = ITEM_ENCUMBRANCE_ARMOR_MEDIUM + weight = ITEM_WEIGHT_ARMOR_MEDIUM /obj/item/clothing/suit/storage/vest/detective name = "detective armor vest" @@ -453,7 +459,8 @@ icon_state = "webvest" item_state_slots = list(SLOT_ID_RIGHT_HAND = "swat", SLOT_ID_LEFT_HAND = "swat") armor_type = /datum/armor/station/heavy - slowdown = 0.5 + encumbrance = ITEM_ENCUMBRANCE_ARMOR_HEAVY + weight = ITEM_WEIGHT_ARMOR_HEAVY /obj/item/clothing/suit/storage/vest/heavy/officer name = "officer heavy armor vest" @@ -494,7 +501,8 @@ icon_state = "mercwebvest" item_state_slots = list(SLOT_ID_RIGHT_HAND = "swat", SLOT_ID_LEFT_HAND = "swat") armor_type = /datum/armor/station/combat - slowdown = 0 + encumbrance = ITEM_ENCUMBRANCE_ARMOR_MEDIUM + weight = ITEM_WEIGHT_ARMOR_MEDIUM /obj/item/clothing/suit/storage/vest/capcarapace name = "captain's carapace" @@ -566,9 +574,10 @@ w_class = ITEMSIZE_HUGE // Very bulky, very heavy. gas_transfer_coefficient = 0.90 body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS - slowdown = 5 // If you're a tank you're gonna move like a tank. inv_hide_flags = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETIE|HIDEHOLSTER siemens_coefficient = 0 + encumbrance = ITEM_ENCUMBRANCE_ARMOR_SUPERHEAVY + ITEM_ENCUMBRANCE_ARMOR_SUPERHEAVY_GLOVES + ITEM_ENCUMBRANCE_ARMOR_SUPERHEAVY_BOOTS + weight = ITEM_WEIGHT_ARMOR_SUPERHEAVY + ITEM_ENCUMBRANCE_ARMOR_SUPERHEAVY_GLOVES + ITEM_ENCUMBRANCE_ARMOR_SUPERHEAVY_BOOTS /obj/item/clothing/suit/armor/tdome body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS diff --git a/code/modules/clothing/under/accessories/armor.dm b/code/modules/clothing/under/accessories/armor.dm index 8a0cb4f81b04..c0c12bc5cdbd 100644 --- a/code/modules/clothing/under/accessories/armor.dm +++ b/code/modules/clothing/under/accessories/armor.dm @@ -163,14 +163,16 @@ name = "ballistic armor plate" desc = "A hefty silicon carbide armor plate with a layer of heavy tungsten, followed by a second coating of a polyurethane elastomeric to mitigate spalling from lower calibers as they're deflected. It's design is state of of the art when it comes to ballistics, and as a concequence the material is rather heavy, and is not as capable of dispersing laser fire as other armor varients. Fits within a plate carrier." icon_state = "armor_ballistic" - slowdown = 0.65 + weight = ITEM_WEIGHT_ARMOR_SPECIALIZED + encumbrance = ITEM_ENCUMBRANCE_ARMOR_SPECIALIZED armor_type = /datum/armor/station/ballistic /obj/item/clothing/accessory/armor/armorplate/riot name = "riot armor plate" desc = "A synthetic mesh armor insert made of densely woven aromatic polyamide fibers, coated in malleable ballistic gelatin, and finally tight-jacketed with woven steel-polyethylene filaments. This provides excellent protection against low-velocity trauma, but most modern projectiles could tear through it with ease. Fits within a plate carrier." icon_state = "armor_riot" - slowdown = 0.65 + weight = ITEM_WEIGHT_ARMOR_SPECIALIZED + encumbrance = ITEM_ENCUMBRANCE_ARMOR_SPECIALIZED armor_type = /datum/armor/station/riot siemens_coefficient = 0.5 @@ -178,7 +180,8 @@ name = "ablative armor plate" desc = "A highly reflective cobalt-chromium-tungsten alloy forms the seemingly jagged surface of the armor plate, which is adorned in perfectly cut and fitted glass prisms that form a smooth low-poly surface. When the ablative armor plate is working as designed, the glass prisms reflect laser fire inwards towards the innermost vertex for subsequent 'ablation', and sometimes reflection. There is a warning label on the back that warns you. It reads: Attempting to use this ablative armor plate to deflect ballistics and/or non-standard energy beams could result in 'rapid deconstruction' of the armor plate and its user. Fits within a plate carrier." icon_state = "armor_ablative" - slowdown = 0.65 + weight = ITEM_WEIGHT_ARMOR_SPECIALIZED + encumbrance = ITEM_ENCUMBRANCE_ARMOR_SPECIALIZED armor_type = /datum/armor/station/ablative siemens_coefficient = 0.2 diff --git a/code/modules/hardsuits/suits/station/medical.dm b/code/modules/hardsuits/suits/station/medical.dm index c5e8403af5c7..95e83f2eeb4d 100644 --- a/code/modules/hardsuits/suits/station/medical.dm +++ b/code/modules/hardsuits/suits/station/medical.dm @@ -4,8 +4,8 @@ desc = "A durable suit designed for medical rescue in high risk areas." icon_state = "medical_rig" armor_type = /datum/armor/hardsuit/medical - slowdown = 1 - offline_vision_restriction = 1 + encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG_LIGHT + offline_encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG_LIGHT * 2 siemens_coefficient= 0.75 helm_type = /obj/item/clothing/head/helmet/space/hardsuit/medical diff --git a/code/modules/hardsuits/suits/station/misc.dm b/code/modules/hardsuits/suits/station/misc.dm index 83dca958b893..904a6bb22508 100644 --- a/code/modules/hardsuits/suits/station/misc.dm +++ b/code/modules/hardsuits/suits/station/misc.dm @@ -5,8 +5,8 @@ icon_state = "internalaffairs_rig" armor_type = /datum/armor/none siemens_coefficient = 0.9 - slowdown = 0 - offline_slowdown = 0 + encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG_LIGHT + offline_encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG_LIGHT * 2 offline_vision_restriction = 0 allowed = list( diff --git a/code/modules/hardsuits/suits/station/science.dm b/code/modules/hardsuits/suits/station/science.dm index 55446554860c..f4320fc9592d 100644 --- a/code/modules/hardsuits/suits/station/science.dm +++ b/code/modules/hardsuits/suits/station/science.dm @@ -4,8 +4,8 @@ desc = "An Anomalous Material Interaction hardsuit that protects against the strangest energies the universe can throw at it." icon_state = "science_rig" armor_type = /datum/armor/hardsuit/ami - slowdown = 1 - offline_vision_restriction = 1 + encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG_LIGHT + offline_encumbrance = ITEM_ENCUMBRANCE_LEGACY_RIG_LIGHT * 2 siemens_coefficient= 0.75 helm_type = /obj/item/clothing/head/helmet/space/hardsuit/hazmat diff --git a/code/modules/hardsuits/suits/station/security.dm b/code/modules/hardsuits/suits/station/security.dm index 1f1b17fe1133..019155c5fd2e 100644 --- a/code/modules/hardsuits/suits/station/security.dm +++ b/code/modules/hardsuits/suits/station/security.dm @@ -4,8 +4,6 @@ desc = "A Security hardsuit designed for prolonged EVA in dangerous environments." icon_state = "hazard_rig" armor_type = /datum/armor/hardsuit/hazard - slowdown = 1 - offline_slowdown = 3 offline_vision_restriction = 1 siemens_coefficient= 0.7 diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 019feab2cad9..765ee5364da2 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -59,6 +59,9 @@ status_effects = null // mob lists mob_list_unregister(stat) + // physiology + QDEL_NULL(physiology) + physiology_modifiers = null // movespeed movespeed_modification = null // actionspeed diff --git a/code/modules/mob/physiology.dm b/code/modules/mob/physiology.dm index 1bdcb442df89..fbbee5ef5282 100644 --- a/code/modules/mob/physiology.dm +++ b/code/modules/mob/physiology.dm @@ -4,6 +4,9 @@ * todo: on biologies update, we might need to lazy-cache this, and have different physiologies for each biology. */ /datum/global_physiology + // back-reference to mob, for vv purposes. + var/mob/ownership + // todo: /datum/global_physiology should hold global body physiology, limbs should hold modifiers/whatever themselves. // this way biologies can be supported as efficiently as possible. @@ -15,6 +18,10 @@ // todo: a modifier var for this var/carry_exponent = CARRY_EXPONENT_BASELINE +/datum/global_physiology/Destroy() + ownership = null + return ..() + /datum/global_physiology/proc/reset() carry_strength = initial(carry_strength) carry_factor = initial(carry_factor) @@ -36,6 +43,40 @@ if(!isnull(modifier.carry_factor_mult)) carry_factor /= modifier.carry_factor_mult +/datum/global_physiology/vv_edit_var(var_name, var_value, mass_edit, raw_edit) + // we automatically hook varedits and change the admin varedit holder so rebuilds take it into account + // this is not necessarily the best of ideas, + // because things like multiplicative factors don't scale as admins usually would expect + // but having this is better than not having it, as otherwise things would silently be wiped. + if(raw_edit) + return ..() + if(isnull(ownership)) + return ..() + var/datum/physiology_modifier/varedit/varedit_modifier = ownership.get_varedit_physiology_modifier() + switch(var_name) + if(NAMEOF(src, carry_strength)) + if(!isnum(var_value)) + if(!mass_edit) + to_chat(usr, SPAN_WARNING("Invalid value [var_value] for [var_name] physiology edit rejected.")) + return FALSE + . = ..() + if(!.) + return + varedit_modifier.carry_strength_add = var_value - carry_strength + if(NAMEOF(src, carry_factor)) + if(!isnum(var_value)) + if(!mass_edit) + to_chat(usr, SPAN_WARNING("Invalid value [var_value] for [var_name] physiology edit rejected.")) + return FALSE + . = ..() + if(!.) + return + varedit_modifier.carry_factor_mult = var_value / carry_factor + else + return ..() + if(!mass_edit) + to_chat(usr, SPAN_NOTICE("Committing change to [var_name] on [ownership] ([REF(ownership)]) to physiology modifiers automatically.")) + /** * physiology modifier */ @@ -59,6 +100,11 @@ /datum/physiology_modifier/intrinsic abstract_type = /datum/physiology_modifier/intrinsic +/** + * subtype for admin varedit tracking + */ +/datum/physiology_modifier/varedit + GLOBAL_LIST_EMPTY(cached_physiology_modifiers) /proc/cached_physiology_modifier(datum/physiology_modifier/path) @@ -113,6 +159,7 @@ GLOBAL_LIST_EMPTY(cached_physiology_modifiers) */ /mob/proc/rebuild_physiology() physiology = new + physiology.ownership = src for(var/datum/physiology_modifier/modifier as anything in physiology_modifiers) if(!istype(modifier)) physiology_modifiers -= modifier @@ -132,3 +179,11 @@ GLOBAL_LIST_EMPTY(cached_physiology_modifiers) if(href_list[VV_HK_REMOVE_PHYSIOLOGY_MODIFIER]) #warn impl +/mob/proc/get_varedit_physiology_modifier() + RETURN_TYPE(/datum/physiology_modifier) + . = locate(/datum/physiology_modifier/varedit) in physiology_modifiers + if(!isnull(.)) + return + var/datum/physiology_modifier/varedit/new_holder = new + add_physiology_modifier(new_holder) + return new_holder From 43c344073da0ba01c4ac0b94f3e7df7e50c82be4 Mon Sep 17 00:00:00 2001 From: silicons Date: Sun, 24 Sep 2023 16:55:46 -0700 Subject: [PATCH 26/62] fix --- code/modules/clothing/shoes/magboots.dm | 10 +++++----- code/modules/mob/living/inventory.dm | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/code/modules/clothing/shoes/magboots.dm b/code/modules/clothing/shoes/magboots.dm index f0ef8d12d2ba..6590ad1ad239 100644 --- a/code/modules/clothing/shoes/magboots.dm +++ b/code/modules/clothing/shoes/magboots.dm @@ -19,7 +19,7 @@ var/encumbrance_on = ITEM_ENCUMBRANCE_SHOES_MAGBOOTS_PULSE -/obj/item/clothing/shoes/magboots/proc/set_slowdown() +/obj/item/clothing/shoes/magboots/proc/update_magboot_encumbrance() set_encumbrance(initial(encumbrance) + (magpulse? encumbrance_on : 0)) /obj/item/clothing/shoes/magboots/attack_self(mob/user) @@ -29,14 +29,14 @@ if(magpulse) clothing_flags &= ~NOSLIP magpulse = 0 - set_slowdown() + update_magboot_encumbrance() damage_force = 3 if(icon_base) icon_state = "[icon_base]0" to_chat(user, "You disable the mag-pulse traction system.") else clothing_flags |= NOSLIP magpulse = 1 - set_slowdown() + update_magboot_encumbrance() damage_force = 5 if(icon_base) icon_state = "[icon_base]1" to_chat(user, "You enable the mag-pulse traction system.") @@ -56,11 +56,11 @@ /obj/item/clothing/shoes/magboots/equipped(mob/user, slot, flags) . = ..() - set_slowdown() + update_magboot_encumbrance() /obj/item/clothing/shoes/magboots/unequipped(mob/user, slot, flags) . = ..() - set_slowdown() + update_magboot_encumbrance() /obj/item/clothing/shoes/magboots/examine(mob/user, dist) . = ..() diff --git a/code/modules/mob/living/inventory.dm b/code/modules/mob/living/inventory.dm index 7f07cd17d89d..20ef01e7fba4 100644 --- a/code/modules/mob/living/inventory.dm +++ b/code/modules/mob/living/inventory.dm @@ -259,7 +259,7 @@ //* carry weight // don't call this you shouldn't need to -/mob/living/proc/update_carry_slowdown() +/mob/living/update_carry_slowdown() recalculate_carry() update_carry() @@ -300,7 +300,7 @@ //* hard movespeed slowdown -/mob/living/proc/update_item_slowdown() +/mob/living/update_item_slowdown() var/tally = get_item_slowdown() if(tally) add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/mob_item_slowdown) From d62786a482603f1fc95409e110afa9c136a24f1f Mon Sep 17 00:00:00 2001 From: silicons Date: Sun, 24 Sep 2023 17:31:45 -0700 Subject: [PATCH 27/62] screaming --- code/__DEFINES/tgui.dm | 1 + .../modules/tgui/modals/tgui_dynamic_input.dm | 128 +++++++++++++++--- 2 files changed, 113 insertions(+), 16 deletions(-) diff --git a/code/__DEFINES/tgui.dm b/code/__DEFINES/tgui.dm index 5b0c61371dcd..38bb2fdc69dc 100644 --- a/code/__DEFINES/tgui.dm +++ b/code/__DEFINES/tgui.dm @@ -63,6 +63,7 @@ #define TGUI_INPUT_DATA_KEY "key" #define TGUI_INPUT_DATA_TYPE "type" +#define TGUI_INPUT_DATA_DESC "desc" #define TGUI_INPUT_DATA_NAME "name" #define TGUI_INPUT_DATA_CONSTRAINTS "constraints" #define TGUI_INPUT_DATA_DEFAULT "default" diff --git a/code/modules/tgui/modals/tgui_dynamic_input.dm b/code/modules/tgui/modals/tgui_dynamic_input.dm index beec14dccb9a..1ae6099255cc 100644 --- a/code/modules/tgui/modals/tgui_dynamic_input.dm +++ b/code/modules/tgui/modals/tgui_dynamic_input.dm @@ -1,6 +1,103 @@ //* This file is explicitly licensed under the MIT license. *// //* Copyright (c) 2023 Citadel Station developers. *// +/** + * Helper datum used to build a query for tgui_dynamic_input + * High overhead, technically not necessary, but, this is easy to use as an API. + */ +/datum/tgui_dynamic_query + /// options list + var/list/options + +/datum/tgui_dyamic_query/proc/text(key, name, desc, max_length = 512, multi_line = FALSE, default) + RETURN_TYPE(/datum/tgui_dynamic_query) + options += list( + "key" = key, + "name" = name, + "desc" = desc, + "default" = default, + "type" = TGUI_INPUT_DATATYPE_TEXT, + "constraints" = list(max_length), + ) + return src + +/datum/tgui_dynamic_query/proc/number(key, name, desc, min_value = -INFINITY, max_value = INFINITY, round_to, default) + RETURN_TYPE(/datum/tgui_dynamic_query) + options += list( + "key" = key, + "name" = name, + "desc" = desc, + "default" = default, + "type" = TGUI_INPUT_DATATYPE_NUM, + "constraints" = list(min_value, max_value, round_to), + ) + return src + +/datum/tgui_dynamic_query/proc/toggle(key, name, desc, default) + RETURN_TYPE(/datum/tgui_dynamic_query) + options += list( + "key" = key, + "name" = name, + "desc" = desc, + "default" = default, + "type" = TGUI_INPUT_DATATYPE_TOGGLE, + "constraints" = list(), + ) + return src + +/datum/tgui_dynamic_query/proc/pick(key, name, desc, list/choices = list(), default) + RETURN_TYPE(/datum/tgui_dynamic_query) + options += list( + "key" = key, + "name" = name, + "desc" = desc, + "default" = default, + "type" = TGUI_INPUT_DATATYPE_LIST_PICK, + "constraints" = choices, + ) + return src + +/** + * builds return list of results + */ +/datum/tgui_dynamic_query/proc/get_results(list/choices) + . = list() + var/got + for(var/i in 1 to length(choices)) + var/list/params = options[i] + switch(params[TGUI_INPUT_DATA_TYPE]) + if(TGUI_INPUT_DATATYPE_TEXT) + got = isnull(choices[i]) ? params[TGUI_INPUT_DATA_DEFAULT] : choices[i] + if(!isnull(got)) + if(length(got) > params[TGUI_INPUT_DATA_CONSTRAINTS][1]) + got = copytext_char(got, 1, params[TGUI_INPUT_DATA_CONSTRAINTS][1] + 1) + . += got + if(TGUI_INPUT_DATATYPE_NUM) + got = isnull(choices[i]) ? params[TGUI_INPUT_DATA_DEFAULT] : text2num(choices[i]) + if(!isnull(got)) + got = clamp(got, params[TGUI_INPUT_DATA_CONSTRAINTS][1], params[TGUI_INPUT_DATA_CONSTRAINTS][2]) + got = round(got, params[TGUI_INPUT_DATA_CONSTRAINTS][3]) + if(TGUI_INPUT_DATATYPE_LIST_PICK) + got = isnull(choices[i]) ? params[TGUI_INPUT_DATA_DEFAULT] : choices[i] + if(!isnull(got)) + if(!(got in params[TGUI_INPUT_DATA_CONSTRAINTS])) + if(length(params[TGUI_INPUT_DATA_CONSTRAINTS])) + got = params[TGUI_INPUT_DATA_CONSTRAINTS][1] + else + got = null + . += got + if(TGUI_INPUT_DATATYPE_TOGGLE) + got = isnull(choices[i]) ? params[TGUI_INPUT_DATA_DEFAULT] : choices[i] + if(!isnull(got)) + got = !!got + . += got + +/** + * returns list to be sent to UI + */ +/datum/tgui_dynamic_query/proc/get_query() + return options + /** * Creates a TGUI input window and returns the user's response * @@ -11,14 +108,15 @@ * * user - who to send this to * * message - description in interface * * title - self explanatory - * * query - structured list of input items (see TGUI_INPUT_DATA_* defines) as list(list(data...), ...) + * * query - built query * * timeout - timeout before menu closes. if it times out, choices will be null. - * * sanitize - perform sanitize in this proc instead of trusting caller to do it * - * @return list of key-value pairs (TGUI_INPUT_DATA_KEY) associated to values + * @return list of key-value pairs (the TGUI_INPUT_DATA_KEY's you put in) associated to values */ -/proc/tgui_dynamic_input(mob/user, message, title = "Input", list/query, timeout = 0, sanitize = FALSE) - #warn impl +/proc/tgui_dynamic_input(mob/user, message, title = "Input", datum/tgui_dynamic_query/query, timeout = 0) + var/datum/tgui_dynamic_input/modal = new(user, message, title, query, timeout) + modal.block_on_finished() + return modal.query.get_results(modal.choices) /** * Creates a TGUI input window and returns the user's response @@ -30,20 +128,22 @@ * * user - who to send this to * * message - description in interface * * title - self explanatory - * * query - structured list of input items (see TGUI_INPUT_DATA_* defines) as list(list(data...), ...) + * * query - built query + * * timeout - timeout before menu closes. if it times out, choices will be null. * * callback - callback called with first arg being the picked list when we're done. - * * sanitize - perform sanitize in this proc instead of trusting caller to do it + * + * @return the /datum/tgui_dynamic_input instance created. you should probably not touch this unless you know what you're doing. */ -/proc/tgui_dynamic_input_async(mob/user, message, title = "Input", list/query, sanitize = FALSE, datum/callback/callback) - #warn impl +/proc/tgui_dynamic_input_async(mob/user, message, title = "Input", datum/tgui_dynamic_query/query, timeout = 0, datum/callback/callback) + return new /datum/tgui_dynamic_input(user, message, title, query, timeout, callback) /datum/tgui_dynamic_input /// title of the windo var/title /// message that appears inside the window var/message - /// structured query list - var/list/query + /// query datum + var/datum/tgui_dynamic_query/query /// list of user's choices; null if they haven't picked yet var/list/choices /// when we were opened @@ -54,12 +154,8 @@ var/closed /// callback to invoke on finish var/datum/callback/callback - /// do we sanitize? - var/sanitize - - #warn impl -/datum/tgui_dynamic_input/New(mob/user, message, title, list/query, timeout, sanitize, datum/callback/callback) +/datum/tgui_dynamic_input/New(mob/user, message, title, datum/tgui_dynaimc_query/query, timeout, datum/callback/callback) #warn impl /datum/tgui_dynamic_input/Destroy() From 52039d9ffe351b44300dcdac67ebba622990409a Mon Sep 17 00:00:00 2001 From: silicons Date: Sun, 24 Sep 2023 17:32:19 -0700 Subject: [PATCH 28/62] fixes --- code/game/objects/items/storage/bags.dm | 1 - code/modules/clothing/spacesuits/void/merc.dm | 8 +------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/code/game/objects/items/storage/bags.dm b/code/game/objects/items/storage/bags.dm index 6f9934682fda..da126f8105bd 100644 --- a/code/game/objects/items/storage/bags.dm +++ b/code/game/objects/items/storage/bags.dm @@ -403,7 +403,6 @@ desc = "A bag for storing slime extracts, slime potions, monkey cubes, and beakers." max_storage_space = 200 w_class = ITEMSIZE_LARGE - slowdown = 1 can_hold = list( /obj/item/reagent_containers/glass/beaker, /obj/item/reagent_containers/food/snacks/monkeycube, diff --git a/code/modules/clothing/spacesuits/void/merc.dm b/code/modules/clothing/spacesuits/void/merc.dm index 918919368f1d..c9fb92ef5ed2 100644 --- a/code/modules/clothing/spacesuits/void/merc.dm +++ b/code/modules/clothing/spacesuits/void/merc.dm @@ -109,7 +109,6 @@ icon_state = "odst" name = "hephaestus icarus suit" desc = "One of the few combat-grade suits avalible in the frontier, and the poster-child of Hephaestus Industries. Comes equipped with a wrist-bound oxygen timer." - slowdown = 1 w_class = ITEMSIZE_NORMAL armor_type = /datum/armor/station/secsuit allowed = list(/obj/item/flashlight,/obj/item/tank,/obj/item/suit_cooling_unit,/obj/item/gun,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/melee/baton,/obj/item/melee/energy/sword,/obj/item/handcuffs) @@ -129,7 +128,6 @@ icon_state = "odst_corps" name = "hephaestus icarus medic suit" desc = "A standard Icarus line suit that has been repourposed to protect from heavier biohazards." - slowdown = 1 w_class = ITEMSIZE_NORMAL armor_type = /datum/armor/exploration/space allowed = list(/obj/item/flashlight,/obj/item/tank,/obj/item/suit_cooling_unit,/obj/item/gun,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/melee/baton,/obj/item/melee/energy/sword,/obj/item/handcuffs) @@ -149,7 +147,6 @@ icon_state = "odst_orange" name = "hephaestus icarus engineer suit" desc = "Favoured suit of deep-space engineers, comfortable and comparable to suits avalible to NanoTrasen Engineers. Comes equipped with a wrist-bound oxygen timer." - slowdown = 1 w_class = ITEMSIZE_NORMAL armor_type = /datum/armor/engineering/space allowed = list(/obj/item/flashlight,/obj/item/tank,/obj/item/suit_cooling_unit,/obj/item/gun,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/melee/baton,/obj/item/melee/energy/sword,/obj/item/handcuffs) @@ -169,7 +166,6 @@ icon_state = "odst_purple" name = "hephaestus icarus frontier suit" desc = "Cheaper version of the main Icarus line, often marketed to Frontier settlements. Perfect for Expeditions." - slowdown = 1 w_class = ITEMSIZE_NORMAL armor_type = /datum/armor/exploration/space allowed = list(/obj/item/flashlight,/obj/item/tank,/obj/item/suit_cooling_unit,/obj/item/gun,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/melee/baton,/obj/item/melee/energy/sword,/obj/item/handcuffs) @@ -193,7 +189,6 @@ name = "necropolis operations suit" desc = "The main suit used by Necropolis Industries security division, a heavily modified Hephaestus Icarus suit emblazoned with the Necropolis logo on the left shoulder. Equipped with direct connections to the user's implants and prosthetics, making it function as a second skin." item_state_slots = list(SLOT_ID_RIGHT_HAND = "syndie_voidsuit", SLOT_ID_LEFT_HAND = "syndie_voidsuit") - slowdown = 0.4 w_class = ITEMSIZE_NORMAL armor_type = /datum/armor/merc/space allowed = list(/obj/item/flashlight,/obj/item/tank,/obj/item/suit_cooling_unit,/obj/item/gun,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/melee/baton,/obj/item/melee/energy/sword,/obj/item/handcuffs) @@ -205,9 +200,8 @@ name = "necropolis field medic suit" desc = "The main suit used by Necropolis Industries security division, a heavily modified Hephaestheus Icarus suit emblazoned with the Necropolis logo on the left shoulder and a blue cross on the right arm. Equipped with direct connections to the user's implants and prosthetics, making it function as a second skin." item_state_slots = list(SLOT_ID_RIGHT_HAND = "syndie_voidsuit", SLOT_ID_LEFT_HAND = "syndie_voidsuit") - slowdown = 0.4 w_class = ITEMSIZE_NORMAL armor_type = /datum/armor/merc/space allowed = list(/obj/item/flashlight,/obj/item/tank,/obj/item/suit_cooling_unit,/obj/item/gun,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/melee/baton,/obj/item/melee/energy/sword,/obj/item/handcuffs) siemens_coefficient = 0.6 - species_restricted = null + species_restricted = null From f214a6f9f2335b23e89333207e59b14b24694a93 Mon Sep 17 00:00:00 2001 From: silicons Date: Sun, 24 Sep 2023 17:40:31 -0700 Subject: [PATCH 29/62] adds some more license identifiers to my code --- citadel.dme | 1 + code/modules/mob/living/carbon/cpr.dm | 3 + .../mob/living/carbon/human/inventory.dm | 79 +------------------ .../living/carbon/human/inventory_legacy.dm | 75 ++++++++++++++++++ code/modules/mob/living/carbon/inventory.dm | 3 + code/modules/mob/living/carbon/perspective.dm | 3 + .../modules/tgui/modals/tgui_dynamic_input.dm | 2 +- code/modules/tgui/module.dm | 5 +- code/modules/tgui/modules/general/cardmod.dm | 3 + .../tgui/modules/specific/lathe_control.dm | 3 + 10 files changed, 97 insertions(+), 80 deletions(-) create mode 100644 code/modules/mob/living/carbon/human/inventory_legacy.dm diff --git a/citadel.dme b/citadel.dme index 9c1ba8f70a3f..d19127776360 100644 --- a/citadel.dme +++ b/citadel.dme @@ -3411,6 +3411,7 @@ #include "code\modules\mob\living\carbon\human\human_resist.dm" #include "code\modules\mob\living\carbon\human\human_species.dm" #include "code\modules\mob\living\carbon\human\inventory.dm" +#include "code\modules\mob\living\carbon\human\inventory_legacy.dm" #include "code\modules\mob\living\carbon\human\life.dm" #include "code\modules\mob\living\carbon\human\login.dm" #include "code\modules\mob\living\carbon\human\logout.dm" diff --git a/code/modules/mob/living/carbon/cpr.dm b/code/modules/mob/living/carbon/cpr.dm index 644f68539fe1..3aedb9610009 100644 --- a/code/modules/mob/living/carbon/cpr.dm +++ b/code/modules/mob/living/carbon/cpr.dm @@ -1,3 +1,6 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2023 Citadel Station developers. *// + // someday, we'll combine /carbon and /human to /complex // let me believe....... diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index 2b73b38b1804..32d7e8a521be 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -1,3 +1,6 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2023 Citadel Station developers. *// + /mob/living/carbon/human/_slot_by_item(obj/item/I) if(wear_suit == I) return SLOT_ID_SUIT @@ -267,79 +270,3 @@ if(!slot_meta) return FALSE return !(slot_meta.inventory_slot_flags & INV_SLOT_IS_INVENTORY) || !species || (id in species.hud.gear) - -//! old stuff below - -/mob/living/carbon/human/verb/quick_equip() - set name = "quick-equip" - set hidden = 1 - - attempt_smart_equip() - -//! old behaviors that i can't be assed to rewrite for now - -/mob/living/carbon/human/proc/smart_equipbag() // take most recent item out of bag or place held item in bag - if(incapacitated()) - return - var/obj/item/thing = get_active_held_item() - var/obj/item/equipped_back = item_by_slot(SLOT_ID_BACK) - if(!equipped_back) // We also let you equip a backpack like this - if(!thing) - to_chat(src, "You have no backpack to take something out of!") - return - if(equip_to_slot_if_possible(thing, SLOT_ID_BACK)) - update_inv_hands() - return - if(!istype(equipped_back, /obj/item/storage)) // not a storage item - if(!thing) - equipped_back.attack_hand(src) - else - to_chat(src, "You can't fit anything in!") - return - if(thing) // put thing in backpack - var/obj/item/storage/S = equipped_back - if(!S.can_be_inserted(thing)) - to_chat(src, "You can't fit anything in!") - return - S.handle_item_insertion(thing, src) - return - if(!equipped_back.contents.len) // nothing to take out - to_chat(src, "There's nothing in your backpack to take out!") - return - var/obj/item/stored = equipped_back.contents[equipped_back.contents.len] - if(!stored || stored.on_found(src)) - return - stored.attack_hand(src) // take out thing from backpack - -/mob/living/carbon/human/proc/smart_equipbelt() // put held thing in belt or take most recent item out of belt - if(incapacitated()) - return - var/obj/item/thing = get_active_held_item() - var/obj/item/equipped_belt = item_by_slot(SLOT_ID_BELT) - if(!equipped_belt) // We also let you equip a belt like this - if(!thing) - to_chat(src, "You have no belt to take something out of!") - return - if(equip_to_slot_if_possible(thing, SLOT_ID_BELT)) - update_inv_hands() - return - if(!istype(equipped_belt, /obj/item/storage)) // not a storage item - if(!thing) - equipped_belt.attack_hand(src) - else - to_chat(src, "You can't fit anything in!") - return - if(thing) // put thing in belt - var/obj/item/storage/S = equipped_belt - if(!S.can_be_inserted(thing)) - to_chat(src, "You can't fit anything in!") - return - S.handle_item_insertion(thing, src) - return - if(!equipped_belt.contents.len) // nothing to take out - to_chat(src, "There's nothing in your belt to take out!") - return - var/obj/item/stored = equipped_belt.contents[equipped_belt.contents.len] - if(!stored || stored.on_found(src)) - return - stored.attack_hand(src) // take out thing from belt diff --git a/code/modules/mob/living/carbon/human/inventory_legacy.dm b/code/modules/mob/living/carbon/human/inventory_legacy.dm new file mode 100644 index 000000000000..60294ffee85f --- /dev/null +++ b/code/modules/mob/living/carbon/human/inventory_legacy.dm @@ -0,0 +1,75 @@ +//! old stuff below + +/mob/living/carbon/human/verb/quick_equip() + set name = "quick-equip" + set hidden = 1 + + attempt_smart_equip() + +//! old behaviors that i can't be assed to rewrite for now + +/mob/living/carbon/human/proc/smart_equipbag() // take most recent item out of bag or place held item in bag + if(incapacitated()) + return + var/obj/item/thing = get_active_held_item() + var/obj/item/equipped_back = item_by_slot(SLOT_ID_BACK) + if(!equipped_back) // We also let you equip a backpack like this + if(!thing) + to_chat(src, "You have no backpack to take something out of!") + return + if(equip_to_slot_if_possible(thing, SLOT_ID_BACK)) + update_inv_hands() + return + if(!istype(equipped_back, /obj/item/storage)) // not a storage item + if(!thing) + equipped_back.attack_hand(src) + else + to_chat(src, "You can't fit anything in!") + return + if(thing) // put thing in backpack + var/obj/item/storage/S = equipped_back + if(!S.can_be_inserted(thing)) + to_chat(src, "You can't fit anything in!") + return + S.handle_item_insertion(thing, src) + return + if(!equipped_back.contents.len) // nothing to take out + to_chat(src, "There's nothing in your backpack to take out!") + return + var/obj/item/stored = equipped_back.contents[equipped_back.contents.len] + if(!stored || stored.on_found(src)) + return + stored.attack_hand(src) // take out thing from backpack + +/mob/living/carbon/human/proc/smart_equipbelt() // put held thing in belt or take most recent item out of belt + if(incapacitated()) + return + var/obj/item/thing = get_active_held_item() + var/obj/item/equipped_belt = item_by_slot(SLOT_ID_BELT) + if(!equipped_belt) // We also let you equip a belt like this + if(!thing) + to_chat(src, "You have no belt to take something out of!") + return + if(equip_to_slot_if_possible(thing, SLOT_ID_BELT)) + update_inv_hands() + return + if(!istype(equipped_belt, /obj/item/storage)) // not a storage item + if(!thing) + equipped_belt.attack_hand(src) + else + to_chat(src, "You can't fit anything in!") + return + if(thing) // put thing in belt + var/obj/item/storage/S = equipped_belt + if(!S.can_be_inserted(thing)) + to_chat(src, "You can't fit anything in!") + return + S.handle_item_insertion(thing, src) + return + if(!equipped_belt.contents.len) // nothing to take out + to_chat(src, "There's nothing in your belt to take out!") + return + var/obj/item/stored = equipped_belt.contents[equipped_belt.contents.len] + if(!stored || stored.on_found(src)) + return + stored.attack_hand(src) // take out thing from belt diff --git a/code/modules/mob/living/carbon/inventory.dm b/code/modules/mob/living/carbon/inventory.dm index 43b12c87887a..09e17aa6b61a 100644 --- a/code/modules/mob/living/carbon/inventory.dm +++ b/code/modules/mob/living/carbon/inventory.dm @@ -1,3 +1,6 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2023 Citadel Station developers. *// + /mob/living/carbon/_slot_by_item(obj/item/I) if(handcuffed == I) return SLOT_ID_HANDCUFFED diff --git a/code/modules/mob/living/carbon/perspective.dm b/code/modules/mob/living/carbon/perspective.dm index d010e0257585..df90da7aebec 100644 --- a/code/modules/mob/living/carbon/perspective.dm +++ b/code/modules/mob/living/carbon/perspective.dm @@ -1,3 +1,6 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2023 Citadel Station developers. *// + //? Darksight /mob/living/carbon/innate_vision() diff --git a/code/modules/tgui/modals/tgui_dynamic_input.dm b/code/modules/tgui/modals/tgui_dynamic_input.dm index 1ae6099255cc..aa84fff36cb6 100644 --- a/code/modules/tgui/modals/tgui_dynamic_input.dm +++ b/code/modules/tgui/modals/tgui_dynamic_input.dm @@ -9,7 +9,7 @@ /// options list var/list/options -/datum/tgui_dyamic_query/proc/text(key, name, desc, max_length = 512, multi_line = FALSE, default) +/datum/tgui_dynamic_query/proc/text(key, name, desc, max_length = 512, multi_line = FALSE, default) RETURN_TYPE(/datum/tgui_dynamic_query) options += list( "key" = key, diff --git a/code/modules/tgui/module.dm b/code/modules/tgui/module.dm index 2f5ce0b17dda..309c79ee2bc3 100644 --- a/code/modules/tgui/module.dm +++ b/code/modules/tgui/module.dm @@ -1,6 +1,5 @@ -/** - *! SPDX-License-Identifier: MIT - */ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2023 Citadel Station developers. *// /** * new, more-modular tgui_module system diff --git a/code/modules/tgui/modules/general/cardmod.dm b/code/modules/tgui/modules/general/cardmod.dm index 6038b1d7c132..8159736558c7 100644 --- a/code/modules/tgui/modules/general/cardmod.dm +++ b/code/modules/tgui/modules/general/cardmod.dm @@ -1,3 +1,6 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2023 Citadel Station developers. *// + /** * ID mod module * diff --git a/code/modules/tgui/modules/specific/lathe_control.dm b/code/modules/tgui/modules/specific/lathe_control.dm index bee1c7cb14a0..11bac06b7df4 100644 --- a/code/modules/tgui/modules/specific/lathe_control.dm +++ b/code/modules/tgui/modules/specific/lathe_control.dm @@ -1,3 +1,6 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2023 Citadel Station developers. *// + /** * So why do we have discrete modules for lathe control? * From d1d093b29343c857c94b0ca479309a7cdc70683c Mon Sep 17 00:00:00 2001 From: silicons Date: Sun, 24 Sep 2023 17:43:00 -0700 Subject: [PATCH 30/62] regex --- code/game/gamemodes/technomancer/core_obj.dm | 2 +- code/game/gamemodes/technomancer/devices/boots_of_speed.dm | 2 +- code/game/objects/items.dm | 7 +++---- code/modules/clothing/suits/armor.dm | 4 ++-- code/modules/hardsuits/_rig.dm | 2 +- code/modules/hardsuits/modules/utility.dm | 4 ++-- code/modules/mob/living/inventory.dm | 2 +- code/modules/tgui/modals/tgui_dynamic_input.dm | 2 +- 8 files changed, 12 insertions(+), 13 deletions(-) diff --git a/code/game/gamemodes/technomancer/core_obj.dm b/code/game/gamemodes/technomancer/core_obj.dm index d9531533c97b..969012419559 100644 --- a/code/game/gamemodes/technomancer/core_obj.dm +++ b/code/game/gamemodes/technomancer/core_obj.dm @@ -248,7 +248,7 @@ energy = 7000 max_energy = 7000 regen_rate = 70 //100 seconds to full - hard_slowdown = -1 + slowdown = -1 instability_modifier = 0.9 cooldown_modifier = 0.9 diff --git a/code/game/gamemodes/technomancer/devices/boots_of_speed.dm b/code/game/gamemodes/technomancer/devices/boots_of_speed.dm index 990507999a4b..a000ae841c4f 100644 --- a/code/game/gamemodes/technomancer/devices/boots_of_speed.dm +++ b/code/game/gamemodes/technomancer/devices/boots_of_speed.dm @@ -11,7 +11,7 @@ icon_state = "swat" clothing_flags = NOSLIP siemens_coefficient = 0.6 - hard_slowdown = -1 + slowdown = -1 cold_protection = FEET min_cold_protection_temperature = SHOE_MIN_COLD_PROTECTION_TEMPERATURE diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 61ed734a417d..bb4591b74890 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -52,8 +52,7 @@ var/weight_registered /// Hard slowdown. Applied before carry weight. /// This affects multiplicative movespeed. - #warn regex to slowdown again - var/hard_slowdown = 0 + var/slowdown = 0 //? Combat /// Amount of damage we do on melee. @@ -819,9 +818,9 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. update_encumbrance() /obj/item/proc/set_slowdown(amount) - if(amount == hard_slowdown) + if(amount == slowdown) return - hard_slowdown = amount + slowdown = amount worn_mob()?.update_item_slowdown() /obj/item/proc/propagate_weight(old_weight, new_weight) diff --git a/code/modules/clothing/suits/armor.dm b/code/modules/clothing/suits/armor.dm index 57bc63918ce3..bdbf8e89f213 100644 --- a/code/modules/clothing/suits/armor.dm +++ b/code/modules/clothing/suits/armor.dm @@ -243,7 +243,7 @@ icon_state = "alien_speed" blood_overlay_type = "armor" item_state_slots = list(SLOT_ID_RIGHT_HAND = "armor", SLOT_ID_LEFT_HAND = "armor") - hard_slowdown = -1 + slowdown = -1 body_cover_flags = UPPER_TORSO|LOWER_TORSO armor_type = /datum/armor/alien/medium siemens_coefficient = 0.4 @@ -255,7 +255,7 @@ desc = "It's really resilient yet lightweight, so it's probably meant to be armor. Strangely enough it seems to have been designed for a humanoid shape." description_info = "It has a 40% chance to completely nullify an incoming attack." icon_state = "alien_tank" - hard_slowdown = 0 + slowdown = 0 body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS armor_type = /datum/armor/alien/heavy block_chance = 40 diff --git a/code/modules/hardsuits/_rig.dm b/code/modules/hardsuits/_rig.dm index a0a6aa664325..899a906810ee 100644 --- a/code/modules/hardsuits/_rig.dm +++ b/code/modules/hardsuits/_rig.dm @@ -583,7 +583,7 @@ if(istype(wearer) && !wearer.wearing_rig) wearer.wearing_rig = src set_encumbrance(isnull(online_encumbrance)? initial(encumbrance) : online_encumbrance) - hard_slowdown = initial(hard_slowdown) + sprint_slowdown_modifier + set_slowdown(initial(slowdown) + sprint_slowdown_modifier) if(cell && cell.charge > 0 && electrified > 0) electrified-- diff --git a/code/modules/hardsuits/modules/utility.dm b/code/modules/hardsuits/modules/utility.dm index 8649fbd1acb5..107fa2e5c84b 100644 --- a/code/modules/hardsuits/modules/utility.dm +++ b/code/modules/hardsuits/modules/utility.dm @@ -647,7 +647,7 @@ to_chat(H, "You activate the suit's sprint mode.") - holder.hard_slowdown -= sprint_speed + holder.set_slowdown(holder.slowdown - sprint_speed) holder.sprint_slowdown_modifier = -sprint_speed /obj/item/hardsuit_module/sprinter/deactivate() @@ -659,7 +659,7 @@ to_chat(H, "Your hardsuit returns to normal speed.") - holder.hard_slowdown += sprint_speed + holder.set_slowdown(holder.slowdown + sprint_speed) holder.sprint_slowdown_modifier = 0 /obj/item/hardsuit_module/device/hand_defib diff --git a/code/modules/mob/living/inventory.dm b/code/modules/mob/living/inventory.dm index 20ef01e7fba4..bab86c7f9046 100644 --- a/code/modules/mob/living/inventory.dm +++ b/code/modules/mob/living/inventory.dm @@ -310,4 +310,4 @@ /mob/living/proc/get_item_slowdown() . = 0 for(var/obj/item/I as anything in get_equipped_items()) - . += I.hard_slowdown + . += I.slowdown diff --git a/code/modules/tgui/modals/tgui_dynamic_input.dm b/code/modules/tgui/modals/tgui_dynamic_input.dm index aa84fff36cb6..ac8dea60b4aa 100644 --- a/code/modules/tgui/modals/tgui_dynamic_input.dm +++ b/code/modules/tgui/modals/tgui_dynamic_input.dm @@ -155,7 +155,7 @@ /// callback to invoke on finish var/datum/callback/callback -/datum/tgui_dynamic_input/New(mob/user, message, title, datum/tgui_dynaimc_query/query, timeout, datum/callback/callback) +/datum/tgui_dynamic_input/New(mob/user, message, title, datum/tgui_dynamic_query/query, timeout, datum/callback/callback) #warn impl /datum/tgui_dynamic_input/Destroy() From 9fbb682556fc1108b513fc5dd5f8e2998583ed46 Mon Sep 17 00:00:00 2001 From: silicons Date: Wed, 27 Sep 2023 01:46:22 -0700 Subject: [PATCH 31/62] queries --- code/__DEFINES/tgui.dm | 1 - code/modules/mob/physiology.dm | 66 +++++++++++++++-- .../modules/tgui/modals/tgui_dynamic_input.dm | 74 ++++++++++++------- .../interfaces/ui/UIDynamicInputModal.tsx | 8 +- 4 files changed, 114 insertions(+), 35 deletions(-) diff --git a/code/__DEFINES/tgui.dm b/code/__DEFINES/tgui.dm index 38bb2fdc69dc..a3eaf187df97 100644 --- a/code/__DEFINES/tgui.dm +++ b/code/__DEFINES/tgui.dm @@ -61,7 +61,6 @@ //* tgui dynamic input //* all constraints must be specified if it is included. -#define TGUI_INPUT_DATA_KEY "key" #define TGUI_INPUT_DATA_TYPE "type" #define TGUI_INPUT_DATA_DESC "desc" #define TGUI_INPUT_DATA_NAME "name" diff --git a/code/modules/mob/physiology.dm b/code/modules/mob/physiology.dm index fbbee5ef5282..199cb3498278 100644 --- a/code/modules/mob/physiology.dm +++ b/code/modules/mob/physiology.dm @@ -84,15 +84,33 @@ abstract_type = /datum/physiology_modifier /// our name - var/name + var/name = "Some Modifier" /// is this a globally cached modifier? var/is_globally_cached = FALSE // todo: on biologies update, we need to specify what biologies this applies to //? global modifiers - var/carry_strength_add - var/carry_factor_mult + var/carry_strength_add = 0 + var/carry_factor_mult = 1 + +/datum/physiology_modifier/serialize() + . = ..() + if(name != initial(name)) + .["name"] = name + if(carry_strength_add != initial(carry_strength_add)) + .["carry_strength_add"] = carry_strength_add + if(carry_factor_mult != initial(carry_factor_mult)) + .["carry_factor_mult"] = carry_factor_mult + +/datum/physiology_modifier/deserialize(list/data) + . = ..() + if(istext(data["name"])) + name = data["name"] + if(isnum(data["carry_strength_add"])) + carry_strength_add = data["carry_strength_add"] + if(isnum(data["carry_factor_mult"])) + carry_factor_mult = data["carry_factor_mult"] /** * subtype for hardcoded physiology modifiers @@ -104,6 +122,7 @@ * subtype for admin varedit tracking */ /datum/physiology_modifier/varedit + name = "Admin Varedits" GLOBAL_LIST_EMPTY(cached_physiology_modifiers) @@ -175,9 +194,46 @@ GLOBAL_LIST_EMPTY(cached_physiology_modifiers) /mob/vv_do_topic(list/href_list) . = ..() if(href_list[VV_HK_ADD_PHYSIOLOGY_MODIFIER]) - #warn impl + // todo: this should be able to be done globally via admin panel and then added to mobs + + var/datum/tgui_dynamic_query/query = new + query.text("name", "Name", "Name your modifier.", 64, FALSE, "Custom Modifier") + query.number("carry_strength_add", "Carry Strength - Add", "Modify the person's base carry strength", default = 0) + query.number("carry_factor_mult", "Carry Factor - Multiply", "Multiply the person's divisor for slowdown when carrying over their limit.", default = 1) + + var/list/choices = tgui_dynamic_input(usr, "Add a physiology modifier", "Add Physiology Modifier", query) + + if(isnull(choices)) + return + if(QDELETED(src)) + return + + var/datum/physiology_modifier/modifier = new + + // we manually deserialize because we might have custom datatypes + // in the future that won't be serialized by the ui necessarily in the same way + // we would serialize it via json. + + modifier.name = choices["name"] + modifier.carry_strength_add = choices["carry_strength_add"] + modifier.carry_factor_mult = choices["carry_factor_mult"] + + log_admin("[key_name(usr)] --> [key_name(src)] - added physiology modifier [json_encode(modifier.serialize())]") + add_physiology_modifier(modifier) + return TRUE + if(href_list[VV_HK_REMOVE_PHYSIOLOGY_MODIFIER]) - #warn impl + var/list/assembled = list() + var/i = 0 + for(var/datum/physiology_modifier/modifier as anything in physiology_modifiers) + assembled["[modifier.name] (#[++i])"] = modifier + var/picked = input(usr, "Which modifier to remove? Please do not do this unless you know what you are doing.", "Remove Physiology Modifier") as null|anything in assembled + var/datum/physiology_modifer/removing = assembled[picked] + if(!(removing in physiology_modifiers)) + return TRUE + log_admin("[key_name(usr)] --> [key_name(src)] - removed physiology modifier [json_encode(removing.serialize())]") + remove_physiology_modifier(removing) + return TRUE /mob/proc/get_varedit_physiology_modifier() RETURN_TYPE(/datum/physiology_modifier) diff --git a/code/modules/tgui/modals/tgui_dynamic_input.dm b/code/modules/tgui/modals/tgui_dynamic_input.dm index ac8dea60b4aa..4a7cdb279b9e 100644 --- a/code/modules/tgui/modals/tgui_dynamic_input.dm +++ b/code/modules/tgui/modals/tgui_dynamic_input.dm @@ -11,8 +11,7 @@ /datum/tgui_dynamic_query/proc/text(key, name, desc, max_length = 512, multi_line = FALSE, default) RETURN_TYPE(/datum/tgui_dynamic_query) - options += list( - "key" = key, + options[key] = list( "name" = name, "desc" = desc, "default" = default, @@ -23,8 +22,7 @@ /datum/tgui_dynamic_query/proc/number(key, name, desc, min_value = -INFINITY, max_value = INFINITY, round_to, default) RETURN_TYPE(/datum/tgui_dynamic_query) - options += list( - "key" = key, + options[key] = list( "name" = name, "desc" = desc, "default" = default, @@ -35,8 +33,7 @@ /datum/tgui_dynamic_query/proc/toggle(key, name, desc, default) RETURN_TYPE(/datum/tgui_dynamic_query) - options += list( - "key" = key, + options[key] = list( "name" = name, "desc" = desc, "default" = default, @@ -47,8 +44,7 @@ /datum/tgui_dynamic_query/proc/pick(key, name, desc, list/choices = list(), default) RETURN_TYPE(/datum/tgui_dynamic_query) - options += list( - "key" = key, + options[key] = list( "name" = name, "desc" = desc, "default" = default, @@ -63,34 +59,36 @@ /datum/tgui_dynamic_query/proc/get_results(list/choices) . = list() var/got - for(var/i in 1 to length(choices)) - var/list/params = options[i] + for(var/key in options) + var/list/params = options[key] + var/val = choices[key] switch(params[TGUI_INPUT_DATA_TYPE]) if(TGUI_INPUT_DATATYPE_TEXT) - got = isnull(choices[i]) ? params[TGUI_INPUT_DATA_DEFAULT] : choices[i] + got = isnull(val) ? params[TGUI_INPUT_DATA_DEFAULT] : val if(!isnull(got)) if(length(got) > params[TGUI_INPUT_DATA_CONSTRAINTS][1]) got = copytext_char(got, 1, params[TGUI_INPUT_DATA_CONSTRAINTS][1] + 1) - . += got + .[key] = got if(TGUI_INPUT_DATATYPE_NUM) - got = isnull(choices[i]) ? params[TGUI_INPUT_DATA_DEFAULT] : text2num(choices[i]) + got = isnull(val) ? params[TGUI_INPUT_DATA_DEFAULT] : text2num(val) if(!isnull(got)) got = clamp(got, params[TGUI_INPUT_DATA_CONSTRAINTS][1], params[TGUI_INPUT_DATA_CONSTRAINTS][2]) got = round(got, params[TGUI_INPUT_DATA_CONSTRAINTS][3]) + .[key] = got if(TGUI_INPUT_DATATYPE_LIST_PICK) - got = isnull(choices[i]) ? params[TGUI_INPUT_DATA_DEFAULT] : choices[i] + got = isnull(val) ? params[TGUI_INPUT_DATA_DEFAULT] : val if(!isnull(got)) if(!(got in params[TGUI_INPUT_DATA_CONSTRAINTS])) if(length(params[TGUI_INPUT_DATA_CONSTRAINTS])) got = params[TGUI_INPUT_DATA_CONSTRAINTS][1] else got = null - . += got + .[key] = got if(TGUI_INPUT_DATATYPE_TOGGLE) - got = isnull(choices[i]) ? params[TGUI_INPUT_DATA_DEFAULT] : choices[i] + got = isnull(val) ? params[TGUI_INPUT_DATA_DEFAULT] : val if(!isnull(got)) got = !!got - . += got + .[key] = got /** * returns list to be sent to UI @@ -154,23 +152,40 @@ var/closed /// callback to invoke on finish var/datum/callback/callback + /// are we finished? set to true on close, here to prevent double close. + var/finished = FALSE /datum/tgui_dynamic_input/New(mob/user, message, title, datum/tgui_dynamic_query/query, timeout, datum/callback/callback) - #warn impl + src.title = title + src.message = message + src.query = query + src.timeout = timeout + if(timeout) + QDEL_IN(src, timeout) + src.callback = callback + ui_interact(user) /datum/tgui_dynamic_input/Destroy() + // 'choices' intentionally kept query = null - choices = null + if(!finished) + finish(null) closed = TRUE return ..() /datum/tgui_dynamic_input/ui_static_data(mob/user, datum/tgui/ui, datum/ui_state/state) . = ..() - #warn impl + .["query"] = query.get_query() + .["title"] = title + .["message"] = message + .["timeout"] = timeout /datum/tgui_dynamic_input/ui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui) - . = ..() - #warn impl + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + ui = new(user, src, "UIDynamicInputModal") + ui.set_autoupdate(FALSE) + ui.open() /datum/tgui_dynamic_input/ui_act(action, list/params, datum/tgui/ui) . = ..() @@ -178,17 +193,24 @@ return switch(action) if("submit") - #warn impl + finish(params["choices"]) + return TRUE if("cancel") closed = TRUE SStgui.close_uis(src) + if(!finished) + finish(null) return TRUE /datum/tgui_dynamic_input/proc/block_on_finished() - #warn impl + UNTIL(closed) + return choices /datum/tgui_dynamic_input/proc/finish(list/choices) + finished = TRUE + choices = query.get_results(choices) callback?.InvokeAsync(choices) + if(!QDESTROYING(src)) + qdel(src) -/datum/tgui_dynamic_input/proc/sanitize(list/choices) - #warn impl +#warn finish ui diff --git a/tgui/packages/tgui/interfaces/ui/UIDynamicInputModal.tsx b/tgui/packages/tgui/interfaces/ui/UIDynamicInputModal.tsx index a387f6c407e5..19017aaf460a 100644 --- a/tgui/packages/tgui/interfaces/ui/UIDynamicInputModal.tsx +++ b/tgui/packages/tgui/interfaces/ui/UIDynamicInputModal.tsx @@ -1,11 +1,12 @@ interface UIDynamicInputContext { - query: UIDynamicInputEntry[]; + // key to entry data + query: Record; } interface UIDynamicInputEntry { - key: string; name: string; + desc: string; } interface StringEntry extends UIDynamicInputEntry { @@ -39,7 +40,7 @@ type UIDynamicInputConstraint = StringConstraint | NumberConstraint | ListConstr type StringConstraint = [number] | undefined; type NumberConstraint = [number, number, number] | undefined; -type ListConstraint = string[]; +type ListConstraint = string[] | undefined; type ToggleConstraint = [] | undefined; export const UIDynamicInputModal = (props, context) => { @@ -48,6 +49,7 @@ export const UIDynamicInputModal = (props, context) => { interface DynamicEntryProps { entry: UIDynamicInputEntry; + id: string; } const DynamicEntry = (props: DynamicEntryProps, context) => { From b5fb7948fe99b0ac4bede0663bbe9457cebbe8ae Mon Sep 17 00:00:00 2001 From: silicons Date: Thu, 28 Sep 2023 19:56:56 -0700 Subject: [PATCH 32/62] a --- code/modules/mob/physiology.dm | 2 +- tgui/packages/tgui/interfaces/ui/UIDynamicInputModal.tsx | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/physiology.dm b/code/modules/mob/physiology.dm index 199cb3498278..0809514e37a3 100644 --- a/code/modules/mob/physiology.dm +++ b/code/modules/mob/physiology.dm @@ -228,7 +228,7 @@ GLOBAL_LIST_EMPTY(cached_physiology_modifiers) for(var/datum/physiology_modifier/modifier as anything in physiology_modifiers) assembled["[modifier.name] (#[++i])"] = modifier var/picked = input(usr, "Which modifier to remove? Please do not do this unless you know what you are doing.", "Remove Physiology Modifier") as null|anything in assembled - var/datum/physiology_modifer/removing = assembled[picked] + var/datum/physiology_modifier/removing = assembled[picked] if(!(removing in physiology_modifiers)) return TRUE log_admin("[key_name(usr)] --> [key_name(src)] - removed physiology modifier [json_encode(removing.serialize())]") diff --git a/tgui/packages/tgui/interfaces/ui/UIDynamicInputModal.tsx b/tgui/packages/tgui/interfaces/ui/UIDynamicInputModal.tsx index 19017aaf460a..28941ceef1a4 100644 --- a/tgui/packages/tgui/interfaces/ui/UIDynamicInputModal.tsx +++ b/tgui/packages/tgui/interfaces/ui/UIDynamicInputModal.tsx @@ -1,5 +1,8 @@ interface UIDynamicInputContext { + title: string; + message: string; + timeout: number; // key to entry data query: Record; } From a86b576a723a25f57c93054cb5ba37491750ec7b Mon Sep 17 00:00:00 2001 From: silicons Date: Fri, 29 Sep 2023 01:14:32 -0700 Subject: [PATCH 33/62] a --- citadel.dme | 18 +++---- code/game/rendering/legacy/alert.dm | 70 +++++++++++++++++++++------- icons/screen/alerts/backgrounds.dmi | Bin 0 -> 765 bytes icons/screen/alerts/encumbered.dmi | Bin 0 -> 683 bytes 4 files changed, 62 insertions(+), 26 deletions(-) create mode 100644 icons/screen/alerts/backgrounds.dmi create mode 100644 icons/screen/alerts/encumbered.dmi diff --git a/citadel.dme b/citadel.dme index 7cfe9ef9e384..e335347c9a95 100644 --- a/citadel.dme +++ b/citadel.dme @@ -4852,15 +4852,15 @@ #include "interface\skin.dmf" #include "interface\menus\_menus.dm" #include "interface\menus\main.dm" -#include "maps\generic\death_triggers.dm" -#include "maps\generic\map_data.dm" -#include "maps\generic\misc.dm" -#include "maps\generic\spawn_points.dm" -#include "maps\generic\step_triggers.dm" -#include "maps\generic\telecomms.dm" -#include "maps\generic\turbolifts.dm" -#include "maps\generic\shuttles\ferry\belter.dm" -#include "maps\generic\shuttles\ferry\escape.dm" +#include "maps\Generic\death_triggers.dm" +#include "maps\Generic\map_data.dm" +#include "maps\Generic\misc.dm" +#include "maps\Generic\spawn_points.dm" +#include "maps\Generic\step_triggers.dm" +#include "maps\Generic\telecomms.dm" +#include "maps\Generic\turbolifts.dm" +#include "maps\Generic\shuttles\ferry\belter.dm" +#include "maps\Generic\shuttles\ferry\escape.dm" #include "maps\minitest\minitest.dm" #include "maps\minitest\sectors.dm" #include "maps\minitest\shuttles.dm" diff --git a/code/game/rendering/legacy/alert.dm b/code/game/rendering/legacy/alert.dm index 70753c7d6293..7bd3c2e204a6 100644 --- a/code/game/rendering/legacy/alert.dm +++ b/code/game/rendering/legacy/alert.dm @@ -1,6 +1,23 @@ //A system to manage and display alerts on screen without needing you to do it yourself -//PUBLIC - call these wherever you want +/mob/var/list/alerts = list() // contains /atom/movable/screen/alert only // On /mob so clientless mobs will throw alerts properly + +/atom/movable/screen/alert/Click(location, control, params) + if(!usr || !usr.client) + return + var/paramslist = params2list(params) + if(paramslist["shift"]) // screen objects don't do the normal Click() stuff so we'll cheat + to_chat(usr,"[name] - [desc]") + return + if(master) + return usr.client.Click(master, location, control, params) + +/atom/movable/screen/alert/Destroy() + ..() + severity = 0 + master = null + screen_loc = "" + return QDEL_HINT_QUEUE /mob/proc/throw_alert(category, type, severity, obj/new_master) @@ -80,6 +97,10 @@ name = "Alert" desc = "Something seems to have gone wrong with this alert, so report this bug please" mouse_opacity = 1 + /// background to render + var/icon/background_icon = 'icons/screen/alerts/backgrounds.dmi' + /// background state to render; null to not render + var/background_state var/timeout = 0 //If set to a number, this alert will clear itself after that many deciseconds var/severity = 0 var/alerttooltipstyle = "" @@ -87,6 +108,16 @@ /// mob that owns us var/mob/owner +/atom/movable/screen/alert/Initialize(mapload) + . = ..() + update_icon() + +/atom/movable/screen/alert/update_icon(updates) + . = ..() + underlays.len = 0 + if(background_icon && background_state) + underlays += image(background_icon, background_state) + /atom/movable/screen/alert/Destroy() owner = null return ..() @@ -480,21 +511,26 @@ so as to remain in compliance with the most up-to-date laws." mymob?.client?.screen |= alert return 1 -/mob/var/list/alerts = list() // contains /atom/movable/screen/alert only // On /mob so clientless mobs will throw alerts properly +//? Encumbrance -/atom/movable/screen/alert/Click(location, control, params) - if(!usr || !usr.client) - return - var/paramslist = params2list(params) - if(paramslist["shift"]) // screen objects don't do the normal Click() stuff so we'll cheat - to_chat(usr,"[name] - [desc]") - return - if(master) - return usr.client.Click(master, location, control, params) +/atom/movable/screen/alert/encumbered + abstract_type = /atom/movable/screen/alert/encumbered + icon = 'icons/screen/alerts/encumbered.dmi' + background_state = "default" + desc = "Carrying more than you can comfortably bear. Movement slowed." -/atom/movable/screen/alert/Destroy() - ..() - severity = 0 - master = null - screen_loc = "" - return QDEL_HINT_QUEUE +/atom/movable/screen/alert/encumbered/minor + name = "Lightly Encumbered" + icon_state = "1" + +/atom/movable/screen/alert/encumbered/moderate + name = "Moderately Encumbered" + icon_state = "2" + +/atom/movable/screen/alert/encumbered/severe + name = "Severely Encumbered" + icon_state = "3" + +/atom/movable/screen/alert/encumbered/extreme + name = "Extremely Encumbered" + icon_state = "4" diff --git a/icons/screen/alerts/backgrounds.dmi b/icons/screen/alerts/backgrounds.dmi new file mode 100644 index 0000000000000000000000000000000000000000..2c328fea468e9441dd34a0639fe69c376e2a8681 GIT binary patch literal 765 zcmVV=-0C=2JR&a84_w-Y6@%7{?OD!tS%+FJ>RWQ*r;NmRLOex7wuvIWN;^NFm z%}mcIfpCgT5=&AQY!#GBQj;?bmAE)lGK-28Y!wW-IMa#}b5kK~xT=)Yw8YY!5?tz( z6C+54`RFM;zAgfTXk;^m@DBgz*I0Oz5T z27kHiP2c#ClY>%x5Clfa8DsEDjU~suEygJn3OG9YG5zQov)OE^PbuA+e>8e>I1e2e zgj{q|im%mbYD@@$!CJScy9OPnH3vN0oxzKFIWYwtXO;tY zVHdE8%mJALG6&dk!0|~3Ksp~oBy^nC9H2XznudXxh=y}-9k41s4ttpcr1)(DV9f!hj>Eq1FA4AW`>L(ubX^y~`gi}N zAjQWzfH9V6VMLek;%Wi_aC`gLi7SkJCMcTfFDZ*Bkpc$`yKaB_9`^iy#0_2eo`Eh^5;&r`5fFwryM;w;ZhDainGjE%TB zGg33tGfE(w;*!LYR3KByP>G8(C9|j)$TsBSOe;#vO@*-GDvSxLFe0eJ1eXeB1y?^8 zu)_iO9Wt-^Ysbj|00F;AL_t(YiS3jzZtE}%hQk|JL}MhQSVw+ct6ad2E>Hu0ovp#p z9H0kqfoiXpLbt6F)RtV->eAr>ee^`>Gk=;Ux!L??V=PPF!|kz35-6ptlE6vIBm1Np zE40N)9&sT8o5%(IMC!!(B0vVg$t|@FJ;WhER#|X&#^|!`Vqp8&MnG<@eHH^m8u^P2 zS%SG*7XxT?2mn0^A0vwaCU~U4RsF}91pq9n19oLm3!C9uwUN6~)%`jEgzn5a@RfTH zaCF$M2Jjlh8S&KsJ_M3SQVjv$b<}_RF0~r%fGL~$@bK{hxL2d!M$?7S0&B~*83JGjH`;wQ1Ae1;$!U~;Sl_c(|c002ovPDHLkV1m`1B`p8| literal 0 HcmV?d00001 From 80d060c89693682695b1024339f34ec9eb66a3a8 Mon Sep 17 00:00:00 2001 From: silicons Date: Fri, 29 Sep 2023 01:17:57 -0700 Subject: [PATCH 34/62] fix --- code/modules/mob/living/inventory.dm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/living/inventory.dm b/code/modules/mob/living/inventory.dm index bab86c7f9046..b6c4beb9b1fe 100644 --- a/code/modules/mob/living/inventory.dm +++ b/code/modules/mob/living/inventory.dm @@ -292,7 +292,17 @@ /mob/living/proc/update_carry() var/slowdown = max(carry_weight_to_slowdown(cached_carry_weight), carry_encumbrance_to_slowdown(cached_carry_encumbrance)) - #warn throw alert + switch(round(slowdown * 100)) + if(0 to 25) + throw_alert("encumbered", /atom/movable/screen/alert/encumbered/minor) + if(26 to 50) + throw_alert("encumbered", /atom/movable/screen/alert/encumbered/moderate) + if(51 to 150) + throw_alert("encumbered", /atom/movable/screen/alert/encumbered/severe) + if(151 to INFINITY) + throw_alert("encumbered", /atom/movable/screen/alert/encumbered/extreme) + else + clear_alert("encumbered") if(slowdown) add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/mob_inventory_carry, multiplicative_slowdown = slowdown) else From 5666400ff305ab1c8a894c3398f07f4f91c4573b Mon Sep 17 00:00:00 2001 From: silicons Date: Fri, 29 Sep 2023 14:05:16 -0700 Subject: [PATCH 35/62] reserved words --- code/modules/mob/physiology.dm | 2 +- code/modules/tgui/modals/tgui_dynamic_input.dm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/modules/mob/physiology.dm b/code/modules/mob/physiology.dm index 0809514e37a3..dde5592f5a80 100644 --- a/code/modules/mob/physiology.dm +++ b/code/modules/mob/physiology.dm @@ -197,7 +197,7 @@ GLOBAL_LIST_EMPTY(cached_physiology_modifiers) // todo: this should be able to be done globally via admin panel and then added to mobs var/datum/tgui_dynamic_query/query = new - query.text("name", "Name", "Name your modifier.", 64, FALSE, "Custom Modifier") + query.string("name", "Name", "Name your modifier.", 64, FALSE, "Custom Modifier") query.number("carry_strength_add", "Carry Strength - Add", "Modify the person's base carry strength", default = 0) query.number("carry_factor_mult", "Carry Factor - Multiply", "Multiply the person's divisor for slowdown when carrying over their limit.", default = 1) diff --git a/code/modules/tgui/modals/tgui_dynamic_input.dm b/code/modules/tgui/modals/tgui_dynamic_input.dm index 4a7cdb279b9e..9053f3dd4c0e 100644 --- a/code/modules/tgui/modals/tgui_dynamic_input.dm +++ b/code/modules/tgui/modals/tgui_dynamic_input.dm @@ -9,7 +9,7 @@ /// options list var/list/options -/datum/tgui_dynamic_query/proc/text(key, name, desc, max_length = 512, multi_line = FALSE, default) +/datum/tgui_dynamic_query/proc/string(key, name, desc, max_length = 512, multi_line = FALSE, default) RETURN_TYPE(/datum/tgui_dynamic_query) options[key] = list( "name" = name, @@ -42,7 +42,7 @@ ) return src -/datum/tgui_dynamic_query/proc/pick(key, name, desc, list/choices = list(), default) +/datum/tgui_dynamic_query/proc/pick_one(key, name, desc, list/choices = list(), default) RETURN_TYPE(/datum/tgui_dynamic_query) options[key] = list( "name" = name, From e89424939a28eeffbd68088116e255561c191a11 Mon Sep 17 00:00:00 2001 From: silicons Date: Sun, 1 Oct 2023 16:11:44 -0700 Subject: [PATCH 36/62] Fix --- code/modules/mob/living/inventory.dm | 2 +- code/modules/mob/physiology.dm | 4 ++-- code/modules/species/species.dm | 6 ++++-- code/modules/tgui/modals/tgui_dynamic_input.dm | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/code/modules/mob/living/inventory.dm b/code/modules/mob/living/inventory.dm index b6c4beb9b1fe..bc1b9fe368b4 100644 --- a/code/modules/mob/living/inventory.dm +++ b/code/modules/mob/living/inventory.dm @@ -293,7 +293,7 @@ /mob/living/proc/update_carry() var/slowdown = max(carry_weight_to_slowdown(cached_carry_weight), carry_encumbrance_to_slowdown(cached_carry_encumbrance)) switch(round(slowdown * 100)) - if(0 to 25) + if(1 to 25) throw_alert("encumbered", /atom/movable/screen/alert/encumbered/minor) if(26 to 50) throw_alert("encumbered", /atom/movable/screen/alert/encumbered/moderate) diff --git a/code/modules/mob/physiology.dm b/code/modules/mob/physiology.dm index dde5592f5a80..3596212ae0d9 100644 --- a/code/modules/mob/physiology.dm +++ b/code/modules/mob/physiology.dm @@ -188,8 +188,8 @@ GLOBAL_LIST_EMPTY(cached_physiology_modifiers) /mob/vv_get_dropdown() . = ..() VV_DROPDOWN_OPTION(null, "-----") - VV_DROPDOWN_OPTION(VV_HK_ADD_PHYSIOLOGY_MODIFIER, "Add PHysiology Modifier") - VV_DROPDOWN_OPTION(VV_HK_REMOVE_PHYSIOLOGY_MODIFIER, "Remove PHysiology Modifier") + VV_DROPDOWN_OPTION(VV_HK_ADD_PHYSIOLOGY_MODIFIER, "Add Physiology Modifier") + VV_DROPDOWN_OPTION(VV_HK_REMOVE_PHYSIOLOGY_MODIFIER, "Remove Physiology Modifier") /mob/vv_do_topic(list/href_list) . = ..() diff --git a/code/modules/species/species.dm b/code/modules/species/species.dm index 989914b3e08a..549e5ef765c2 100644 --- a/code/modules/species/species.dm +++ b/code/modules/species/species.dm @@ -528,7 +528,8 @@ H.maxHealth = total_health - H.add_physiology_modifier(mob_physiology_modifier) + if(!isnull(mob_physiology_modifier)) + H.add_physiology_modifier(mob_physiology_modifier) add_inherent_verbs(H) @@ -556,7 +557,8 @@ remove_inherent_verbs(H) H.holder_type = null - H.remove_physiology_modifier(mob_physiology_modifier) + if(!isnull(mob_physiology_modifier)) + H.remove_physiology_modifier(mob_physiology_modifier) for(var/name in traits) var/datum/trait/T = all_traits[name] diff --git a/code/modules/tgui/modals/tgui_dynamic_input.dm b/code/modules/tgui/modals/tgui_dynamic_input.dm index 9053f3dd4c0e..ebecd3263278 100644 --- a/code/modules/tgui/modals/tgui_dynamic_input.dm +++ b/code/modules/tgui/modals/tgui_dynamic_input.dm @@ -7,7 +7,7 @@ */ /datum/tgui_dynamic_query /// options list - var/list/options + var/list/options = list() /datum/tgui_dynamic_query/proc/string(key, name, desc, max_length = 512, multi_line = FALSE, default) RETURN_TYPE(/datum/tgui_dynamic_query) From 7376c7be51a3536e75faecbbbd1ba5eefa933a62 Mon Sep 17 00:00:00 2001 From: silicons Date: Sun, 1 Oct 2023 18:27:42 -0700 Subject: [PATCH 37/62] js --- .../modules/tgui/modals/tgui_dynamic_input.dm | 3 + .../interfaces/ui/UIDynamicInputModal.tsx | 153 ++++++++++++++++-- 2 files changed, 143 insertions(+), 13 deletions(-) diff --git a/code/modules/tgui/modals/tgui_dynamic_input.dm b/code/modules/tgui/modals/tgui_dynamic_input.dm index ebecd3263278..ae5b36945b68 100644 --- a/code/modules/tgui/modals/tgui_dynamic_input.dm +++ b/code/modules/tgui/modals/tgui_dynamic_input.dm @@ -202,6 +202,9 @@ finish(null) return TRUE +/datum/tgui_dynamic_input/ui_state(mob/user, datum/tgui_module/module) + return GLOB.always_state + /datum/tgui_dynamic_input/proc/block_on_finished() UNTIL(closed) return choices diff --git a/tgui/packages/tgui/interfaces/ui/UIDynamicInputModal.tsx b/tgui/packages/tgui/interfaces/ui/UIDynamicInputModal.tsx index 28941ceef1a4..cade00446a0b 100644 --- a/tgui/packages/tgui/interfaces/ui/UIDynamicInputModal.tsx +++ b/tgui/packages/tgui/interfaces/ui/UIDynamicInputModal.tsx @@ -1,3 +1,7 @@ +import { BooleanLike } from "common/react"; +import { useBackend, useLocalState } from "../../backend"; +import { Box, Button, Section, Stack, Tooltip } from "../../components"; +import { Window } from "../../layouts"; interface UIDynamicInputContext { title: string; @@ -7,29 +11,35 @@ interface UIDynamicInputContext { query: Record; } -interface UIDynamicInputEntry { +type UIDynamicInputEntry = StringEntry | NumberEntry | PickEntry | ToggleEntry; + +interface BaseEntry { name: string; desc: string; } -interface StringEntry extends UIDynamicInputEntry { +interface StringEntry extends BaseEntry { type: UIDynamicInputType.String; constraints: StringConstraint; + default: StringOption; } -interface NumberEntry extends UIDynamicInputEntry { +interface NumberEntry extends BaseEntry { type: UIDynamicInputType.Number; constraints: NumberConstraint; + default: NumberOption; } -interface PickEntry extends UIDynamicInputEntry { +interface PickEntry extends BaseEntry { type: UIDynamicInputType.ListSingle; - constraints: NumberConstraint; + constraints: ListConstraint; + default: ListOption; } -interface ToggleEntry extends UIDynamicInputEntry { +interface ToggleEntry extends BaseEntry { type: UIDynamicInputType.Toggle; - constraints: NumberConstraint; + constraints: ToggleConstraint; + default: ToggleOption; } enum UIDynamicInputType { @@ -46,33 +56,150 @@ type NumberConstraint = [number, number, number] | undefined; type ListConstraint = string[] | undefined; type ToggleConstraint = [] | undefined; +type UIDynamicInputOption = StringOption | NumberOption | ListOption | ToggleOption; + +type StringOption = string | null | undefined; +type NumberOption = number | null | undefined; +type ListOption = string | null | undefined; +type ToggleOption = BooleanLike; + export const UIDynamicInputModal = (props, context) => { + const { data, act } = useBackend(context); + const [options, setOptions] =useLocalState>(context, 'options', {}); + return ( + + + + +
+ {data.message} +
+
+ +
+ + {Object.entries(data.query).map(([key, entry]) => ( + + + + {`${entry.name} `} + +
+
+ +
+ + + act('submit', { choices: preprocessOptions(options, data.query) })} /> + + + act('cancel')} /> + + +
+
+
+
+
+ ); +}; +const preprocessOptions = (picked: Record, query: Record) => { + let built = {}; + return built; }; interface DynamicEntryProps { - entry: UIDynamicInputEntry; id: string; + entry: UIDynamicInputEntry; + current: UIDynamicInputOption; + pick: (val: any) => void; } const DynamicEntry = (props: DynamicEntryProps, context) => { - + switch (props.entry.type) { + case UIDynamicInputType.ListSingle: + return ( + + ); + case UIDynamicInputType.Number: + return ( + + ); + case UIDynamicInputType.String: + return ( + + ); + case UIDynamicInputType.Toggle: + return ( + + ); + } }; -const DynamicEntryNumber = (props, context) => { +interface DynamicEntryNumberProps extends DynamicEntryProps { + entry: NumberEntry; + current: NumberOption; +} +const DynamicEntryNumber = (props: DynamicEntryNumberProps, context) => { + return ( + + Test + + ); }; -const DynamicEntryString = (props, context) => { +interface DynamicEntryStringProps extends DynamicEntryProps { + entry: StringEntry; + current: StringOption; +} +const DynamicEntryString = (props: DynamicEntryStringProps, context) => { + return ( + + Test + + ); }; -const DynamicEntryPick = (props, context) => { +interface DynamicEntryPickProps extends DynamicEntryProps { + entry: PickEntry; + current: ListOption; +} +const DynamicEntryPick = (props: DynamicEntryPickProps, context) => { + return ( + + Test + + ); }; -const DynamicEntryToggle = (props, context) => { +interface DynamicEntryToggleProps extends DynamicEntryProps { + entry: ToggleEntry; + current: ToggleOption; +} +const DynamicEntryToggle = (props: DynamicEntryToggleProps, context) => { + return ( + + Test + + ); }; From 5881f2ef425545cb31965846ded22117ed7e4bd8 Mon Sep 17 00:00:00 2001 From: silicons Date: Sun, 1 Oct 2023 20:37:39 -0700 Subject: [PATCH 38/62] js --- .../interfaces/ui/UIDynamicInputModal.tsx | 75 +++++++++++++------ 1 file changed, 51 insertions(+), 24 deletions(-) diff --git a/tgui/packages/tgui/interfaces/ui/UIDynamicInputModal.tsx b/tgui/packages/tgui/interfaces/ui/UIDynamicInputModal.tsx index cade00446a0b..bc828b87410e 100644 --- a/tgui/packages/tgui/interfaces/ui/UIDynamicInputModal.tsx +++ b/tgui/packages/tgui/interfaces/ui/UIDynamicInputModal.tsx @@ -1,6 +1,7 @@ +import { round } from "common/math"; import { BooleanLike } from "common/react"; import { useBackend, useLocalState } from "../../backend"; -import { Box, Button, Section, Stack, Tooltip } from "../../components"; +import { Button, Dropdown, Input, NumberInput, Section, Stack, Tooltip } from "../../components"; import { Window } from "../../layouts"; interface UIDynamicInputContext { @@ -51,10 +52,10 @@ enum UIDynamicInputType { type UIDynamicInputConstraint = StringConstraint | NumberConstraint | ListConstraint | ToggleConstraint; -type StringConstraint = [number] | undefined; -type NumberConstraint = [number, number, number] | undefined; -type ListConstraint = string[] | undefined; -type ToggleConstraint = [] | undefined; +type StringConstraint = [number]; +type NumberConstraint = [number, number, number | null]; +type ListConstraint = string[]; +type ToggleConstraint = []; type UIDynamicInputOption = StringOption | NumberOption | ListOption | ToggleOption; @@ -81,15 +82,31 @@ export const UIDynamicInputModal = (props, context) => { {Object.entries(data.query).map(([key, entry]) => ( - - {`${entry.name} `} - -