Fixes and optimizes vorepref loading.

-Voreprefs are now loaded when the character loads as they used to be. The initial load only gives one usable belly while the rest are loaded when the vorepanel is opened.
-Now that the prefs are loaded at an appropriate time again, the forced defaults to disable everything are no longer a prefbreak concern.
-Un-spaghettifies an "optimization" into an optimization.
-Fixes voreprefs not loading when they should load.
This commit is contained in:
Verkister
2021-03-21 23:36:15 +02:00
parent 7e2890409e
commit 2059c83bc2
8 changed files with 18 additions and 16 deletions

View File

@@ -86,8 +86,6 @@
icon_state = "[icon_rest]-[vore_fullness]" icon_state = "[icon_rest]-[vore_fullness]"
/mob/living/simple_mob/proc/will_eat(var/mob/living/M) /mob/living/simple_mob/proc/will_eat(var/mob/living/M)
M.init_vore()
init_vore()
if(client) //You do this yourself, dick! if(client) //You do this yourself, dick!
//ai_log("vr/wont eat [M] because we're player-controlled", 3) //VORESTATION AI TEMPORARY REMOVAL //ai_log("vr/wont eat [M] because we're player-controlled", 3) //VORESTATION AI TEMPORARY REMOVAL
return 0 return 0

View File

@@ -78,7 +78,6 @@
var/target_zone = pick(BP_TORSO,BP_TORSO,BP_TORSO,BP_L_LEG,BP_R_LEG,BP_L_ARM,BP_R_ARM,BP_HEAD) var/target_zone = pick(BP_TORSO,BP_TORSO,BP_TORSO,BP_L_LEG,BP_R_LEG,BP_L_ARM,BP_R_ARM,BP_HEAD)
if(L.can_inject(src, null, target_zone)) if(L.can_inject(src, null, target_zone))
last_inject = world.time last_inject = world.time
L.init_vore()
if(!L.allowmobvore) //If we can't eat them, stop mauling them. if(!L.allowmobvore) //If we can't eat them, stop mauling them.
ai_holder.lose_target() //Call this first so the attacks stop if the reagent proc runtimes. ai_holder.lose_target() //Call this first so the attacks stop if the reagent proc runtimes.
L.reagents.add_reagent("bicaridine", venom_dose) //If we can't eat them, give them some bicar to compensate for no heal belly. L.reagents.add_reagent("bicaridine", venom_dose) //If we can't eat them, give them some bicar to compensate for no heal belly.

View File

@@ -77,8 +77,6 @@
pred.Weaken(8) pred.Weaken(8)
var/mob/living/prey = src var/mob/living/prey = src
var/fallloc = prey.loc var/fallloc = prey.loc
pred.init_vore()
prey.init_vore()
if(pred.can_be_drop_pred && prey.can_be_drop_prey) if(pred.can_be_drop_pred && prey.can_be_drop_prey)
pred.feed_grabbed_to_self_falling_nom(pred,prey) pred.feed_grabbed_to_self_falling_nom(pred,prey)
pred.loc = fallloc pred.loc = fallloc

View File

@@ -49,6 +49,11 @@
M.verbs += /mob/living/proc/vore_transfer_reagents //CHOMP If mob doesnt have bellies it cant use this verb for anything M.verbs += /mob/living/proc/vore_transfer_reagents //CHOMP If mob doesnt have bellies it cant use this verb for anything
M.verbs += /mob/living/proc/vore_check_reagents //CHOMP If mob doesnt have bellies it cant use this verb for anything M.verbs += /mob/living/proc/vore_check_reagents //CHOMP If mob doesnt have bellies it cant use this verb for anything
//Tries to load prefs if a client is present otherwise gives freebie stomach
spawn(2 SECONDS)
if(M)
M.init_vore()
//return TRUE to hook-caller //return TRUE to hook-caller
return TRUE return TRUE
@@ -97,7 +102,6 @@
//Has to be aggressive grab, has to be living click-er and non-silicon grabbed //Has to be aggressive grab, has to be living click-er and non-silicon grabbed
if(G.state >= GRAB_AGGRESSIVE && (isliving(user) && !issilicon(G.affecting))) if(G.state >= GRAB_AGGRESSIVE && (isliving(user) && !issilicon(G.affecting)))
var/mob/living/attacker = user // Typecast to living var/mob/living/attacker = user // Typecast to living
G.affecting.init_vore()
// src is the mob clicked on and attempted predator // src is the mob clicked on and attempted predator
@@ -148,10 +152,6 @@
var/mob/living/attacker = user // Typecast to living var/mob/living/attacker = user // Typecast to living
if(is_vore_predator(src)) if(is_vore_predator(src))
for(var/mob/living/M in H.contents) for(var/mob/living/M in H.contents)
M.init_vore()
if(!M.devourable)
to_chat(user, "<span class='notice'>[M] isn't able to be devoured.</span>")
return FALSE
if(attacker.eat_held_mob(attacker, M, src)) if(attacker.eat_held_mob(attacker, M, src))
if(H.held_mob == M) if(H.held_mob == M)
H.held_mob = null H.held_mob = null
@@ -290,6 +290,7 @@
vore_organs.Cut() vore_organs.Cut()
for(var/entry in P.belly_prefs) for(var/entry in P.belly_prefs)
list_to_object(entry,src) list_to_object(entry,src)
break //CHOMPedit: Belly load optimization. Only load first belly, save the rest for vorepanel.
return TRUE return TRUE

