Merge pull request #7605 from Poojawa/fixytweaks

Fixes vore prefs, missing species features
This commit is contained in:
deathride58
2018-10-01 23:19:33 -04:00
committed by GitHub
9 changed files with 82 additions and 93 deletions
+1
View File
@@ -0,0 +1 @@
#define RUSTG_OVERRIDE_BUILTINS
+10 -2
View File
@@ -211,11 +211,21 @@ GLOBAL_LIST_EMPTY(external_rsc_urls)
new /datum/admins(localhost_rank, ckey, 1, 1)
//preferences datum - also holds some persistent data for the client (because we may as well keep these datums to a minimum)
prefs = GLOB.preferences_datums[ckey]
prefs_vr = GLOB.vore_preferences_datums[ckey] //CITADEL EDIT bypassing a failing hook
if(prefs)
prefs.parent = src
else
prefs = new /datum/preferences(src)
GLOB.preferences_datums[ckey] = prefs
if(prefs_vr) //CITADEL EDIT bypassing a failing hook START
prefs_vr.client = src
else
prefs_vr = new/datum/vore_preferences(src)
GLOB.vore_preferences_datums[ckey] = prefs_vr
//CITADEL EDIT bypassing a failing hook END
prefs.last_ip = address //these are gonna be used for banning
prefs.last_id = computer_id //these are gonna be used for banning
fps = prefs.clientfps
@@ -409,8 +419,6 @@ GLOBAL_LIST_EMPTY(external_rsc_urls)
if (menuitem)
menuitem.Load_checked(src)
hook_vr("client_new",list(src)) // CIT CHANGE - hook for client/New() changes
Master.UpdateTickRate()
//////////////
@@ -17,13 +17,12 @@
var/list/living_mobs = list()
// Release belly contents beforey being gc'd!
// Release belly contents before being gc'd!
/mob/living/simple_animal/Destroy()
release_vore_contents(silent = TRUE)
release_vore_contents(include_absorbed = TRUE, silent = TRUE)
prey_excludes.Cut()
. = ..()
// Update fullness based on size & quantity of belly contents
/mob/living/simple_animal/proc/update_fullness(var/atom/movable/M)
var/new_fullness = 0
@@ -4,8 +4,8 @@
default_color = "4B4B4B"
species_traits = list(MUTCOLORS,EYECOLOR,LIPS,HAIR)
inherent_biotypes = list(MOB_ORGANIC, MOB_HUMANOID)
mutant_bodyparts = list("mam_tail", "mam_ears", "mam_body_markings", "snout", "taur")
default_features = list("mcolor" = "FFF","mcolor2" = "FFF","mcolor3" = "FFF", "snout" = "Husky", "mam_tail" = "Husky", "mam_ears" = "Husky", "mam_body_markings" = "Husky", "taur" = "None")
mutant_bodyparts = list("mam_tail", "mam_ears", "mam_body_markings", "snout", "taur", "legs")
default_features = list("mcolor" = "FFF","mcolor2" = "FFF","mcolor3" = "FFF", "snout" = "Husky", "mam_tail" = "Husky", "mam_ears" = "Husky", "mam_body_markings" = "Husky", "taur" = "None", "legs" = "Normal Legs")
attack_verb = "claw"
attack_sound = 'sound/weapons/slash.ogg'
miss_sound = 'sound/weapons/slashmiss.ogg'
@@ -114,8 +114,8 @@
default_color = "BCAC9B"
species_traits = list(MUTCOLORS,EYECOLOR,LIPS,HAIR)
inherent_biotypes = list(MOB_ORGANIC, MOB_HUMANOID)
mutant_bodyparts = list("mam_tail", "mam_body_markings", "mam_ears", "taur")
default_features = list("mcolor" = "FFF","mcolor2" = "FFF","mcolor3" = "FFF", "mam_tail" = "Shark", "mam_body_markings" = "Shark", "mam_ears" = "None", "snout" = "Round")
mutant_bodyparts = list("mam_tail", "mam_body_markings", "mam_ears", "taur", "legs")
default_features = list("mcolor" = "FFF","mcolor2" = "FFF","mcolor3" = "FFF", "mam_tail" = "Shark", "mam_body_markings" = "Shark", "mam_ears" = "None", "snout" = "Round", "taur" = "None", "legs" = "Normal Legs")
attack_verb = "bite"
attack_sound = 'sound/weapons/bite.ogg'
miss_sound = 'sound/weapons/slashmiss.ogg'
@@ -169,7 +169,7 @@
species_traits = list(MUTCOLORS,EYECOLOR,LIPS,HAIR)
inherent_biotypes = list(MOB_ORGANIC, MOB_HUMANOID, MOB_BUG)
mutant_bodyparts = list("mam_body_markings", "mam_ears", "mam_tail", "taur", "moth_wings")
default_features = list("mcolor" = "FFF","mcolor2" = "FFF","mcolor3" = "FFF", "mam_body_markings" = "Moth", "mam_tail" = "None", "mam_ears" = "None", "moth_wings" = "Plain", "snout" = "None")
default_features = list("mcolor" = "FFF","mcolor2" = "FFF","mcolor3" = "FFF", "mam_body_markings" = "Moth", "mam_tail" = "None", "mam_ears" = "None", "moth_wings" = "Plain", "snout" = "None", "taur" = "None")
attack_verb = "flutter" //wat?
attack_sound = 'sound/weapons/slash.ogg'
miss_sound = 'sound/weapons/slashmiss.ogg'
@@ -125,8 +125,12 @@
"can_taste",
"bulge_size",
"silent",
"transferchance",
"transferlocation",
"transferchance",
"autotransferchance",
"autotransferwait",
"swallow_time",
"vore_capacity",
"struggle_messages_outside",
"struggle_messages_inside",
"digest_messages_owner",
@@ -228,7 +232,7 @@
SEND_SIGNAL(ML, COMSIG_CLEAR_MOOD_EVENT, "fedprey", /datum/mood_event/fedprey)
SEND_SIGNAL(OW, COMSIG_ADD_MOOD_EVENT, "emptypred", /datum/mood_event/emptypred)
SEND_SIGNAL(ML, COMSIG_ADD_MOOD_EVENT, "emptyprey", /datum/mood_event/emptyprey)
if(ML.absorbed)
ML.absorbed = FALSE
if(ishuman(M) && ishuman(OW))
@@ -252,14 +256,14 @@
return
if (prey.buckled)
prey.buckled.unbuckle_mob(prey,TRUE)
if(!isbelly(prey.loc))
SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, "fedpred", /datum/mood_event/fedpred)
SEND_SIGNAL(prey, COMSIG_ADD_MOOD_EVENT, "fedprey", /datum/mood_event/fedprey)
else
SEND_SIGNAL(owner, COMSIG_CLEAR_MOOD_EVENT, "emptypred", /datum/mood_event/emptypred)
SEND_SIGNAL(prey, COMSIG_CLEAR_MOOD_EVENT, "emptyprey", /datum/mood_event/emptyprey)
prey.forceMove(src)
var/sound/preyloop = sound('sound/vore/prey/loop.ogg', repeat = TRUE)
if(!silent)
@@ -389,13 +393,7 @@
// If digested prey is also a pred... anyone inside their bellies gets moved up.
if(is_vore_predator(M))
for(var/belly in M.vore_organs)
var/obj/belly/B = belly
for(var/thing in B)
var/atom/movable/AM = thing
AM.forceMove(owner.loc)
if(isliving(AM))
to_chat(AM,"As [M] melts away around you, you find yourself in [owner]'s [lowertext(name)]")
M.release_vore_contents(include_absorbed = TRUE, silent = TRUE)
//Drop all items into the belly
for(var/obj/item/W in M)
@@ -280,14 +280,6 @@
return 0
*/
//
// Release everything in every vore organ
//
/mob/living/proc/release_vore_contents(var/include_absorbed = TRUE)
for(var/belly in vore_organs)
var/obj/belly/B = belly
B.release_all_contents(include_absorbed)
//
// Custom resist catches for /mob/living
//
@@ -354,35 +346,29 @@
// Verb for saving vore preferences to save file
//
/mob/living/proc/save_vore_prefs()
if(!client)
return FALSE
if(client && !client.prefs_vr)
return FALSE
if(!client || !client.prefs_vr)
return 0
if(!copy_to_prefs_vr())
return FALSE
if(client && !client.prefs_vr.save_vore())
return FALSE
return 0
if(!client.prefs_vr.save_vore())
return 0
return TRUE
return 1
/mob/living/proc/apply_vore_prefs()
if(!client)
return FALSE
if(client && !client.prefs_vr)
return FALSE
if(client && !client.prefs_vr.load_vore())
return FALSE
if(!client || !client.prefs_vr)
return 0
if(!client.prefs_vr.load_vore())
return 0
if(!copy_from_prefs_vr())
return FALSE
return 0
return TRUE
return 1
/mob/living/proc/copy_to_prefs_vr()
if(!client)
return FALSE
if(client && !client.prefs_vr)
src << "<span class='warning'>You attempted to save your vore prefs but somehow you're in this character without a client.prefs_vr variable. Tell a dev.</span>"
return FALSE
if(!client || !client.prefs_vr)
to_chat(src,"<span class='warning'>You attempted to save your vore prefs but somehow you're in this character without a client.prefs_vr variable. Tell a dev.</span>")
return 0
var/datum/vore_preferences/P = client.prefs_vr
@@ -397,17 +383,15 @@
P.belly_prefs = serialized
return TRUE
return 1
//
// Proc for applying vore preferences, given bellies
//
/mob/living/proc/copy_from_prefs_vr()
if(!client)
return FALSE
if(client && !client.prefs_vr)
src << "<span class='warning'>You attempted to apply your vore prefs but somehow you're in this character without a client.prefs_vr variable. Tell a dev.</span>"
return FALSE
if(!client || !client.prefs_vr)
to_chat(src,"<span class='warning'>You attempted to apply your vore prefs but somehow you're in this character without a client.prefs_vr variable. Tell a dev.</span>")
return 0
var/datum/vore_preferences/P = client.prefs_vr
@@ -415,11 +399,20 @@
devourable = P.devourable
vore_taste = P.vore_taste
release_vore_contents(silent = TRUE)
vore_organs.Cut()
for(var/entry in P.belly_prefs)
list_to_object(entry,src)
return TRUE
return 1
//
// Release everything in every vore organ
//
/mob/living/proc/release_vore_contents(var/include_absorbed = TRUE, var/silent = FALSE)
for(var/belly in vore_organs)
var/obj/belly/B = belly
B.release_all_contents(include_absorbed, silent)
//
// Returns examine messages for bellies
@@ -27,16 +27,14 @@ V::::::V V::::::VO:::::::OOO:::::::ORR:::::R R:::::REE::::::EEEEEE
//
// The datum type bolted onto normal preferences datums for storing Vore stuff
//
#define VORE_VERSION 2
GLOBAL_LIST_EMPTY(vore_preferences_datums)
/client
var/datum/vore_preferences/prefs_vr
/hook/client_new/proc/add_prefs_vr(client/C)
C.prefs_vr = new/datum/vore_preferences(C)
if(C.prefs_vr)
return TRUE
return FALSE
/datum/vore_preferences
//Actual preferences
var/digestable = FALSE
@@ -83,25 +81,24 @@ V::::::V V::::::VO:::::::OOO:::::::ORR:::::R R:::::REE::::::EEEEEE
if(!ckey || !slot) return
path = "data/player_saves/[copytext(ckey,1,2)]/[ckey]/vore/[filename][slot].[ext]"
/datum/vore_preferences/proc/load_vore()
if(!client || !client_ckey)
return FALSE //No client, how can we save?
return 0 //No client, how can we save?
if(!client.prefs || !client.prefs.default_slot)
return FALSE //Need to know what character to load!
return 0 //Need to know what character to load!
slot = client.prefs.default_slot
load_path(client_ckey,slot)
if(!path) return FALSE //Path couldn't be set?
if(!path) return 0 //Path couldn't be set?
if(!fexists(path)) //Never saved before
save_vore() //Make the file first
return TRUE
return 1
var/list/json_from_file = json_decode(file2text(path))
if(!json_from_file)
return FALSE //My concern grows
return 0 //My concern grows
var/version = json_from_file["version"]
json_from_file = patch_version(json_from_file,version)
@@ -119,23 +116,13 @@ V::::::V V::::::VO:::::::OOO:::::::ORR:::::R R:::::REE::::::EEEEEE
if(isnull(belly_prefs))
belly_prefs = list()
return TRUE
/*
allowmobvore = json_from_file["allowmobvore"]
can_be_drop_prey = json_from_file["can_be_drop_prey"]
can_be_drop_prey = json_from_file["can_be_drop_pred"]
if(isnull(allowmobvore))
allowmobvore = TRUE
if(isnull(can_be_drop_prey))
allowmobvore = FALSE
if(isnull(can_be_drop_pred))
allowmobvore = FALSE */
return 1
/datum/vore_preferences/proc/save_vore()
if(!path) return FALSE
if(!path)
return 0
var/version = 1 //For "good times" use in the future
var/version = VORE_VERSION //For "good times" use in the future
var/list/settings_list = list(
"version" = version,
"digestable" = digestable,
@@ -148,22 +135,22 @@ V::::::V V::::::VO:::::::OOO:::::::ORR:::::R R:::::REE::::::EEEEEE
var/json_to_file = json_encode(settings_list)
if(!json_to_file)
testing("Saving: [path] failed jsonencode")
return FALSE
return 0
//Write it out
#ifdef RUST_G
call(RUST_G, "file_write")(json_to_file, path)
#else
//#ifdef RUST_G
// call(RUST_G, "file_write")(json_to_file, path)
//#else
// Fall back to using old format if we are not using rust-g
if(fexists(path))
fdel(path) //Byond only supports APPENDING to files, not replacing.
text2file(json_to_file, path)
#endif
//#endif
if(!fexists(path))
testing("Saving: [path] failed file write")
return FALSE
return 0
return TRUE
return 1
/* commented out list things
"allowmobvore" = allowmobvore,
@@ -171,5 +158,7 @@ V::::::V V::::::VO:::::::OOO:::::::ORR:::::R R:::::REE::::::EEEEEE
"can_be_drop_pred" = can_be_drop_pred, */
//Can do conversions here
/datum/vore_preferences/proc/patch_version(var/list/json_from_file,var/version)
return json_from_file
datum/vore_preferences/proc/patch_version(var/list/json_from_file,var/version)
return json_from_file
#undef VORE_VERSION
BIN
View File
Binary file not shown.
+1
View File
@@ -83,6 +83,7 @@
#include "code\__DEFINES\research.dm"
#include "code\__DEFINES\robots.dm"
#include "code\__DEFINES\role_preferences.dm"
#include "code\__DEFINES\rust_g.config.dm"
#include "code\__DEFINES\rust_g.dm"
#include "code\__DEFINES\say.dm"
#include "code\__DEFINES\shuttles.dm"