Skip to content

Commit

Permalink
Merge pull request #47 from SPLURT-Station/sizecode
Browse files Browse the repository at this point in the history
[Bounty] Ports sizecode from my codebase
  • Loading branch information
MosleyTheMalO authored Nov 3, 2024
2 parents a8d06a2 + 3ab6cf3 commit e25184c
Show file tree
Hide file tree
Showing 38 changed files with 1,111 additions and 16 deletions.
9 changes: 9 additions & 0 deletions code/__DEFINES/~~~splurt_defines/DNA.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
///Upstream edits
//Sizecode
#undef BODY_SIZE_MAX
#undef BODY_SIZE_MIN

#define BODY_SIZE_MAX CONFIG_GET(number/body_size_max)
#define BODY_SIZE_MIN CONFIG_GET(number/body_size_min)


///arachnid organ slots
#define ORGAN_SLOT_EXTERNAL_MANDIBLES "mandibles"
#define ORGAN_SLOT_EXTERNAL_SPINNERET "spinneret"
Expand Down
13 changes: 13 additions & 0 deletions code/__DEFINES/~~~splurt_defines/dcs/signals.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* # COMSIG_MICRO_PICKUP_FEET
* From /datum/element/mob_holder/micro
* Used by signals for determining whether you can pick up someone with your feet, kinky.
*/
#define COMSIG_MICRO_PICKUP_FEET "micro_force_grabbed"

/*
* # COMSIG_MOB_RESIZED
* From /mob/living
* Used by signals for whenever a mob has changed sizes.
*/
#define COMSIG_MOB_RESIZED "mob_resized"
46 changes: 46 additions & 0 deletions code/__DEFINES/~~~splurt_defines/sizecode.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//I am not a coder. Please fucking tear apart my code, and insult me for how awful I am at coding. Please and thank you. -Dahlular
//alright bet -BoxBoy
#define RESIZE_MACRO 6
#define RESIZE_HUGE 4
#define RESIZE_BIG 2
#define RESIZE_NORMAL 1
#define RESIZE_SMALL 0.75
#define RESIZE_TINY 0.50
#define RESIZE_MICRO 0.25

//averages
#define RESIZE_A_MACROHUGE (RESIZE_MACRO + RESIZE_HUGE) / 2
#define RESIZE_A_HUGEBIG (RESIZE_HUGE + RESIZE_BIG) / 2
#define RESIZE_A_BIGNORMAL (RESIZE_BIG + RESIZE_NORMAL) / 2
#define RESIZE_A_NORMALSMALL (RESIZE_NORMAL + RESIZE_SMALL) / 2
#define RESIZE_A_SMALLTINY (RESIZE_SMALL + RESIZE_TINY) / 2
#define RESIZE_A_TINYMICRO (RESIZE_TINY + RESIZE_MICRO) / 2

/*
* # get_size(mob/living/target)
* Grabs the size of your critter, works for any living creature even carbons with dna
* Now, please don't tell me your creature has a dna but it's very snowflakey, then i say you should rewrite your mob
* instead of touching this file.
*/
/proc/get_size(mob/living/target)
if(!target)
CRASH("get_size(NULL) was called")
if(!istype(target))
CRASH("get_size() called with an invalid target, only use this for /mob/living!")
var/datum/dna/has_dna = target.has_dna()
if(ishuman(target) && has_dna)
return has_dna.features["body_size"]
else
return target.size_multiplier

