Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add artifact bag of holding #13964

Merged
merged 43 commits into from Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
6b126d2
working code
FlameArrow57 May 4, 2023
651338d
Merge branch 'master' into artifact-storage
FlameArrow57 May 27, 2023
440b229
merge fix
FlameArrow57 May 27, 2023
83f382c
some rework
FlameArrow57 May 27, 2023
6bd313b
Merge branch 'master' into artifact-storage
FlameArrow57 May 27, 2023
fc476e6
more changes
FlameArrow57 May 29, 2023
9f2ed84
parentheses
FlameArrow57 May 29, 2023
89a722e
Merge branch 'master' into artifact-storage
FlameArrow57 May 29, 2023
586deca
pocket stuff
FlameArrow57 May 29, 2023
21dd992
few changes
FlameArrow57 May 29, 2023
2994d61
fix eldritch storage
FlameArrow57 May 31, 2023
d08ad61
precursor storage
FlameArrow57 May 31, 2023
5ead3e2
pocket changes
FlameArrow57 May 31, 2023
7dfcf77
combination clean up
FlameArrow57 May 31, 2023
38ba9f3
fixes
FlameArrow57 May 31, 2023
10d8bac
wizard
FlameArrow57 Jun 1, 2023
113f3f4
runtime fix
FlameArrow57 Jun 1, 2023
f536c64
Merge branch 'master' into artifact-storage
FlameArrow57 Jun 2, 2023
011e711
small undo
FlameArrow57 Jun 2, 2023
d668008
some fixes
FlameArrow57 Jun 2, 2023
d8976e5
wearable storages
FlameArrow57 Jun 2, 2023
eeab8c3
small fix
FlameArrow57 Jun 2, 2023
5c4286b
improved singularity effect
FlameArrow57 Jun 2, 2023
8a49b19
logging
FlameArrow57 Jun 2, 2023
18da7b3
temporary removal
FlameArrow57 Jun 2, 2023
f4abfbf
more removal
FlameArrow57 Jun 2, 2023
2d44a4f
add a comment
FlameArrow57 Jun 2, 2023
3d005a9
Update code/modules/storage/items/bag_of_holding.dm
ZeWaka Jul 3, 2023
cc53aea
Merge branch 'master' into artifact-storage
FlameArrow57 Sep 16, 2023
7b65b81
comments and minor changes
FlameArrow57 Sep 16, 2023
3373af3
fix inhand bug
FlameArrow57 Sep 16, 2023
706f241
martian storage
FlameArrow57 Sep 16, 2023
292d25c
doc comment for atom property
FlameArrow57 Sep 16, 2023
8f63e19
Merge branch 'master' into artifact-storage
FlameArrow57 Sep 16, 2023
f707715
fix sprite merge issues
FlameArrow57 Sep 16, 2023
5029917
Merge branch 'master' into artifact-storage
FlameArrow57 Oct 26, 2023
85b73f4
remove precursor storage
FlameArrow57 Oct 26, 2023
3e4d999
add eldritch sprites
FlameArrow57 Oct 27, 2023
0d2802a
wizard backpack
FlameArrow57 Oct 27, 2023
8831990
compile fix
FlameArrow57 Oct 27, 2023
f478fe6
runtime fix
FlameArrow57 Oct 27, 2023
a3b58d2
accidental line removal
FlameArrow57 Oct 27, 2023
f6377d9
some older comment changes
FlameArrow57 Nov 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
66 changes: 66 additions & 0 deletions assets/maps/allocated/artifact_stranded.dmm
@@ -0,0 +1,66 @@
//MAP CONVERTED BY dmm2tgm.py THIS HEADER COMMENT PREVENTS RECONVERSION, DO NOT REMOVE
"a" = (
/turf/unsimulated/wall/auto/adventure/ancient,
/area/crunch/artifact_boh_pocket_dimension)
"d" = (
/obj/map/light/dimreddish,
/turf/unsimulated/floor/setpieces{
desc = "A strange jet black metal floor. There are odd lines carved into it.";
icon = 'icons/turf/floors.dmi';
icon_state = "ancient";
name = "strange surface"
},
/area/crunch/artifact_boh_pocket_dimension)
"g" = (
/obj/decal/fakeobjects/artifact_boh_pocket_dimension_artifact,
/turf/unsimulated/floor/setpieces{
desc = "A strange jet black metal floor. There are odd lines carved into it.";
icon = 'icons/turf/floors.dmi';
icon_state = "ancient";
name = "strange surface"
},
/area/crunch/artifact_boh_pocket_dimension)
"P" = (
/turf/unsimulated/floor/setpieces{
desc = "A strange jet black metal floor. There are odd lines carved into it.";
icon = 'icons/turf/floors.dmi';
icon_state = "ancient";
name = "strange surface"
},
/area/crunch/artifact_boh_pocket_dimension)

