Skip to content

Commit

Permalink
Merge pull request #61 from SPLURT-Station/erp-interactions-and-related
Browse files Browse the repository at this point in the history
Refractored ERP interactions
  • Loading branch information
MosleyTheMalO authored Jan 1, 2025
2 parents 868d726 + acdda01 commit 0793d53
Show file tree
Hide file tree
Showing 131 changed files with 4,408 additions and 140 deletions.
53 changes: 53 additions & 0 deletions code/__DEFINES/~~~splurt_defines/interactions.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/// Extra interaction checks.

// A person needs to have mouth available to do this interaction
#define INTERACTION_REQUIRE_SELF_MOUTH "self_mouth"
#define INTERACTION_REQUIRE_TARGET_MOUTH "target_mouth"

// A person needs to have their top clothes removed to do this interaction
#define INTERACTION_REQUIRE_SELF_TOPLESS "self_topless"
#define INTERACTION_REQUIRE_TARGET_TOPLESS "target_topless"

// A person needs to have their bottom clothes removed to do this interaction
#define INTERACTION_REQUIRE_SELF_BOTTOMLESS "self_bottomless"
#define INTERACTION_REQUIRE_TARGET_BOTTOMLESS "target_bottomless"

// A person needs to have their feet exposed to do this interaction
#define INTERACTION_REQUIRE_SELF_FEET "self_feet"
#define INTERACTION_REQUIRE_TARGET_FEET "target_feet"

/// Climax definitions

//Climaxing genitals
#define CLIMAX_VAGINA "vagina"
#define CLIMAX_PENIS "penis"
#define CLIMAX_BOTH "both"

//Climaxing positions
#define CLIMAX_POSITION_USER "climax_user"
#define CLIMAX_POSITION_TARGET "climax_target"

//Climaxing targets (use these if you're not using organ slots)
#define CLIMAX_TARGET_MOUTH "mouth"
#define CLIMAX_TARGET_SHEATH "sheath"

// Extreme types
#define INTERACTION_EXTREME (1<<0)
#define INTERACTION_HARMFUL (1<<1) // If you use this on an interaction, add INTERACTION_EXTREME to it as well
#define INTERACTION_UNHOLY (1<<2)

// Interaction categories
#define INTERACTION_CAT_LEWD "lewd"
#define INTERACTION_CAT_EXTREME "extreme"
#define INTERACTION_CAT_HARMFUL "harmful"
#define INTERACTION_CAT_UNHOLY "unholy"

// Additional details sent to the interaction menu
#define INTERACTION_FILLS_CONTAINERS list( \
"info" = "You can fill a container if you have it in your active hand or are pulling it", \
"icon" = "flask", \
"color" = "transparent" \
)

// Interaction flags (used for logic but normally not sent to the interaction menu)
#define INTERACTION_OVERRIDE_FLUID_TRANSFER (1<<0)
6 changes: 6 additions & 0 deletions code/__DEFINES/~~~splurt_defines/subsystems.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* # INIT_ORDER_INTERACTIONS
* Used by the Interactions subsystems, used to set it's own position in the queue.
* This puts this last on priority, very far from other subsystems,
*/
#define INIT_ORDER_INTERACTIONS -150
2 changes: 1 addition & 1 deletion code/controllers/configuration/configuration.dm
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
load_whitelist()

// SKYRAT EDIT ADDITION START
populate_interaction_instances()
//populate_interaction_instances() //SPLURT EDIT REMOVAL - Interactions
remove_erp_things()
// SKYRAT EDIT ADDITION END

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,20 @@
var/e_prefs_v = preferences.read_preference(/datum/preference/choiced/erp_status_v)
var/e_prefs_nc = preferences.read_preference(/datum/preference/choiced/erp_status_nc)
var/e_prefs_mechanical = preferences.read_preference(/datum/preference/choiced/erp_status_mechanics)
// SPLURT EDIT ADDITION - Interaction preferences
var/e_prefs_extm = preferences.read_preference(/datum/preference/choiced/erp_status_extm)
var/e_prefs_extmharm = preferences.read_preference(/datum/preference/choiced/erp_status_extmharm)
var/e_prefs_unholy = preferences.read_preference(/datum/preference/choiced/erp_status_unholy)
// SPLURT EDIT END
ooc_notes += "ERP: [e_prefs]\n"
ooc_notes += "Hypnosis: [e_prefs_hypno]\n"
ooc_notes += "Vore: [e_prefs_v]\n"
ooc_notes += "Non-Con: [e_prefs_nc]\n"
// SPLURT EDIT ADDITION - Interaction preferences
ooc_notes += "Extreme ERP verbs: [e_prefs_extm]\n"
ooc_notes += "Harmful ERP verbs: [e_prefs_extmharm]\n"
ooc_notes += "Unholy ERP verbs: [e_prefs_unholy]\n"
// SPLURT EDIT END
ooc_notes += "ERP Mechanics: [e_prefs_mechanical]\n"
ooc_notes += "\n"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,31 @@