/*
* # COMPARE_SIZES(mob/living/user, mob/living/target)
* Returns how bigger or smaller the target is in comparison to user
* Example:
* - user = 2, target = 1, result = 0.5
* - user = 1, target = 2, result = 2
* Args:
* - user = /mob/living
* - target = /mob/living
*/
#define COMPARE_SIZES(user, target) abs((get_size(user) / get_size(target)))
2 changes: 1 addition & 1 deletion code/datums/dna.dm
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ GLOBAL_LIST_INIT(total_uf_len_by_block, populate_total_uf_len_by_block())
//SKYRAT EDIT ADDITION BEGIN - CUSTOMIZATION
destination.dna.mutant_bodyparts = mutant_bodyparts.Copy()
destination.dna.body_markings = body_markings.Copy()
destination.dna.update_body_size()
// destination.dna.update_body_size() //SPLURT EDIT
//SKYRAT EDIT ADDITION END
if(transfer_SE)
destination.dna.mutation_index = mutation_index
Expand Down
2 changes: 1 addition & 1 deletion code/datums/mutations/body.dm
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
return
// SKYRAT EDIT END
ADD_TRAIT(owner, TRAIT_GIANT, GENETIC_MUTATION)
owner.update_transform(1.25)
// owner.update_transform(1.25) //SPLURT EDIT
owner.visible_message(span_danger("[owner] suddenly grows!"), span_notice("Everything around you seems to shrink.."))

/datum/mutation/human/gigantism/on_losing(mob/living/carbon/human/owner)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
animal.health = min(animal.maxHealth, animal.health * 1.5)
animal.melee_damage_lower = max((animal.melee_damage_lower * 2), 10)
animal.melee_damage_upper = max((animal.melee_damage_upper * 2), 10)
animal.update_transform(2)
// animal.update_transform(2) //SPLURT EDIT
animal.AddElement(/datum/element/wall_tearer)
to_chat(user, span_info("You increase the size of [animal], giving [animal.p_them()] a surge of strength!"))
qdel(src)
Expand Down
6 changes: 6 additions & 0 deletions code/modules/mob/living/carbon/examine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@
if (length(status_examines))
. += status_examines

//SPLURT EDIT ADDITION - Sizecode
var/list/size_examines = get_size_examine_info(user)
if (length(size_examines))
. += size_examines
//SPLURT EDIT ADDITION END

if(get_bodypart(BODY_ZONE_HEAD) && !get_organ_by_type(/obj/item/organ/internal/brain))
. += span_deadsay("It appears that [t_his] brain is missing...")

Expand Down
16 changes: 11 additions & 5 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,13 @@
if(moving_diagonally)//no mob swap during diagonal moves.
return TRUE

//SPLURT EDIT ADDITION BEGIN - FEATURE_NAME - (sizecode)
//handle micro bumping on help intent
if(resolve_intent_name(combat_mode) == "help")
if(handle_micro_bump_helping(M))
return TRUE
//SPLURT EDIT ADDITION END

if(!M.buckled && !M.has_buckled_mobs())
if(can_mobswap_with(M))
//switch our position with M
Expand Down Expand Up @@ -254,6 +261,10 @@
//not if he's not CANPUSH of course
if(!(M.status_flags & CANPUSH))
return TRUE
//SPLURT EDIT ADDITION BEGIN - FEATURE_NAME - (sizecode)
if(handle_micro_bump_other(M))
return TRUE
//SPLURT EDIT ADDITION END
if(isliving(M))
var/mob/living/L = M
if(HAS_TRAIT(L, TRAIT_PUSHIMMUNE))
Expand Down Expand Up @@ -2034,11 +2045,6 @@ GLOBAL_LIST_EMPTY(fire_appearances)
if(NAMEOF(src, body_position))
set_body_position(var_value)
. = TRUE
if(NAMEOF(src, current_size))
if(var_value == 0) //prevents divisions of and by zero.
return FALSE
update_transform(var_value/current_size)
. = TRUE

if(!isnull(.))
datum_flags |= DF_VAR_EDITED
Expand Down
1 change: 1 addition & 0 deletions config/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ $include auxtools.txt

# SPLURT configs
$include splurt/discord.txt
$include splurt/fetish_content.txt

# You can use the @ character at the beginning of a config option to lock it from being edited in-game
# Example usage:
Expand Down
11 changes: 11 additions & 0 deletions config/splurt/fetish_content.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Body size configs, the feature will be disabled if both min and max have the same value.
BODY_SIZE_MIN 0.1
BODY_SIZE_MAX 2.00

