Skip to content

Commit

Permalink
Modular initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ImJustKisik committed Jan 20, 2025
1 parent 8cb21fe commit f08f8d1
Show file tree
Hide file tree
Showing 46 changed files with 2,351 additions and 50 deletions.
3 changes: 1 addition & 2 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@
#include "code\controllers\subsystems\shuttle.dm"
#include "code\controllers\subsystems\skybox.dm"
#include "code\controllers\subsystems\spacedrift.dm"
#include "code\controllers\subsystems\supply.dm"
#include "code\controllers\subsystems\throwing.dm"
#include "code\controllers\subsystems\ticker.dm"
#include "code\controllers\subsystems\timer.dm"
Expand Down Expand Up @@ -2553,7 +2552,6 @@
#include "code\modules\modular_computers\file_system\programs\generic\records.dm"
#include "code\modules\modular_computers\file_system\programs\generic\reports.dm"
#include "code\modules\modular_computers\file_system\programs\generic\scanner.dm"
#include "code\modules\modular_computers\file_system\programs\generic\supply.dm"
#include "code\modules\modular_computers\file_system\programs\generic\wordprocessor.dm"
#include "code\modules\modular_computers\file_system\programs\medical\suit_sensors.dm"
#include "code\modules\modular_computers\file_system\programs\research\ai_restorer.dm"
Expand Down Expand Up @@ -3430,6 +3428,7 @@
#include "mods\_master_files\code\modules\mob\living\life.dm"
#include "mods\_master_files\code\modules\mob\living\carbon\human\human_helpers.dm"
#include "mods\_master_files\code\modules\mob\new_player\new_player.dm"
#include "mods\_master_files\code\modules\overmap\___________overmap_override.dm"
#include "mods\_master_files\code\modules\overmap\distress.dm"
#include "mods\_master_files\code\modules\overmap\panicbutton.dm"
#include "mods\_master_files\code\modules\power\gravitygenerator.dm"
Expand Down
3 changes: 3 additions & 0 deletions code/__defines/culture.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
#define FACTION_OTHER "Other Faction"
#define FACTION_TEST_SUBJECTS "Test Subjects"
#define FACTION_SPACECOPS "Sol Federal Police"
// [SIERRA-ADD]
#define FACTION_INDEPENDENT "Independent"
// [/SIERRA-ADD]

#define HOME_SYSTEM_EARTH "Earth"
#define HOME_SYSTEM_LUNA "Luna"
Expand Down
4 changes: 4 additions & 0 deletions code/__defines/lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
#define LAZYADDASSOC(L, K, V) if(!L) { L = list(); } L[K] += V;
// Removes the value V from the item K, if the item K is empty will remove it from the list, if the list is empty will set the list to null
#define LAZYREMOVEASSOC(L, K, V) if(L) { if(L[K]) { L[K] -= V; if(!length(L[K])) L -= K; } if(!length(L)) L = null; }
// Adds value to the existing value of a key
#define LAZYAPLUS(L,K,V) if(!L) { L = list(); } if (!L[K]) { L[K] = 0; } L[K] += V;
// Subtracts value from the existing value of a key
#define LAZYAMINUS(L,K,V) if(L && L[K]) { L[K] -= V; if(!LAZYLEN(L[K])) { L -= K } }

/****
* Binary search sorted insert
Expand Down
42 changes: 42 additions & 0 deletions code/_helpers/lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -883,3 +883,45 @@ Checks if a list has the same entries and values as an element of big.
map["[entry.name] [index]"] = entry
else
map[entry.name] = entry


/**
* This proc attempts to decode a given string into a JSON object.
* If the given parameter is already a list, it is returned as is.
* If the given parameter is not a string or a list, it is wrapped in a list.
* @param t The string or list to decode.
* @return A list containing the decoded JSON object, or the original list if it was already a list.
*/
/proc/try_json_decode(t)
. = list()
if(istext(t))
// Try to decode the given string into a JSON object.
. = json_decode(t)
else if(islist(t))
// If the given parameter is already a list, just return it.
. = t
else if(t)
// If the given parameter is not a string or a list, wrap it in a list.
. += t

