mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-19 20:15:47 +01:00
ccea3ccf30
## About The Pull Request fixes `/datum/lootpanel` not being removed from SSlooting's backlog/processing when destroyed. another native reftracker W ``` [2026-06-04 15:54:59.739] REFSCANNER: native refscan complete for /datum/lootpanel ([0x21068f2e]), took 942 ms - === 2 finding(s)=== - [list] list #5085 [index 0] (len=1, refs=1) - [list_owner] datum #1977 (/datum/controller/subsystem/looting).processing -> list #5085 ``` also fixed a bug where SSlooting wouldn't really process after `backlog` was moved to `processing`. ## Why It's Good For The Game hard delete bad ## Changelog no player-facing changes
75 lines
1.5 KiB
Plaintext
75 lines
1.5 KiB
Plaintext
/**
|
|
* ## Loot panel
|
|
* A datum that stores info containing the contents of a turf.
|
|
* Handles opening the lootpanel UI and searching the turf for items.
|
|
*/
|
|
/datum/lootpanel
|
|
/// The owner of the panel
|
|
var/client/owner
|
|
/// The list of all search objects indexed.
|
|
var/list/datum/search_object/contents = list()
|
|
/// The list of search_objects needing processed
|
|
var/list/datum/search_object/to_image = list()
|
|
/// We've been notified about client version
|
|
var/notified = FALSE
|
|
/// The turf being searched
|
|
var/turf/source_turf
|
|
|
|
|
|
/datum/lootpanel/New(client/owner)
|
|
. = ..()
|
|
|
|
src.owner = owner
|
|
|
|
|
|
/datum/lootpanel/Destroy(force)
|
|
SSlooting.backlog -= src
|
|
SSlooting.processing -= src
|
|
reset_contents()
|
|
owner = null
|
|
source_turf = null
|
|
|
|
return ..()
|
|
|
|
|
|
/datum/lootpanel/ui_interact(mob/user, datum/tgui/ui)
|
|
ui = SStgui.try_update_ui(user, src, ui)
|
|
if(!ui)
|
|
ui = new(user, src, "LootPanel")
|
|
ui.set_autoupdate(FALSE)
|
|
ui.open()
|
|
|
|
|
|
/datum/lootpanel/ui_host(mob/user)
|
|
return source_turf
|
|
|
|
|
|
/datum/lootpanel/ui_close(mob/user)
|
|
. = ..()
|
|
|
|
UnregisterSignal(source_turf, list(COMSIG_ATOM_ENTERED, COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZED_ON))
|
|
source_turf = null
|
|
reset_contents()
|
|
|
|
|
|
/datum/lootpanel/ui_data(mob/user)
|
|
var/list/data = list()
|
|
|
|
data["contents"] = get_contents()
|
|
data["is_blind"] = !!user.is_blind()
|
|
data["searching"] = length(to_image)
|
|
|
|
return data
|
|
|
|
|
|
/datum/lootpanel/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
|
|
switch(action)
|
|
if("grab")
|
|
return grab(usr, params)
|
|
|
|
return FALSE
|