/datum/component/interactable/proc/build_interactions_list()
interactions = list()
for(var/iterating_interaction_id in GLOB.interaction_instances)
var/datum/interaction/interaction = GLOB.interaction_instances[iterating_interaction_id]
//SPLURT EDIT - Interactions subsystem
if(!SSinteractions)
return // Can't continue, no subsystem
for(var/iterating_interaction_id in SSinteractions.interactions)
var/datum/interaction/interaction = SSinteractions.interactions[iterating_interaction_id]
//SPLURT EDIT END
if(interaction.lewd)
if(!self.client?.prefs?.read_preference(/datum/preference/toggle/erp))
continue
// SPLURT EDIT ADDITION - Interaction preferences
if(interaction.unsafe_types & INTERACTION_EXTREME)
if(self.client?.prefs?.read_preference(/datum/preference/choiced/erp_status_extm) == "No")
continue
if(interaction.unsafe_types & INTERACTION_HARMFUL)
if(self.client?.prefs?.read_preference(/datum/preference/choiced/erp_status_extmharm) == "No")
continue
if(interaction.unsafe_types & INTERACTION_UNHOLY)
if(self.client?.prefs?.read_preference(/datum/preference/choiced/erp_status_unholy) == "No")
continue
// SPLURT EDIT END
/*
SPLURT EDIT REMOVAL - Interactions
if(interaction.sexuality != "" && interaction.sexuality != self.client?.prefs?.read_preference(/datum/preference/choiced/erp_sexuality))
continue
*/
interactions.Add(interaction)

/datum/component/interactable/RegisterWithParent()
Expand Down Expand Up @@ -143,11 +161,11 @@

if(params["interaction"])
var/interaction_id = params["interaction"]
if(GLOB.interaction_instances[interaction_id])
if(SSinteractions.interactions[interaction_id])
var/mob/living/carbon/human/user = locate(params["userref"])
if(!can_interact(GLOB.interaction_instances[interaction_id], user))
if(!can_interact(SSinteractions.interactions[interaction_id], user))
return FALSE
GLOB.interaction_instances[interaction_id].act(user, locate(params["selfref"]))
SSinteractions.interactions[interaction_id].act(user, locate(params["selfref"]))
var/datum/component/interactable/interaction_component = user.GetComponent(/datum/component/interactable)
interaction_component.interact_last = world.time
interact_next = interaction_component.interact_last + INTERACTION_COOLDOWN
Expand Down
46 changes: 32 additions & 14 deletions modular_skyrat/modules/interaction_menu/code/interaction_datum.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

/* SPLURT EDIT REMOVAL - Interactions subsystem
GLOBAL_LIST_EMPTY_TYPED(interaction_instances, /datum/interaction)
*/

/datum/interaction
/// The name to be displayed in the interaction menu for this interaction
Expand Down Expand Up @@ -48,9 +50,12 @@ GLOBAL_LIST_EMPTY_TYPED(interaction_instances, /datum/interaction)
var/list/interaction_requires = list()
/// What color should the interaction button be?
var/color = "blue"
/* SPLURT EDIT REMOVAL - Interactions
/// What sexuality preference do we display for.
var/sexuality = ""
*/

/* SPLURT EDIT REMOVAL - Interactions - Refractored in modular
/datum/interaction/proc/allow_act(mob/living/carbon/human/user, mob/living/carbon/human/target)
if(target == user && usage == INTERACTION_OTHER)
return FALSE
Expand Down Expand Up @@ -82,6 +87,7 @@ GLOBAL_LIST_EMPTY_TYPED(interaction_instances, /datum/interaction)
else
CRASH("Unimplemented interaction requirement '[requirement]'")
return TRUE
*/ //SPLURT EDIT END

/datum/interaction/proc/act(mob/living/carbon/human/user, mob/living/carbon/human/target)
if(!allow_act(user, target))
Expand Down Expand Up @@ -115,16 +121,24 @@ GLOBAL_LIST_EMPTY_TYPED(interaction_instances, /datum/interaction)
message_admins("Deprecated sound handling for '[name]'. Correct format is a list with one entry. This message will only show once.")
sound_possible = list(sound_possible)
sound_cache = pick(sound_possible)
//SPLURT EDIT - Interactions - For some reason the original code didn't send any sound
/*
for(var/mob/mob in view(sound_range, user))
SEND_SOUND(sound_cache, mob)

*/
conditional_pref_sound(user, sound_cache, 80, TRUE, falloff_distance = sound_range, pref_to_check = /datum/preference/toggle/erp/sounds)
//SPLURT EDIT END
if(lewd)
user.adjust_pleasure(user_pleasure)
user.adjust_pleasure(user_pleasure * (target.dna.features["sexual_potency"] || 1), target, src, CLIMAX_POSITION_USER) //SPLURT EDIT - Interactions
user.adjust_arousal(user_arousal)
user.adjust_pain(user_pain)
target.adjust_pleasure(target_pleasure)
target.adjust_arousal(target_arousal)
target.adjust_pain(target_pain)
user.adjust_pain(user_pain, target, src, CLIMAX_POSITION_USER) //SPLURT EDIT - Interactions
if(usage == INTERACTION_OTHER) //SPLURT EDIT - Interactions
target.adjust_pleasure(target_pleasure * (user.dna.features["sexual_potency"] || 1), user, src, CLIMAX_POSITION_TARGET) //SPLURT EDIT - Interactions
target.adjust_arousal(target_arousal)
target.adjust_pain(target_pain, user, src, CLIMAX_POSITION_TARGET) //SPLURT EDIT - Interactions