/**
* This proc recursively calculates the length of a given list.
* If a given element of the list is itself a list, it is recursively called on that element.
* @param L The list to calculate the length of.
* @return The length of the list, including all sublists.
*/
/proc/RecursiveLen(list/L)
. = 0
if(istext(L))
// If the given parameter is a string, attempt to decode it into a JSON object.
L = try_json_decode(L)
if(length(L))
// Add the length of the list to the total length.
. += length(L)
for(var/list/i in L)
if(islist(i))
// If a given element of the list is itself a list, recursively call this proc on it.
. += RecursiveLen(i)
else if(islist(L[i]))
// If a given element of the list is itself a list, recursively call this proc on it.
. += RecursiveLen(L[i])
8 changes: 7 additions & 1 deletion code/_helpers/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -537,10 +537,16 @@ Turf and target are seperate in case you want to teleport some distance from a t
*
* Returns a list of atoms.
*/
/atom/proc/GetAllContents(searchDepth = 5)


/atom/proc/GetAllContents(searchDepth = 5, include_self = FALSE)

RETURN_TYPE(/list)
var/list/toReturn = list()

if(include_self)
toReturn += src

for(var/atom/part in contents)
toReturn += part
if(length(part.contents) && searchDepth)
Expand Down
77 changes: 77 additions & 0 deletions code/game/jobs/access_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -474,3 +474,80 @@ var/global/const/access_merchant = "ACCESS_MERCHANT" //301
id = access_merchant
desc = "Merchant"
access_type = ACCESS_TYPE_NONE


/**
* Supply faction link access levels
* These are used by the supply console to determine which factions an user can link to
*/
#ifdef SUPPLY_LINKS
/**
* SolGov faction link access level
*/
/var/const/access_supplylink_solgov = "ACCESS_SUPPLY_LINK_SOLGOV"
/datum/access/supplylink_solgov
id = access_supplylink_solgov
desc = "Supply Console - SolGov Link"
region = ACCESS_REGION_SUPPLY
access_type = ACCESS_TYPE_NONE

/**
* TerraGov faction link access level
*/
/var/const/access_supplylink_terragov = "ACCESS_SUPPLY_LINK_TERRAGOV"
/datum/access/supplylink_terragov
id = access_supplylink_terragov
desc = "Supply Console - TerraGov Link"
region = ACCESS_REGION_SUPPLY
access_type = ACCESS_TYPE_NONE

/**
* ISC faction link access level
*/
/var/const/access_supplylink_isc = "ACCESS_SUPPLY_LINK_ISC"
/datum/access/supplylink_isc
id = access_supplylink_isc
desc = "Supply Console - ISC Link"
region = ACCESS_REGION_SUPPLY
access_type = ACCESS_TYPE_NONE

/**
* Nanotrasen faction link access level
*/
/var/const/access_supplylink_nanotrasen = "ACCESS_SUPPLY_LINK_NANOTRASEN"
/datum/access/supplylink_nanotrasen
id = access_supplylink_nanotrasen
desc = "Supply Console - Nanotrasen Link"
region = ACCESS_REGION_SUPPLY
access_type = ACCESS_TYPE_NONE

/**
* Cybersun faction link access level
*/
/var/const/access_supplylink_cybersun = "ACCESS_SUPPLY_LINK_CYBERSUN"
/datum/access/supplylink_cybersun
id = access_supplylink_cybersun
desc = "Supply Console - Cybersun Link"
region = ACCESS_REGION_SUPPLY
access_type = ACCESS_TYPE_NONE

/**
* OBS faction link access level
*/
/var/const/access_supplylink_obs = "ACCESS_SUPPLY_LINK_OBS"
/datum/access/supplylink_obs
id = access_supplylink_obs
desc = "Supply Console - OBS Link"
region = ACCESS_REGION_SUPPLY
access_type = ACCESS_TYPE_NONE

/**
* Reborn Christian Church faction link access level
*/
/var/const/access_supplylink_reborn_church = "ACCESS_SUPPLY_LINK_REBORN_CHURCH"
/datum/access/supplylink_reborn_church
id = access_supplylink_reborn_church
desc = "Supply Console - Reborn Christian Church Link"
region = ACCESS_REGION_SUPPLY
access_type = ACCESS_TYPE_NONE
#endif
2 changes: 2 additions & 0 deletions code/game/machinery/status_display.dm
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@
return ""
return "[pad_left(num2text((timeleft / 60) % 60), 2, "0")]:[pad_left(num2text(timeleft % 60), 2, "0")]"