## Multiplier used in the smaller strides slowdown calculation.
## Doesn't apply to floating or crawling mobs.
BODY_SIZE_SLOWDOWN_MULTIPLIER 0

## Macro health size cap ##
## Macros no longer get more health after their size reaches this value ##
#MACRO_HEALTH_CAP 3.5
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
savefile_identifier = PREFERENCE_CHARACTER
savefile_key = "body_size"
//SPLURT EDIT CHANGE - Sizecode
/*
minimum = BODY_SIZE_MIN
maximum = BODY_SIZE_MAX
*/
//SPLURT EDIT END
step = 0.01

/datum/preference/numeric/body_size/is_accessible(datum/preferences/preferences)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,13 @@
alterer.remove_quirk(/datum/quirk/oversized)

new_body_size = new_body_size * 0.01
//SPLURT EDIT CHANGE - Sizecode
/*
alterer.dna.features["body_size"] = new_body_size
alterer.dna.update_body_size()
*/
alterer.update_size(new_body_size)
//SPLURT EDIT CHANGE END

if("Genitals")
alter_genitals(alterer)
Expand Down
18 changes: 10 additions & 8 deletions modular_zubbers/code/datums/components/vore/vore.dm
Original file line number Diff line number Diff line change
Expand Up @@ -370,19 +370,20 @@
return FALSE
return TRUE

/datum/component/vore/proc/vore_other()
/datum/component/vore/proc/vore_other(mob/living/prey)
var/mob/living/pred = parent
if(!check_vore_grab(pred))
if(!prey)
prey = pred.pulling
if(!check_vore_grab(pred) && !istype(prey.loc, /obj/item/clothing/head/mob_holder))
to_chat(parent, span_danger("You must have a[ishuman(pred) ? "n aggressive" : ""] grab to eat someone."))
return
var/mob/living/prey = pred.pulling
if(!check_vore_preferences(parent, pred, prey))
return
#ifdef VORE_DELAY
pred.visible_message(span_danger("[pred] is attempting to [lowertext(selected_belly.insert_verb)] [prey] into their [lowertext(selected_belly.name)]!"), pref_to_check = /datum/preference/toggle/erp/vore_enable)
if(!do_after(pred, VORE_DELAY, prey))
return
if(!check_vore_grab(pred) || !check_vore_preferences(parent, pred, prey, assume_active_consent = TRUE))
if((!check_vore_grab(pred) && !istype(prey.loc, /obj/item/clothing/head/mob_holder)) || !check_vore_preferences(parent, pred, prey, assume_active_consent = TRUE))
return
#endif
pred.visible_message(span_danger("[pred] manages to [lowertext(selected_belly.insert_verb)] [prey] into their [lowertext(selected_belly.name)]!"), pref_to_check = /datum/preference/toggle/erp/vore_enable)
Expand All @@ -408,14 +409,15 @@
prey.visible_message(span_danger("[prey] manages to make [pred] [lowertext(pred_component.selected_belly.insert_verb)] [prey] into their [lowertext(pred_component.selected_belly.name)]!"), pref_to_check = /datum/preference/toggle/erp/vore_enable)
pred_component.complete_vore(prey)

