Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:NebulaSS13/Nebula into cruxdev
Browse files Browse the repository at this point in the history
  • Loading branch information
MistakeNot4892 committed Feb 3, 2024
2 parents bc5732d + f177692 commit 919a4e0
Show file tree
Hide file tree
Showing 252 changed files with 2,574 additions and 1,241 deletions.
8 changes: 4 additions & 4 deletions code/__defines/machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ var/global/defer_powernet_rebuild = 0 // True if net rebuild will be called
#define MCS_BLOCK 2 // Failed to change, but action was performed

#define FABRICATOR_EXTRA_COST_FACTOR 1.25
#define FAB_HACKED 1
#define FAB_DISABLED 2
#define FAB_SHOCKED 4
#define FAB_BUSY 8
#define FAB_HACKED BITFLAG(0)
#define FAB_DISABLED BITFLAG(1)
#define FAB_SHOCKED BITFLAG(2)
#define FAB_BUSY BITFLAG(3)

#define PART_CPU /obj/item/stock_parts/computer/processor_unit // CPU. Without it the computer won't run. Better CPUs can run more programs at once.
#define PART_NETWORK /obj/item/stock_parts/computer/network_card // Network Card component of this computer. Allows connection to network
Expand Down
1 change: 1 addition & 0 deletions code/__defines/tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#define TOOL_SURGICAL_DRILL /decl/tool_archetype/surgical_drill

// Tool qualities (positive multplier)
#define TOOL_QUALITY_NONE 0
#define TOOL_QUALITY_WORST 0.1
#define TOOL_QUALITY_BAD 0.5
#define TOOL_QUALITY_MEDIOCRE 0.75
Expand Down
9 changes: 9 additions & 0 deletions code/controllers/subsystems/configuration.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ SUBSYSTEM_DEF(configuration)
load_sql()
load_event()

for(var/client/C)
C.update_post_config_load()

/client/proc/update_post_config_load()
if(get_config_value(/decl/config/toggle/allow_character_comments))
verbs |= /client/proc/view_character_information
else
verbs -= /client/proc/view_character_information

/datum/controller/subsystem/configuration/proc/write_default_configuration(var/list/specific_files, var/modify_write_prefix)

if(!specific_files)
Expand Down
188 changes: 188 additions & 0 deletions code/controllers/subsystems/initialization/character_info.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
// Holder subsystem for character comment records.
SUBSYSTEM_DEF(character_info)
name = "Character Information"
flags = SS_NEEDS_SHUTDOWN
init_order = SS_INIT_EARLY
wait = 1 SECOND
var/static/comments_source = "data/character_info/"
var/list/_comment_holders_by_id = list()
var/list/_ids_to_save = list()

/datum/controller/subsystem/character_info/Initialize()
. = ..()
if(!get_config_value(/decl/config/toggle/allow_character_comments))
report_progress("Skipping mass load of character records as character comments are disabled.")
return
if(!fexists(comments_source))
report_progress("Character information directory [comments_source] does not exist, no character comments will be saved or loaded.")
return
var/loaded_json_manifest = load_text_from_directory(comments_source, ".json")
if(!islist(loaded_json_manifest) || !length(loaded_json_manifest["files"]))
return
var/list/loaded_files = loaded_json_manifest["files"]
var/loaded_comments = 0
for(var/loaded_file in loaded_files)
var/datum/character_information/comments = load_record(loaded_files[loaded_file])
if(!istext(comments.record_id))
PRINT_STACK_TRACE("Deserialized character information had invalid id '[comments.record_id || "NULL"]'!")
continue

// Remove any pre-created records (early joiners, etc.)
if(_comment_holders_by_id[comments.record_id])
var/old_record = _comment_holders_by_id[comments.record_id]
_comment_holders_by_id -= comments.record_id
qdel(old_record)

comments.file_location = loaded_file
_comment_holders_by_id[comments.record_id] = comments
loaded_comments += length(comments.comments)
report_progress("Loaded [loaded_comments] record\s for [length(_comment_holders_by_id)] character\s.")

/datum/controller/subsystem/character_info/Shutdown()
. = ..()
for(var/id in _comment_holders_by_id)
save_record(id)

/datum/controller/subsystem/character_info/stat_entry(msg)
..("R:[_comment_holders_by_id.len]Q:[_ids_to_save.len][msg]")

/datum/controller/subsystem/character_info/fire(resumed = FALSE, no_mc_tick = FALSE)
while(_ids_to_save.len)
var/id = _ids_to_save[1]
_ids_to_save -= id
save_record(id)
if(TICK_CHECK)
return

/datum/controller/subsystem/character_info/proc/queue_to_save(var/record_id)
if(istext(record_id) && length(record_id))
_ids_to_save |= record_id