post_interaction(user, target) //SPLURT EDIT - Interactions
return TRUE

/datum/interaction/proc/load_from_json(path)
var/fpath = path
Expand Down Expand Up @@ -157,7 +171,7 @@ GLOBAL_LIST_EMPTY_TYPED(interaction_instances, /datum/interaction)
target_pleasure = sanitize_integer(json["target_pleasure"], 0, 100, 0)
target_pain = sanitize_integer(json["target_pain"], 0, 100, 0)
lewd = sanitize_integer(json["lewd"], 0, 1, 0)
sexuality = sanitize_text(json["sexuality"])
// sexuality = sanitize_text(json["sexuality"]) //SPLURT EDIT REMOVAL - Interactions
return TRUE

/datum/interaction/proc/json_save(path)
Expand Down Expand Up @@ -187,7 +201,7 @@ GLOBAL_LIST_EMPTY_TYPED(interaction_instances, /datum/interaction)
"target_pleasure" = target_pleasure,
"target_pain" = target_pain,
"lewd" = lewd,
"sexuality" = sexuality,
// "sexuality" = sexuality, //SPLURT EDIT REMOVAL - Interactions
)
var/file = file(fpath)
WRITE_FILE(file, json_encode(json))
Expand All @@ -201,7 +215,11 @@ GLOBAL_LIST_EMPTY_TYPED(interaction_instances, /datum/interaction)
/proc/populate_interaction_instances()
for(var/spath in subtypesof(/datum/interaction))
var/datum/interaction/interaction = new spath()
GLOB.interaction_instances[interaction.name] = interaction
//SPLURT EDIT - Interactions
if(interaction.name == /datum/interaction::name || interaction.description == /datum/interaction::description)
continue
//SPLURT EDIT END
SSinteractions.interactions[interaction.name] = interaction //SPLURT EDIT - Interactions subsystem - Original: GLOB.interaction_instances[interaction.name] = interaction
populate_interaction_jsons(INTERACTION_JSON_FOLDER)

/proc/populate_interaction_jsons(directory)
Expand All @@ -214,7 +232,7 @@ GLOBAL_LIST_EMPTY_TYPED(interaction_instances, /datum/interaction)
continue
var/datum/interaction/interaction = new()
if(interaction.load_from_json(directory + file))
GLOB.interaction_instances[interaction.name] = interaction
SSinteractions.interactions[interaction.name] = interaction //SPLURT EDIT - Interactions subsystem - Original: GLOB.interaction_instances[interaction.name] = interaction
else message_admins("Error loading interaction from file: '[directory + file]'. Inform coders.")

/proc/populate_interaction_jsons_master(path)
Expand All @@ -225,7 +243,7 @@ GLOBAL_LIST_EMPTY_TYPED(interaction_instances, /datum/interaction)
var/list/json = json_load(file)

for(var/iname in json)
if(GLOB.interaction_instances[iname])
if(SSinteractions.interactions[iname]) //SPLURT EDIT - Interactions subsystem - Original: if(GLOB.interaction_instances[iname])
message_admins("Interaction Master '[path]' contained a duplicate interaction! '[iname]'")
continue

Expand Down Expand Up @@ -257,9 +275,9 @@ GLOBAL_LIST_EMPTY_TYPED(interaction_instances, /datum/interaction)
interaction.target_pleasure = sanitize_integer(ijson["target_pleasure"], 0, 100, 0)
interaction.target_pain = sanitize_integer(ijson["target_pain"], 0, 100, 0)
interaction.lewd = sanitize_integer(ijson["lewd"], 0, 1, 0)
interaction.sexuality = sanitize_text(ijson["sexuality"])
// interaction.sexuality = sanitize_text(ijson["sexuality"]) //SPLURT EDIT REMOVAL - Interactions

GLOB.interaction_instances[iname] = interaction
SSinteractions.interactions[iname] = interaction //SPLURT EDIT - Interactions subsystem - Original: GLOB.interaction_instances[iname] = interaction

ADMIN_VERB(reload_interactions, R_DEBUG, "Reload Interactions", "Force reload interactions.", ADMIN_CATEGORY_DEBUG)
populate_interaction_instances()
SSinteractions.prepare_interactions() //SPLURT EDIT - Interactions subsystem - Original: populate_interaction_instances()
Loading

0 comments on commit 0793d53

Please sign in to comment.