From a7a6489f5837e2c67ffd8df983232398a039bd27 Mon Sep 17 00:00:00 2001
From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com>
Date: Sun, 23 Aug 2020 21:48:38 +0100
Subject: [PATCH 1/3] loadout loading
---
code/controllers/subsystem/job.dm | 4 ++--
code/modules/client/preferences.dm | 3 ++-
.../mob/dead/new_player/preferences_setup.dm | 13 +++++++++----
3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm
index 4f59992ace..5177477756 100644
--- a/code/controllers/subsystem/job.dm
+++ b/code/controllers/subsystem/job.dm
@@ -665,7 +665,7 @@ SUBSYSTEM_DEF(job)
message_admins(msg)
CRASH(msg)
-/datum/controller/subsystem/job/proc/equip_loadout(mob/dead/new_player/N, mob/living/M, equipbackpackstuff, bypass_prereqs = FALSE)
+/datum/controller/subsystem/job/proc/equip_loadout(mob/dead/new_player/N, mob/living/M, equipbackpackstuff, bypass_prereqs = FALSE, force_equip = FALSE)
var/mob/the_mob = N
if(!the_mob)
the_mob = M // cause this doesn't get assigned if player is a latejoiner
@@ -689,7 +689,7 @@ SUBSYSTEM_DEF(job)
if(!permitted)
continue
var/obj/item/I = new G.path
- if(!M.equip_to_slot_if_possible(I, G.slot, disable_warning = TRUE, bypass_equip_delay_self = TRUE)) // If the job's dresscode compliant, try to put it in its slot, first
+ if(!M.equip_to_slot_if_possible(I, G.slot, disable_warning = TRUE, bypass_equip_delay_self = TRUE, clothing_check = !force_equip)) // If the job's dresscode compliant, try to put it in its slot, first
if(iscarbon(M))
var/mob/living/carbon/C = M
var/obj/item/storage/backpack/B = C.back
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index 778b5175a7..7debbff4d9 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -280,7 +280,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
/datum/preferences/proc/ShowChoices(mob/user)
if(!user || !user.client)
return
- update_preview_icon(current_tab != 2)
+ update_preview_icon(current_tab)
var/list/dat = list("
")
dat += "Character Settings"
@@ -2544,6 +2544,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if(custom_speech_verb != "default")
character.dna.species.say_mod = custom_speech_verb
+ //todo: make limb features copy to the person
SEND_SIGNAL(character, COMSIG_HUMAN_PREFS_COPIED_TO, src, icon_updates, roundstart_checks)
diff --git a/code/modules/mob/dead/new_player/preferences_setup.dm b/code/modules/mob/dead/new_player/preferences_setup.dm
index 9a0d9f9242..812f9ee58e 100644
--- a/code/modules/mob/dead/new_player/preferences_setup.dm
+++ b/code/modules/mob/dead/new_player/preferences_setup.dm
@@ -24,7 +24,8 @@
features = random_features(pref_species?.id, gender)
age = rand(AGE_MIN,AGE_MAX)
-/datum/preferences/proc/update_preview_icon(equip_job = TRUE)
+/datum/preferences/proc/update_preview_icon(current_tab)
+ var/equip_job = (current_tab != 2)
// Determine what job is marked as 'High' priority, and dress them up as such.
var/datum/job/previewJob = get_highest_job()
@@ -43,9 +44,13 @@
mannequin.add_overlay(mutable_appearance('modular_citadel/icons/ui/backgrounds.dmi', bgstate, layer = SPACE_LAYER))
copy_to(mannequin)
- if(previewJob && equip_job)
- mannequin.job = previewJob.title
- previewJob.equip(mannequin, TRUE, preference_source = parent)
+ if(current_tab == 3)
+ //give it its loadout if not on the appearance tab
+ SSjob.equip_loadout(parent.mob, mannequin, FALSE, bypass_prereqs = TRUE, force_equip = TRUE)
+ else
+ if(previewJob && equip_job)
+ mannequin.job = previewJob.title
+ previewJob.equip(mannequin, TRUE, preference_source = parent)
COMPILE_OVERLAYS(mannequin)
parent.show_character_previews(new /mutable_appearance(mannequin))
From e2aeaf8a5b10aa17cf1d14a35dd4aedf4d92d9f6 Mon Sep 17 00:00:00 2001
From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com>
Date: Sun, 23 Aug 2020 21:55:21 +0100
Subject: [PATCH 2/3] dont need this anymore
---
code/controllers/subsystem/job.dm | 4 ++--
code/modules/mob/dead/new_player/preferences_setup.dm | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm
index 5177477756..4f59992ace 100644
--- a/code/controllers/subsystem/job.dm
+++ b/code/controllers/subsystem/job.dm
@@ -665,7 +665,7 @@ SUBSYSTEM_DEF(job)
message_admins(msg)
CRASH(msg)
-/datum/controller/subsystem/job/proc/equip_loadout(mob/dead/new_player/N, mob/living/M, equipbackpackstuff, bypass_prereqs = FALSE, force_equip = FALSE)
+/datum/controller/subsystem/job/proc/equip_loadout(mob/dead/new_player/N, mob/living/M, equipbackpackstuff, bypass_prereqs = FALSE)
var/mob/the_mob = N
if(!the_mob)
the_mob = M // cause this doesn't get assigned if player is a latejoiner
@@ -689,7 +689,7 @@ SUBSYSTEM_DEF(job)
if(!permitted)
continue
var/obj/item/I = new G.path
- if(!M.equip_to_slot_if_possible(I, G.slot, disable_warning = TRUE, bypass_equip_delay_self = TRUE, clothing_check = !force_equip)) // If the job's dresscode compliant, try to put it in its slot, first
+ if(!M.equip_to_slot_if_possible(I, G.slot, disable_warning = TRUE, bypass_equip_delay_self = TRUE)) // If the job's dresscode compliant, try to put it in its slot, first
if(iscarbon(M))
var/mob/living/carbon/C = M
var/obj/item/storage/backpack/B = C.back
diff --git a/code/modules/mob/dead/new_player/preferences_setup.dm b/code/modules/mob/dead/new_player/preferences_setup.dm
index 812f9ee58e..779699238b 100644
--- a/code/modules/mob/dead/new_player/preferences_setup.dm
+++ b/code/modules/mob/dead/new_player/preferences_setup.dm
@@ -46,7 +46,7 @@
if(current_tab == 3)
//give it its loadout if not on the appearance tab
- SSjob.equip_loadout(parent.mob, mannequin, FALSE, bypass_prereqs = TRUE, force_equip = TRUE)
+ SSjob.equip_loadout(parent.mob, mannequin, FALSE, bypass_prereqs = TRUE)
else
if(previewJob && equip_job)
mannequin.job = previewJob.title
From 8f6c353ad0cd6a21242cad75aff723af1cc0dc62 Mon Sep 17 00:00:00 2001
From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com>
Date: Sat, 5 Sep 2020 21:35:02 +0100
Subject: [PATCH 3/3] memory leak bad
---
code/controllers/subsystem/job.dm | 12 +++++++++---
code/modules/client/preferences.dm | 2 --
.../modules/mob/dead/new_player/preferences_setup.dm | 2 +-
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm
index 4f59992ace..e61a3b3854 100644
--- a/code/controllers/subsystem/job.dm
+++ b/code/controllers/subsystem/job.dm
@@ -665,7 +665,7 @@ SUBSYSTEM_DEF(job)
message_admins(msg)
CRASH(msg)
-/datum/controller/subsystem/job/proc/equip_loadout(mob/dead/new_player/N, mob/living/M, equipbackpackstuff, bypass_prereqs = FALSE)
+/datum/controller/subsystem/job/proc/equip_loadout(mob/dead/new_player/N, mob/living/M, equipbackpackstuff, bypass_prereqs = FALSE, can_drop = TRUE)
var/mob/the_mob = N
if(!the_mob)
the_mob = M // cause this doesn't get assigned if player is a latejoiner
@@ -694,9 +694,15 @@ SUBSYSTEM_DEF(job)
var/mob/living/carbon/C = M
var/obj/item/storage/backpack/B = C.back
if(!B || !SEND_SIGNAL(B, COMSIG_TRY_STORAGE_INSERT, I, null, TRUE, TRUE)) // Otherwise, try to put it in the backpack, for carbons.
- I.forceMove(get_turf(C))
+ if(can_drop)
+ I.forceMove(get_turf(C))
+ else
+ qdel(I)
else if(!M.equip_to_slot_if_possible(I, SLOT_IN_BACKPACK, disable_warning = TRUE, bypass_equip_delay_self = TRUE)) // Otherwise, try to put it in the backpack
- I.forceMove(get_turf(M)) // If everything fails, just put it on the floor under the mob.
+ if(can_drop)
+ I.forceMove(get_turf(M)) // If everything fails, just put it on the floor under the mob.
+ else
+ qdel(I)
/datum/controller/subsystem/job/proc/FreeRole(rank)
if(!rank)
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index 7debbff4d9..609733ffa7 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -2544,8 +2544,6 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if(custom_speech_verb != "default")
character.dna.species.say_mod = custom_speech_verb
- //todo: make limb features copy to the person
-
SEND_SIGNAL(character, COMSIG_HUMAN_PREFS_COPIED_TO, src, icon_updates, roundstart_checks)
//let's be sure the character updates
diff --git a/code/modules/mob/dead/new_player/preferences_setup.dm b/code/modules/mob/dead/new_player/preferences_setup.dm
index 779699238b..abce0954a4 100644
--- a/code/modules/mob/dead/new_player/preferences_setup.dm
+++ b/code/modules/mob/dead/new_player/preferences_setup.dm
@@ -46,7 +46,7 @@
if(current_tab == 3)
//give it its loadout if not on the appearance tab
- SSjob.equip_loadout(parent.mob, mannequin, FALSE, bypass_prereqs = TRUE)
+ SSjob.equip_loadout(parent.mob, mannequin, FALSE, bypass_prereqs = TRUE, can_drop = FALSE)
else
if(previewJob && equip_job)
mannequin.job = previewJob.title