/datum/controller/subsystem/character_info/proc/save_record(var/record_id)
if(!istext(record_id) || !record_id)
return
var/datum/character_information/comments = get_record(record_id, TRUE)
if(!istype(comments))
return
if(!comments.file_location)
comments.file_location = "[comments_source][ckey(comments.record_id)].json"
try
if(fexists(comments.file_location))
fdel(comments.file_location)
to_file(file(comments.file_location), comments.serialize_to_json())
catch(var/exception/E)
PRINT_STACK_TRACE("Exception when writing out character information file to [comments?.file_location || "NULL"]: [E]")

/datum/controller/subsystem/character_info/proc/load_record(var/load_from)
var/datum/character_information/comments = new(cached_json_decode(load_from))
_comment_holders_by_id[comments.record_id] = comments
return comments

/datum/controller/subsystem/character_info/proc/reload_record(var/record_id)
var/datum/character_information/comments = get_record(record_id, TRUE)
if(comments && comments.file_location && fexists(comments.file_location))
var/reload_from = comments.file_location
_comment_holders_by_id -= comments.record_id
qdel(comments)
try
. = load_record(safe_file2text(reload_from))
catch(var/exception/E)
PRINT_STACK_TRACE("Exception when reloading record from [reload_from]: [E]")

/datum/controller/subsystem/character_info/proc/clear_record(var/record_id)
var/datum/character_information/comments = get_record(record_id, TRUE)
if(comments)
comments.comments.Cut()
comments.ic_info = null
comments.ooc_info = null

/datum/controller/subsystem/character_info/proc/get_record_id(var/record_id)
return trim(lowertext(record_id))

/datum/controller/subsystem/character_info/proc/get_record(var/record_id, var/override_prefs, var/discard_archived_record)
record_id = get_record_id(record_id)
if(!record_id)
CRASH("Attempt to retrieve null character information ID.")
var/datum/character_information/comments = _comment_holders_by_id[record_id]
if(istype(comments) && (override_prefs || (get_config_value(/decl/config/toggle/allow_character_comments) && comments.allow_comments) || comments.show_info_on_examine))
return comments

/datum/controller/subsystem/character_info/proc/get_or_create_record(var/record_id, var/override_prefs)
. = get_record(record_id, override_prefs)
if(!. && initialized)
// Let's assume they'll populate it if so desired.
var/datum/character_information/comments = new
comments.record_id = get_record_id(record_id)
_comment_holders_by_id[comments.record_id] = comments
. = comments

/datum/controller/subsystem/character_info/proc/search_records(var/search_for)
search_for = ckey(lowertext(trim(search_for)))
for(var/id in _comment_holders_by_id)
var/datum/character_information/comments = _comment_holders_by_id[id]
for(var/checkstring in list(comments.name, comments.ckey, comments.record_id))
if(findtext(ckey(lowertext(trim(checkstring))), search_for) > 0)
LAZYADD(., comments)
break

/datum/controller/subsystem/character_info/Topic(href, href_list)
. = ..()
if(!. && href_list["download_manifest"] && usr && check_rights(R_ADMIN))
try
var/dump_file_name = "[comments_source]dump_character_manifest.html"
if(fexists(dump_file_name))
fdel(dump_file_name)
text2file(JOINTEXT(SScharacter_info.get_character_manifest_html(apply_striping = FALSE)), dump_file_name)
if(fexists(dump_file_name))
direct_output(usr, ftp(dump_file_name, "dump_manifest.html"))
return TOPIC_HANDLED
catch(var/exception/E)
log_debug("Exception when dumping character relationship manifest: [E]")