/datum/component/vore/proc/feed_other_to_other(mob/living/pred)
/datum/component/vore/proc/feed_other_to_other(mob/living/pred, mob/living/prey)
var/mob/living/feeder = parent
if(!check_vore_grab(feeder))
if(!prey)
prey = feeder.pulling
if(!check_vore_grab(feeder) && !istype(prey.loc, /obj/item/clothing/head/mob_holder))
to_chat(feeder, span_danger("You must have a[ishuman(feeder) ? "n aggressive" : ""] grab to feed someone to someone else."))
return
if(!feeder.can_perform_action(pred, pred.interaction_flags_click | FORBID_TELEKINESIS_REACH))
return
var/mob/living/prey = feeder.pulling
if(!check_vore_preferences(feeder, pred, prey))
return
// check_vore_preferences asserts this exists
Expand All @@ -424,7 +426,7 @@
feeder.visible_message(span_danger("[feeder] is attempting to make [pred] [lowertext(pred_component.selected_belly.insert_verb)] [prey] into their [lowertext(pred_component.selected_belly.name)]!"), pref_to_check = /datum/preference/toggle/erp/vore_enable)
if(!do_after(feeder, VORE_DELAY, pred))
return
if(!check_vore_grab(feeder) || !check_vore_preferences(feeder, pred, prey, assume_active_consent = TRUE))
if((!check_vore_grab(pred) && !istype(prey.loc, /obj/item/clothing/head/mob_holder)) || !check_vore_preferences(feeder, pred, prey, assume_active_consent = TRUE))
return
if(!feeder.can_perform_action(pred, pred.interaction_flags_click | FORBID_TELEKINESIS_REACH))
return
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//Body size configs, the feature will be disabled if both min and max have the same value.
/datum/config_entry/number/body_size_min
default = 0.8
min_val = 0.1 //to avoid issues with zeros and negative values.
max_val = RESIZE_DEFAULT_SIZE
integer = FALSE

/datum/config_entry/number/body_size_max
default = 1.5
min_val = RESIZE_DEFAULT_SIZE
integer = FALSE

/datum/config_entry/number/body_size_slowdown_multiplier
default = 0
min_val = 0
integer = FALSE

/datum/config_entry/number/macro_health_cap
default = 3.5 //21 ft
integer = FALSE
64 changes: 64 additions & 0 deletions modular_zzplurt/code/datums/dna.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/datum/dna
var/last_capped_size //For some reason this feels dirty... I suppose it should go somewhere else

/datum/dna/transfer_identity(mob/living/carbon/destination, transfer_SE, transfer_species)
var/old_size = destination.dna.features["body_size"]
. = ..()
destination.update_size(get_size(destination), old_size)

/mob/living/carbon/human/hardset_dna(unique_identity, list/mutation_index, list/default_mutation_genes, newreal_name, newblood_type, datum/species/mrace, newfeatures, list/mutations, force_transfer_mutations)
var/old_size = dna.features["body_size"]
. = ..()
update_size(get_size(src), old_size)

/datum/dna/copy_dna(datum/dna/new_dna)
. = ..()
if(holder)
holder.adjust_mobsize(get_size(holder))

/datum/dna/update_body_size()
if(!holder || species.body_size_restricted || current_body_size == features["body_size"])
return ..()

holder.remove_movespeed_modifier(/datum/movespeed_modifier/small_stride)

. = ..()

if(get_size(holder) >= (RESIZE_A_BIGNORMAL + RESIZE_NORMAL) / 2)
holder.small_sprite.Grant(holder)
else
holder.small_sprite.Remove(holder)

if(!iscarbon(holder))
return

/* Needs genital updates
var/mob/living/carbon/C = holder
for(var/obj/item/organ/genital/G in C.internal_organs)
if(istype(G))
G.update()
*/

var/new_slowdown = (abs(get_size(holder) - 1) * CONFIG_GET(number/body_size_slowdown_multiplier))
holder.add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/small_stride, TRUE, new_slowdown)

var/size_cap = CONFIG_GET(number/macro_health_cap)
if((size_cap > 0) && (get_size(holder) > size_cap))
last_capped_size = (last_capped_size ? last_capped_size : current_body_size)
return
if(last_capped_size)
current_body_size = last_capped_size
last_capped_size = null
var/healthmod_old = ((current_body_size * 75) - 75)
var/healthmod_new = ((get_size(holder) * 75) - 75)
var/healthchange = healthmod_new - healthmod_old
holder.maxHealth += healthchange
holder.health += healthchange

/mob/living/carbon/set_species(datum/species/mrace, icon_update, pref_load, list/override_features, list/override_mutantparts, list/override_markings)
. = ..()
adjust_mobsize(get_size(src))

/datum/preference/choiced/species/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/prefs)
. = ..()
target.adjust_mobsize(get_size(target))
Loading

0 comments on commit e25184c

Please sign in to comment.