View File

@@ -13,8 +13,6 @@
if(stat != CONSCIOUS) if(stat != CONSCIOUS)
return return
init_vore()
T.init_vore()
// Verbs are horrifying. They don't call overrides. So we're stuck with this. // Verbs are horrifying. They don't call overrides. So we're stuck with this.
if(istype(src, /mob/living/simple_mob/animal/passive/mouse) && !T.ckey) if(istype(src, /mob/living/simple_mob/animal/passive/mouse) && !T.ckey)
// Mice can't eat logged out players! // Mice can't eat logged out players!

View File

@@ -82,7 +82,6 @@ V::::::V V::::::VO:::::::OOO:::::::ORR:::::R R:::::REE::::::EEEEEE
// Check if an object is capable of eating things, based on vore_organs // Check if an object is capable of eating things, based on vore_organs
// //
/proc/is_vore_predator(mob/living/O) /proc/is_vore_predator(mob/living/O)
O.init_vore()
if(istype(O,/mob/living)) if(istype(O,/mob/living))
if(O.vore_organs.len > 0) if(O.vore_organs.len > 0)
return TRUE return TRUE

View File

@@ -18,7 +18,16 @@
if(!vorePanel) if(!vorePanel)
log_debug("[src] ([type], \ref[src]) didn't have a vorePanel and tried to use the verb.") log_debug("[src] ([type], \ref[src]) didn't have a vorePanel and tried to use the verb.")
vorePanel = new(src) vorePanel = new(src)
init_vore() //CHOMPedit Returns if the organs already exist anyway.
if(!vorePanel.bellies_loaded) //CHOMPedit Start: On-demand belly loading
var/datum/vore_preferences/P = client.prefs_vr
var/firstbelly = FALSE // First belly loaded on init_vore
for(var/entry in P.belly_prefs)
if(!firstbelly)
firstbelly = TRUE
continue
list_to_object(entry,src)
vorePanel.bellies_loaded = TRUE //CHOMPedit End
vorePanel.tgui_interact(src) vorePanel.tgui_interact(src)
@@ -32,6 +41,7 @@
var/mob/living/host // Note, we do this in case we ever want to allow people to view others vore panels var/mob/living/host // Note, we do this in case we ever want to allow people to view others vore panels
var/unsaved_changes = FALSE var/unsaved_changes = FALSE
var/show_pictures = TRUE var/show_pictures = TRUE
var/bellies_loaded = FALSE //CHOMPedit: On-demand belly loading
/datum/vore_look/New(mob/living/new_host) /datum/vore_look/New(mob/living/new_host)
if(istype(new_host)) if(istype(new_host))

View File

@@ -3185,9 +3185,9 @@
#include "code\modules\mob\new_player\sprite_accessories_taur.dm" #include "code\modules\mob\new_player\sprite_accessories_taur.dm"
#include "code\modules\mob\new_player\sprite_accessories_taur_vr.dm" #include "code\modules\mob\new_player\sprite_accessories_taur_vr.dm"
#include "code\modules\mob\new_player\sprite_accessories_vr.dm" #include "code\modules\mob\new_player\sprite_accessories_vr.dm"
#include "code\modules\mob\new_player\sprite_accessories_yw.dm"
#include "code\modules\mob\new_player\sprite_accessories_wing.dm" #include "code\modules\mob\new_player\sprite_accessories_wing.dm"
#include "code\modules\mob\new_player\sprite_accessories_wing_vr.dm" #include "code\modules\mob\new_player\sprite_accessories_wing_vr.dm"
#include "code\modules\mob\new_player\sprite_accessories_yw.dm"
#include "code\modules\modular_computers\laptop_vendor.dm" #include "code\modules\modular_computers\laptop_vendor.dm"
#include "code\modules\modular_computers\computers\modular_computer\core.dm" #include "code\modules\modular_computers\computers\modular_computer\core.dm"
#include "code\modules\modular_computers\computers\modular_computer\damage.dm" #include "code\modules\modular_computers\computers\modular_computer\damage.dm"
@@ -4003,7 +4003,6 @@
#include "code\modules\vore\eating\bellymodes_vr.dm" #include "code\modules\vore\eating\bellymodes_vr.dm"
#include "code\modules\vore\eating\contaminate_vr.dm" #include "code\modules\vore\eating\contaminate_vr.dm"
#include "code\modules\vore\eating\digest_act_vr.dm" #include "code\modules\vore\eating\digest_act_vr.dm"
#include "code\modules\vore\eating\human_ch.dm"
#include "code\modules\vore\eating\leave_remains_vr.dm" #include "code\modules\vore\eating\leave_remains_vr.dm"
#include "code\modules\vore\eating\living_ch.dm" #include "code\modules\vore\eating\living_ch.dm"
#include "code\modules\vore\eating\living_vr.dm" #include "code\modules\vore\eating\living_vr.dm"