#define COMMENT_CANDYSTRIPE_ONE "#343434"
#define COMMENT_CANDYSTRIPE_TWO "#454545"
/datum/controller/subsystem/character_info/proc/get_character_manifest_html(var/apply_striping = TRUE)
var/list/records_with_an_entry = list()
for(var/id in _comment_holders_by_id)
var/datum/character_information/comments = _comment_holders_by_id[id]
for(var/datum/character_comment/comment in comments.comments)
if(comment.is_stale())
continue
records_with_an_entry |= comment.author_id
sortTim(records_with_an_entry, /proc/cmp_text_asc)
. = list("<table>")
if(apply_striping)
. += "<tr bgcolor = '[COMMENT_CANDYSTRIPE_ONE]'>"
else
. += "<tr>"
. += "<th width = '170px'><center>Character Relationship Matrix</center></th>"
for(var/column_id in records_with_an_entry)
var/datum/character_information/column = _comment_holders_by_id[column_id]
. += "<td width = '360px' style=\"border: 1px solid #272727;\"><center>[column.char_name]<br/><small><i>[column.ckey]</i></small></center></td>"
. += "</tr>"
var/ticker = FALSE
for(var/row_id in records_with_an_entry)
if(apply_striping)
. += "<tr bgcolor = '[ticker ? COMMENT_CANDYSTRIPE_ONE : COMMENT_CANDYSTRIPE_TWO]'>"
ticker = !ticker
else
. += "<tr>"
var/datum/character_information/row = _comment_holders_by_id[row_id]
. += "<td width = '170px' style=\"border: 1px solid #272727;\"><center>[row.char_name]<br/><small><i>[row.ckey]</i></small></center></td>"
for(var/column_id in records_with_an_entry)
var/datum/character_information/column = _comment_holders_by_id[column_id]
var/found_comment = FALSE
for(var/datum/character_comment/comment in column.comments)
if(comment.author_id == row_id && !comment.is_stale())
found_comment = TRUE
var/mood_title = comment.main_mood.name
if(comment.border_mood)
mood_title = "[mood_title] ([comment.border_mood.name])"
. += "<td title = '[mood_title]' width = '360px' style=\"border: 1px solid [comment.border_mood ? comment.border_mood.bg_color : comment.main_mood.fg_color];\" bgcolor = '[comment.main_mood.bg_color]'><center><font color = '[comment.main_mood.fg_color]'>[comment.body]</font></center></td>"
break
if(!found_comment)
. += "<td width = '360px' style=\"border: 1px solid #272727;\"></td>"
. += "</tr>"
. += "</table>"
#undef COMMENT_CANDYSTRIPE_ONE
#undef COMMENT_CANDYSTRIPE_TWO
12 changes: 11 additions & 1 deletion code/datums/config/config_types/config_game_option.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
/decl/config/toggle/assistant_maint,
/decl/config/toggle/ghost_interaction,
/decl/config/toggle/aliens_allowed,
/decl/config/toggle/ninjas_allowed
/decl/config/toggle/ninjas_allowed,
/decl/config/toggle/allow_character_comments,
/decl/config/num/hide_comments_older_than
)

/decl/config/num/movement_human
Expand Down Expand Up @@ -162,3 +164,11 @@
/decl/config/toggle/ninjas_allowed
uid = "ninjas_allowed"
desc = "Remove the # to let ninjas spawn."

/decl/config/toggle/allow_character_comments
uid = "allow_character_comments"
desc = "Remove the # to allow people to leave public comments on each other's characters via the comments system."

/decl/config/num/hide_comments_older_than
uid = "hide_comments_older_than"
desc = "Specify a number of days after which to hide comments on public profiles (to avoid bloat from retired characters)."
6 changes: 4 additions & 2 deletions code/datums/position_point_vector.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
pixel_y = _pixel_y

/datum/position/proc/return_turf()
return locate(x, y, z)
var/turf/T = locate(x, y, z)
return T?.resolve_to_actual_turf()

/datum/position/proc/return_px()
return pixel_x
Expand Down Expand Up @@ -111,7 +112,8 @@
AM.pixel_y = return_py()

/datum/point/proc/return_turf()
return locate(CEILING(x / world.icon_size), CEILING(y / world.icon_size), z)
var/turf/T = locate(CEILING(x / world.icon_size), CEILING(y / world.icon_size), z)
return T?.resolve_to_actual_turf()