/*
/obj/machinery/status_display/proc/get_supply_shuttle_timer()
var/datum/shuttle/autodock/ferry/supply/shuttle = SSsupply.shuttle
if (!shuttle)
Expand All @@ -262,6 +263,7 @@
return "Late"
return "[pad_left(num2text((timeleft / 60) % 60), 2, "0")]:[pad_left(num2text(timeleft % 60), 2, "0")]"
return ""
*/

/obj/machinery/status_display/proc/remove_display()
if(length(overlays))
Expand Down
9 changes: 8 additions & 1 deletion code/game/machinery/supply_display.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
/// ==============================================================================
/// TODO: DELETE THIS FROM EVERYWHERE - part of Eris Cargo modpack
/// ==============================================================================



/obj/machinery/status_display/supply_display
ignore_friendc = 1

/*
/obj/machinery/status_display/supply_display/update()
if(!..() && mode == STATUS_DISPLAY_CUSTOM)
message1 = "CARGO"
Expand Down Expand Up @@ -32,3 +38,4 @@
mode = STATUS_DISPLAY_CUSTOM
else
..(signal)
*/
6 changes: 3 additions & 3 deletions code/modules/events/event_container.dm
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ var/global/list/severity_to_string = list(EVENT_LEVEL_MUNDANE = "Mundane", EVENT
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Computer Update", /datum/event/computer_update, 20),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Brand Intelligence", /datum/event/brand_intelligence, 10, list(ASSIGNMENT_JANITOR = 10), 1),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Camera Damage", /datum/event/camera_damage, 20, list(ASSIGNMENT_ENGINEER = 10)),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Economic News", /datum/event/economic_event, 300),
//new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Economic News", /datum/event/economic_event, 300),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Lost Carp", /datum/event/mob_spawning/carp, 20, list(ASSIGNMENT_SECURITY = 10), 1),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Money Hacker", /datum/event/money_hacker, 0, list(ASSIGNMENT_ANY = 4), 1, 10, 25),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Money Lotto", /datum/event/money_lotto, 0, list(ASSIGNMENT_ANY = 1), 1, 5, 15),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Mundane News", /datum/event/mundane_news, 300),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Shipping Error", /datum/event/shipping_error , 30, list(ASSIGNMENT_ANY = 2), 0),
//new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Shipping Error", /datum/event/shipping_error , 30, list(ASSIGNMENT_ANY = 2), 0),
new /datum/event_meta/no_overmap(EVENT_LEVEL_MUNDANE, "Space Dust", /datum/event/dust , 30, list(ASSIGNMENT_ENGINEER = 10)),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Sensor Suit Jamming", /datum/event/sensor_suit_jamming, 50, list(ASSIGNMENT_MEDICAL = 20, ASSIGNMENT_AI = 20), 1),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Trivial News", /datum/event/trivial_news, 400),
Expand All @@ -148,7 +148,7 @@ var/global/list/severity_to_string = list(EVENT_LEVEL_MUNDANE = "Mundane", EVENT
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Drone Malfunction", /datum/event/rogue_maint_drones, 10, list(ASSIGNMENT_ENGINEER = 30)),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Disposals Explosion", /datum/event/disposals_explosion, 50, list(ASSIGNMENT_ENGINEER = 40)),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Brain Expansion", /datum/event/brain_expansion, 20, list(ASSIGNMENT_SCIENTIST = 20)),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Mail Delivery", /datum/event/mail, 5, list(ASSIGNMENT_ANY = 1), 1),
//new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Mail Delivery", /datum/event/mail, 5, list(ASSIGNMENT_ANY = 1), 1),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Whale Migration", /datum/event/mob_spawning/whale_migration, 10)
)

Expand Down
3 changes: 2 additions & 1 deletion code/modules/events/mail.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/datum/event/mail
// This event is actually intended to end when the mail has been spawned on the shuttle, but have a "timeout" just in case
endWhen = 3000