(1,1,1) = {"
a
a
a
a
a
"}
(2,1,1) = {"
a
g
P
g
a
"}
(3,1,1) = {"
a
P
d
P
a
"}
(4,1,1) = {"
a
g
P
g
a
"}
(5,1,1) = {"
a
a
a
a
a
"}
19 changes: 11 additions & 8 deletions code/datums/hud/storage.dm
Expand Up @@ -52,7 +52,7 @@
if (!H || H.id != "boxes") return
if (usr)
var/obj/item/I = usr.equipped()
if (src.master && I && src.master.linked_item.loc == usr && src.master.check_can_hold(I) == STORAGE_CAN_HOLD)
if (src.master && I && src.master.linked_item.loc == usr && src.master.hud_can_add(I))
sel.screen_loc = empty_obj_loc


Expand Down Expand Up @@ -133,30 +133,33 @@
I.mouse_drop(over_object, src_location, over_location, over_control, params)
*/
proc/update(mob/user = usr)
var/list/hud_contents = src.master.get_hud_contents()
var/num_contents = src.master.get_visible_slots()

var x = 1
var y = 1 + master.slots
var y = 1 + num_contents
var sx = 1
var sy = master.slots + 1
var sy = num_contents + 1
var/turfd = 0

if (isturf(master.linked_item.loc) && !istype(master.linked_item, /obj/item/bible)) // goddamn BIBLES (prevents conflicting positions within different bibles)
x = 7
y = 8
sx = (master.slots + 1) / 2
sx = (num_contents + 1) / 2
sy = 2

turfd = 1

if (user && user.client?.tg_layout) //MBC TG OVERRIDE IM SORTY
x = 11 - round(master.slots / 2)
x = 11 - round(num_contents / 2)
y = 3
sx = master.slots + 1
sx = num_contents + 1
sy = 1

if (turfd) // goddamn BIBLES (prevents conflicting positions within different bibles)
x = 8
y = 8
sx = (master.slots + 1) / 2
sx = (num_contents + 1) / 2
sy = 2

if (!boxes)
Expand All @@ -182,7 +185,7 @@

src.obj_locs = list()
var/i = 0
for (var/obj/item/I in master.get_contents())
for (var/obj/item/I as anything in hud_contents)
if (!(I in src.objects)) // ugh
add_object(I, HUD_LAYER+1)
var/obj_loc = "[x+(i%sx)],[y-round(i/sx)]" //no pixel coords cause that makes click detection harder above
Expand Down
32 changes: 32 additions & 0 deletions code/modules/status_system/statusEffects.dm
Expand Up @@ -2448,6 +2448,38 @@
maxDuration = 4 SECONDS
effect_quality = STATUS_QUALITY_POSITIVE

// martian bag of holding artifact effect
/datum/statusEffect/martian_boh
id = "martian_boh_morph"
name = "Morphing"
duration = INFINITE_STATUS
effect_quality = STATUS_QUALITY_NEUTRAL
var/passed = 0 SECONDS
var/period
var/message_given = FALSE

New()
src.period = rand(60, 180) SECONDS
..()

onUpdate(timePassed)
src.passed += timePassed / 10 SECONDS

if (src.passed < src.period * 0.75)
return

if (!src.message_given)
src.owner.loc.visible_message("<span class='alert'>[src.owner] begins to change shape!</span>")
src.message_given = TRUE
else if (src.passed >= src.period)
var/obj/item/artifact/bag_of_holding/boh = src.owner
src.owner.loc.visible_message("<span class='alert'>[src.owner] completely changes!</span>")
playsound(src.owner.loc, pick("sound/machines/ArtifactMar[pick(1, 2)].ogg"), 75, TRUE)
boh.martian_change_shape()
src.passed = 0
src.period = rand(60, 180) SECONDS
src.message_given = FALSE

/datum/statusEffect/loose_brain
id = "loose_brain"
name = "Loose Brain"
Expand Down
197 changes: 197 additions & 0 deletions code/modules/storage/items/bag_of_holding.dm
@@ -0,0 +1,197 @@
// storage datums for bag of holding artifact. see code there for how these are used

// --- eldritch ---

// eldritch storage that has no hud. doesn't inherit from other artifact storages' parent type since they don't have the no hud functionality
/datum/storage/no_hud/eldritch_bag_of_holding

// effect from putting a bag of holding into another
/datum/storage/no_hud/eldritch_bag_of_holding/add_contents_extra(obj/item/I, mob/user, visible)
..()
if (istype(I, /obj/item/artifact/bag_of_holding))
var/obj/item/artifact/bag_of_holding/boh = I
var/datum/artifact/artifact = boh.artifact
if (artifact.activated)
combine_bags_of_holding(src.linked_item, boh, user)
return
var/obj/item/artifact/bag_of_holding/boh = src.linked_item
boh.ArtifactFaultUsed(user, boh)

// --- parent artifact storage type ---

// parent artifact bag of holding type
/datum/storage/artifact_bag_of_holding

// effect from putting a bag of holding into another
/datum/storage/artifact_bag_of_holding/add_contents_extra(obj/item/I, mob/user, visible)
..()
if (istype(I, /obj/item/artifact/bag_of_holding))
var/obj/item/artifact/bag_of_holding/boh = I
var/datum/artifact/artifact = boh.artifact
if (artifact.activated)
combine_bags_of_holding(src.linked_item, boh, user)
return
var/obj/item/artifact/bag_of_holding/boh = src.linked_item
boh.ArtifactFaultUsed(user, boh)

// --- martian ---

// storage that changes what it can hold over time
/datum/storage/artifact_bag_of_holding/martian

/datum/storage/artifact_bag_of_holding/martian/New()
..()
src.linked_item.setStatus("martian_boh_morph")

/datum/storage/artifact_bag_of_holding/martian/disposing()
src.linked_item.delStatus("martian_boh_morph")
..()

// --- wizard ---

// storage that shows a random, smaller selection of the total contents each time you look inside or its contents change
/datum/storage/artifact_bag_of_holding/wizard
FlameArrow57 marked this conversation as resolved.
Show resolved Hide resolved
var/visible_slots = 3

/datum/storage/artifact_bag_of_holding/wizard/New(atom/storage_item, list/spawn_contents, list/can_hold, list/can_hold_exact, list/prevent_holding,
check_wclass, max_wclass, slots, sneaky, stealthy_storage, opens_if_worn, list/params)
..()
src.visible_slots = params["visible_slots"] || initial(src.visible_slots)

/datum/storage/artifact_bag_of_holding/wizard/add_contents_extra(obj/item/I, mob/user, visible)
..()
if (user)
src.show_hud(user)

/datum/storage/artifact_bag_of_holding/wizard/transfer_stored_item_extra(obj/item/I, atom/location, add_to_storage, mob/user)
..()
if (user)
src.show_hud(user)

// does the randomization of visible contents
/datum/storage/artifact_bag_of_holding/wizard/show_hud(mob/user)
shuffle_list(src.stored_items)
..()
// item order is randomized, then hud refreshes, only adding new objects. this is needed to remove old objects
for (var/obj/item/I in (src.hud.objects - src.get_hud_contents()))
src.hud.remove_object(I)

// extra check for the storage
/datum/storage/artifact_bag_of_holding/wizard/hud_can_add(obj/item/I)
return (length(src.get_contents()) < src.visible_slots) && ..()

/datum/storage/artifact_bag_of_holding/wizard/get_visible_slots()
return src.visible_slots

// make sure only up to visible slots # of contents are shown
/datum/storage/artifact_bag_of_holding/wizard/get_hud_contents(hud_clear_check = TRUE)
var/list/current_contents = src.get_contents()
return !length(current_contents) ? current_contents : current_contents.Copy(1, min(length(current_contents), src.visible_slots) + 1)

// --- other ---

// when a bag of holding artifact is put into into another, after its been done
// boh "added" is put into boh "boh"
proc/combine_bags_of_holding(obj/item/artifact/boh, obj/item/artifact/added, mob/user = null)
var/effect
var/turf/T = get_turf(boh)
switch(rand(1, 4))
// explosion
if (1)
explosion_new(added, T, 3) // causes a one tile hull breach
T.visible_message("<span class='alert'><B>The artifacts explode! HOLY SHIT!!!")
playsound(T, "explosion", 25, TRUE)
user?.gib()

effect = "explosion"
// implosion
if (2)
var/obj/dummy/artifact_boh_singulo_dummy/black_hole = new (T)
T.visible_message("<span class='alert'><B>The artifacts shrink to nothing! UH OH.")
playsound(T, 'sound/machines/singulo_start.ogg', 20, TRUE)
qdel(T)
qdel(user)
SPAWN(3 SECONDS)
qdel(black_hole)

effect = "black hole"
// teleport items everywhere
if (3)
var/list/items = boh.storage.get_contents() + added.storage.get_contents() - added
// teleport to random storages
if (prob(50))
if (length(items))
var/list/humans = list()
for (var/mob/living/carbon/human/H in mobs)
if ((H.back?.storage && !istype(H.back, /obj/item/artifact/bag_of_holding)) || (H.belt?.storage && !istype(H.belt, /obj/item/artifact/bag_of_holding)))
humans += H
if (length(humans))
shuffle_list(humans)
var/mob/living/carbon/human/H
for (var/obj/item/I as anything in items)
H = pick(humans)
if (H.back.storage.check_can_hold(I) == STORAGE_CAN_HOLD)
I.stored.transfer_stored_item(I, H.back, TRUE)
else if (H.belt.storage.check_can_hold(I) == STORAGE_CAN_HOLD)
I.stored.transfer_stored_item(I, H.belt, TRUE)
humans -= H
if (!length(humans))
break

effect = "content teleportation to random storages"
// teleport to random turfs
else
var/list/turfs = block(locate(1, 1, T.z || Z_LEVEL_STATION), locate(world.maxx, world.maxy, T.z || Z_LEVEL_STATION))
for (var/obj/item/I as anything in added.storage.get_contents())
added.storage.transfer_stored_item(I, pick(turfs))
for (var/obj/item/I as anything in (boh.storage.get_contents() - added))
boh.storage.transfer_stored_item(I, pick(turfs))

effect = "content teleportation to random turfs"

playsound(T, "warp", 50, TRUE)
boutput(user, "<span class='alert'><B>The artifacts disappear![length(items) ? "... Along with everything inside them!" : null]</B></span>")
// strand user in pocket dimension
if (4)
if (user)
playsound(T, 'sound/effects/bamf.ogg', 50, TRUE)

for (var/mob/M as anything in viewers(6, T))
M.flash(3 SECONDS)

var/datum/mapPrefab/allocated/prefab = get_singleton(/datum/mapPrefab/allocated/artifact_stranded)
var/datum/allocated_region/region = prefab.load()
user.set_loc(region.get_center())

T.visible_message("<span class='alert'>[user] vanishes!</span>")

SPAWN(5 SECONDS)
boutput(user, "<span class='alert'>Yeah... you're not getting out of this place alive.</span>")

effect = "user stranded in pocket dimension"

logTheThing(LOG_STATION, boh, "artifact bags of holding combined at [log_loc(T)][user ? " by [user] " : null]with effect [effect].")

for (var/obj/item/I as anything in (added.storage.get_contents() + boh.storage.get_contents() - added))
qdel(I)
qdel(added)
qdel(boh)

// small singulo imitator that isn't deadly
/obj/dummy/artifact_boh_singulo_dummy
name = "gravitational singularity"
desc = "That's... a singularity..."
icon = 'icons/effects/160x160.dmi'
icon_state = "Sing2"
anchored = ANCHORED
density = TRUE
plane = PLANE_DEFAULT_NOWARP

event_handler_flags = IMMUNE_SINGULARITY

pixel_x = -64
pixel_y = -64

New()
..()
src.SafeScale(0.2, 0.2)
File renamed without changes.
16 changes: 15 additions & 1 deletion code/modules/storage/storage.dm
Expand Up @@ -200,7 +200,7 @@
for (var/mob/M as anything in src.hud.mobs)
if (M != user)
src.hide_hud(M)
src.hud.update(user)
src.show_hud(user)
return TRUE

/// storage item is mouse dropped onto something
Expand Down Expand Up @@ -439,3 +439,17 @@
/datum/storage/proc/storage_emp_act()
for (var/atom/A as anything in src.get_contents())
A.emp_act()

// -------- /datum/hud/storage INTERFACE PROCS --------

/// if an item can be added by clicking it on the visible hud
/datum/storage/proc/hud_can_add(obj/item/I)
return src.check_can_hold(I) == STORAGE_CAN_HOLD

/// return number of visible slots in the hud
/datum/storage/proc/get_visible_slots()
return src.slots

/// return contents that can be seen in the hud
/datum/storage/proc/get_hud_contents()
return src.get_contents()
5 changes: 5 additions & 0 deletions code/modules/worldgen/prefab/allocated.dm
Expand Up @@ -44,3 +44,8 @@ ABSTRACT_TYPE(/datum/mapPrefab/allocated)
prefabPath = "assets/maps/allocated/football.dmm"
prefabSizeX = 294
prefabSizeY = 46

/datum/mapPrefab/allocated/artifact_stranded
prefabPath = "assets/maps/allocated/artifact_stranded.dmm"
prefabSizeX = 5
prefabSizeY = 5