/datum/point/proc/return_coordinates() //[turf_x, turf_y, z]
return list(CEILING(x / world.icon_size), CEILING(y / world.icon_size), z)
Expand Down
6 changes: 3 additions & 3 deletions code/datums/supplypacks/galley.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
contains = list(/obj/item/chems/condiment/flour = 6,
/obj/item/chems/drinks/milk = 4,
/obj/item/chems/drinks/soymilk = 2,
/obj/item/storage/fancy/egg_box = 2,
/obj/item/storage/box/fancy/egg_box = 2,
/obj/item/chems/food/tofu = 4,
/obj/item/chems/food/meat = 4,
/obj/item/chems/condiment/enzyme = 1
Expand Down Expand Up @@ -45,7 +45,7 @@

/decl/hierarchy/supply_pack/galley/eggs
name = "Perishables - Eggs"
contains = list(/obj/item/storage/fancy/egg_box = 2)
contains = list(/obj/item/storage/box/fancy/egg_box = 2)
containertype = /obj/structure/closet/crate/freezer
containername = "egg crate"

Expand Down Expand Up @@ -93,7 +93,7 @@
/obj/item/chems/drinks/bottle/patron,
/obj/item/chems/drinks/bottle/goldschlager,
/obj/item/chems/drinks/bottle/agedwhiskey,
/obj/item/storage/fancy/cigarettes/dromedaryco,
/obj/item/storage/box/fancy/cigarettes/dromedaryco,
/obj/random/lipstick,
/obj/item/chems/drinks/bottle/small/ale = 2,
/obj/item/chems/drinks/bottle/small/beer = 4,
Expand Down
2 changes: 1 addition & 1 deletion code/datums/supplypacks/nonessent.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/decl/hierarchy/supply_pack/nonessent/artscrafts
name = "Art - Arts and Crafts supplies"
contains = list(
/obj/item/storage/fancy/crayons,
/obj/item/storage/box/fancy/crayons,
/obj/item/camera,
/obj/item/camera_film = 2,
/obj/item/storage/photo_album,
Expand Down
2 changes: 1 addition & 1 deletion code/datums/trading/traders/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ They sell generic supplies and ask for generic supplies.
/obj/item/storage/backpack/dufflebag/syndie = TRADER_BLACKLIST_SUB,
/obj/item/storage/belt/champion = TRADER_THIS_TYPE,
/obj/item/storage/briefcase = TRADER_THIS_TYPE,
/obj/item/storage/fancy = TRADER_SUBTYPES_ONLY,
/obj/item/storage/box/fancy = TRADER_SUBTYPES_ONLY,
/obj/item/storage/laundry_basket = TRADER_THIS_TYPE,
/obj/item/storage/secure/briefcase = TRADER_THIS_TYPE,
/obj/item/storage/plants = TRADER_THIS_TYPE,
Expand Down
4 changes: 3 additions & 1 deletion code/datums/trading/traders/food.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
var/obj/item/pizzabox/box = new(location)
M.forceMove(box)
box.pizza = M
box.boxtag = "A special order from [origin]"
box.box_tag = "A special order from [origin]!"
box.update_strings()
box.update_icon()

/datum/trader/ship/chinese
name = "Chinese Restaurant"
Expand Down
2 changes: 1 addition & 1 deletion code/datums/trading/traders/goods.dm
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ Sells devices, odds and ends, and medical stuff
/obj/item/organ/internal/kidneys = TRADER_THIS_TYPE,
/obj/item/organ/internal/lungs = TRADER_THIS_TYPE,
/obj/item/organ/internal/heart = TRADER_THIS_TYPE,
/obj/item/storage/fancy/cigarettes = TRADER_ALL
/obj/item/storage/box/fancy/cigarettes = TRADER_ALL
)

possible_trading_items = list(
Expand Down
16 changes: 10 additions & 6 deletions code/datums/vending/stored_item.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@
var/list/instances //What items are actually stored
var/atom/storing_object

/datum/stored_items/New(var/atom/storing_object, var/path, var/name = null, var/amount = 0)
/datum/stored_items/New(atom/_storing_object, _path, _name, _amount = 1)
if(_storing_object)
storing_object = _storing_object
if(!istype(storing_object))
CRASH("Unexpected storing object.")
src.storing_object = storing_object
src.item_path = path
src.amount = amount
src.item_name = name || atom_info_repository.get_name_for(path)
CRASH("Unexpected storing object: [storing_object]")
if(_path)
item_path = _path
if(!ispath(item_path))
CRASH("Unexpected item path: [item_path || "NULL"]")
item_name = _name || atom_info_repository.get_name_for(item_path)
amount = _amount
..()

/datum/stored_items/Destroy()
Expand Down
18 changes: 8 additions & 10 deletions code/datums/vending/vending.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
*/

/datum/stored_items/vending_products
item_name = "generic" // Display name for the product
var/price = 0 // Price to buy one
var/display_color = null // Display color for vending machine listing
var/category = CAT_NORMAL // CAT_HIDDEN for contraband

/datum/stored_items/vending_products/New(var/atom/storing_object, var/path, var/name = null, var/amount = 0, var/price = 0, var/color = null, var/category = CAT_NORMAL)
..()
src.price = price
src.display_color = color
src.category = category
/// Display name for the product
item_name = "generic"
/// Price to buy one
var/price = 0
/// Display color for vending machine listing
var/display_color = null
// CAT_HIDDEN for contraband
var/category = CAT_NORMAL
2 changes: 1 addition & 1 deletion code/game/machinery/biogenerator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/obj/item/chems/drinks/milk/smallcarton = 30,
/obj/item/chems/drinks/milk = 50,
/obj/item/chems/food/meat/syntiflesh = 50,
/obj/item/storage/fancy/egg_box = 300),
/obj/item/storage/box/fancy/egg_box = 300),
"Nutrients" = list(
/obj/item/chems/glass/bottle/eznutrient = 60,
/obj/item/chems/glass/bottle/left4zed = 120,
Expand Down
Loading

0 comments on commit 919a4e0

Please sign in to comment.