/*
var/list/possible_gifts = list(
/obj/item/device/flashlight/lamp/lava,
/obj/item/storage/fancy/crayons,
Expand Down Expand Up @@ -90,3 +90,4 @@
return FALSE
return TRUE
*/
2 changes: 2 additions & 0 deletions code/modules/events/shipping_error.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/datum/event/shipping_error/start()
/*
var/datum/supply_order/O = new /datum/supply_order()
O.ordernum = rand(1, 9000)
var/randomtimeofday = rand(0, 864000) // 24 hours in deciseconds
Expand All @@ -7,3 +8,4 @@
O.orderedby = random_name(pick(MALE,FEMALE), species = SPECIES_HUMAN)
SSsupply.shoppinglist += O
SSsupply.points = max(0, SSsupply.points - O.object.cost)
*/
22 changes: 12 additions & 10 deletions code/modules/item_worth/value_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
for(var/a in contents)
. += get_value(a)

/obj/machinery/Value()
/obj/machinery/Value(base)
. = ..()
if(MACHINE_IS_BROKEN(src))
. *= 0.5
. = round(.)

/obj/structure/barricade/Value()
/obj/structure/barricade/Value(base)
return material.value

/obj/structure/bed/Value()
Expand All @@ -21,37 +21,39 @@
/obj/item/slime_extract/Value(base)
return base * Uses

/obj/item/ammo_casing/Value()
/obj/item/ammo_casing/Value(base)
if(!BB)
return 1
return ..()

/obj/item/reagent_containers/Value()
/obj/item/reagent_containers/Value(base)
. = ..()
if(reagents)
for(var/a in reagents.reagent_list)
var/datum/reagent/reg = a
. += reg.Value() * reg.volume
. = round(.)

/datum/reagent/proc/Value()
/datum/reagent/proc/Value(base)
return value

/obj/item/stack/Value(base)
return base * amount

/obj/item/stack/material/Value()
/obj/item/stack/material/Value(base)
if(!material)
return ..()
return material.value * amount
. = material.value * amount
if(reinf_material)
. += reinf_material.value * amount

/obj/item/ore/Value()
/obj/item/ore/Value(base)
return material ? material.value : 0

/obj/item/material/Value()
/obj/item/material/Value(base)
return material.value * worth_multiplier

/obj/item/spacecash/Value()
/obj/item/spacecash/Value(base)
return worth

/mob/living/carbon/human/Value(base)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "miner robot module"
display_name = "Miner"
subsystems = list(
/datum/nano_module/supply
//datum/nano_module/supply //[SIERRA-REMOVE]
)
channels = list(
"Supply" = TRUE,
Expand Down
4 changes: 4 additions & 0 deletions code/modules/modular_computers/file_system/computer_file.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,7 @@ var/global/file_uid = 0
temp.filename += "(Copy)"
temp.filetype = filetype
return temp

// Called by hard drive when program is added to the computer
/datum/computer_file/proc/OnStoreFile(obj/item/stock_parts/computer/hard_drive/HD)
return
9 changes: 7 additions & 2 deletions code/modules/shuttles/shuttle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,24 @@
new /datum/shuttle_log(src)
if(flags & SHUTTLE_FLAGS_PROCESS)
SSshuttle.process_shuttles += src

/* [SIERRA-REMOVE]
if(flags & SHUTTLE_FLAGS_SUPPLY)
if(SSsupply.shuttle)
CRASH("A supply shuttle is already defined.")
SSsupply.shuttle = src
*/ //[/SIERRA-REMOVE]


/datum/shuttle/Destroy()
current_location = null

SSshuttle.shuttles -= src.name
SSshuttle.process_shuttles -= src
SSshuttle.shuttle_logs -= src
if(SSsupply.shuttle == src)
SSsupply.shuttle = null
// [SIERRA-REMOVE]
//if(SSsupply.shuttle == src)
// SSsupply.shuttle = null

. = ..()

Expand Down
3 changes: 3 additions & 0 deletions code/modules/shuttles/shuttle_supply.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/datum/shuttle/autodock/ferry/supply

/*
var/away_location = 1 //the location to hide at while pretending to be in-transit
var/late_chance = 80
var/max_late_time = (30 SECONDS)
Expand Down Expand Up @@ -76,3 +78,4 @@
/datum/shuttle/autodock/ferry/supply/proc/eta_seconds()
var/ticksleft = arrive_time - world.time
return max(0, round(ticksleft/10,1))
*/
Loading

0 comments on commit f08f8d1

Please sign in to comment.