Skip to content

Commit

Permalink
full loafing potential
Browse files Browse the repository at this point in the history
  • Loading branch information
polygoblyn committed Sep 24, 2023
1 parent 7eff71a commit 5663c0e
Show file tree
Hide file tree
Showing 3 changed files with 254 additions and 83 deletions.
2 changes: 1 addition & 1 deletion code/controllers/subsystem/throwing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ SUBSYSTEM_DEF(throwing)
if (callback)
callback.Invoke()

if(!thrownthing.currently_z_moving) // I don't think you can zfall while thrown but hey, just in case.
if(!thrownthing?.currently_z_moving) // I don't think you can zfall while thrown but hey, just in case.
var/turf/T = get_turf(thrownthing)
T?.zFall(thrownthing)

Expand Down
224 changes: 187 additions & 37 deletions monkestation/code/modules/loafing/code/loaf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,83 +2,233 @@
name = "prison loaf"
desc = "A barely edible brick of nutrients, designed as a low-cost solution to malnourishment."
icon = 'monkestation/code/modules/loafing/icon/obj.dmi'
icon_state = "loaf0"
icon_state = "loaf"
var/loaf_density = 1 //base loaf density
var/can_condense = TRUE //for special loaves, make false

//vars for high level loafs
var/atom/movable/warp_effect/warp
var/lifespan = ANOMALY_COUNTDOWN_TIMER //works similar to grav anomaly when hits critical
var/death_time
var/countdown_colour = COLOR_ASSEMBLY_LBLUE
var/obj/effect/countdown/loaf/countdown
var/boing = 0
var/obj/singularity/singuloaf

/obj/item/food/prison_loaf/process(seconds_per_tick)
anomalyEffect(seconds_per_tick)
if(death_time < world.time)
if(loc)
detonate()
qdel(src)

/obj/item/food/prison_loaf/Destroy()
STOP_PROCESSING(SSobj, src)
QDEL_NULL(countdown)
vis_contents -= warp
warp = null
return ..()

/obj/item/food/prison_loaf/proc/anomalyEffect(seconds_per_tick)
if(SPT_PROB(ANOMALY_MOVECHANCE, seconds_per_tick))
step(src,pick(GLOB.alldirs))
boing = 1
for(var/obj/object in orange(4, src))
if(!object.anchored)
step_towards(object,src)
for(var/mob/living/M in range(0, src))
gravShock(M)
for(var/mob/living/M in orange(4, src))
if(!M.mob_negates_gravity())
step_towards(M,src)
for(var/obj/object in range(0,src))
if(!object.anchored)
if(isturf(object.loc))
var/turf/T = object.loc
if(T.underfloor_accessibility < UNDERFLOOR_INTERACTABLE && HAS_TRAIT(object, TRAIT_T_RAY_VISIBLE))
continue
var/mob/living/target = locate() in view(4,src)
if(target && !target.stat)
object.throw_at(target, 5, 10)
animate(warp, time = seconds_per_tick*3, transform = matrix().Scale(0.5,0.5))
animate(time = seconds_per_tick*7, transform = matrix())

/obj/item/food/prison_loaf/proc/detonate()
var/turf/T = get_turf(src)
log_game("\A [src] critical loaf has ended its lifespan, turning into a singularity at [AREACOORD(T)].")
message_admins("A [src.name] critical loaf has ended its lifespan, turning into a singularity at [ADMIN_VERBOSEJMP(T)].")

singuloaf = new /obj/singularity/(src)
singuloaf.loc = src.loc
return

/obj/item/food/prison_loaf/on_changed_z_level(turf/old_turf, turf/new_turf, same_z_layer, notify_contents)
. = ..()
if(same_z_layer)
return
if(warp)
SET_PLANE(warp, PLANE_TO_TRUE(warp.plane), new_turf)

/obj/item/food/prison_loaf/proc/on_entered(datum/source, atom/movable/AM)
SIGNAL_HANDLER
gravShock(AM)

/obj/item/food/prison_loaf/Bump(atom/A)
gravShock(A)

/obj/item/food/prison_loaf/Bumped(atom/movable/AM)
gravShock(AM)

/obj/item/food/prison_loaf/proc/gravShock(mob/living/A)
if(boing && isliving(A) && !A.stat)
A.Paralyze(40)
var/atom/target = get_edge_target_turf(A, get_dir(src, get_step_away(A, src)))
A.throw_at(target, 5, 1)
boing = 0

/obj/item/food/prison_loaf/proc/critical()
var/turf/T = get_turf(src)
notify_ghosts("A [src] has been condensed to the point of criticality!", source=src, action=NOTIFY_ORBIT, header="Loaf Criticality!!")
log_game("\A [src] has been condensed to the point of criticality at [AREACOORD(T)].")
message_admins("A [src.name] has been condensed to the point of criticality at [ADMIN_VERBOSEJMP(T)].")
death_time = world.time + lifespan
warp = new(src)
vis_contents += warp
countdown = new(src)
if(countdown_colour)
countdown.color = countdown_colour
countdown.start()
can_condense = FALSE
START_PROCESSING(SSobj, src)

/obj/effect/countdown/loaf
name = "singuloaf countdown"

/obj/effect/countdown/loaf/get_value()
var/obj/item/food/prison_loaf/loaf = attached_to
if(!istype(loaf))
return
else
var/time_left = max(0, (loaf.death_time - world.time) / 10)
return round(time_left)








/obj/item/food/prison_loaf/rod
name = "rod loaf"
desc = "If you loaf something, set it free. If it comes back, it's yours."
icon_state = "rod_loaf"
can_condense = FALSE

/obj/item/food/prison_loaf/rod/after_throw(datum/callback/callback)
. = ..()
var/startside = pick(GLOB.cardinals)
var/turf/end_turf = get_edge_target_turf(get_random_station_turf(), turn(startside, 180))
var/turf/start_turf = get_turf(usr)
var/atom/rod = new /obj/effect/immovablerod/loaf(start_turf, end_turf)
notify_ghosts("[usr.name] has an object of interest: [rod]!", source=rod, action=NOTIFY_ORBIT, header="Something's Interesting!")
qdel(src)

/obj/effect/immovablerod/loaf
name = "immovable loaf"
desc = "Oh no, the flavor is coming right for us!"
icon = 'monkestation/code/modules/loafing/icon/obj.dmi'
icon_state = "rod_loaf"

/obj/machinery/power/supermatter_crystal/loaf
name = "suppermatter loaf" //you can't kill me for my bad puns. they make me immortal.
desc = "A prison loaf that has condensed and crystalized to the point where it can be used as a standard power source."
icon = 'monkestation/code/modules/loafing/icon/obj.dmi'
icon_state = "supermatter_loaf"



/obj/item/food/prison_loaf/proc/condense()
if(!src.can_condense)
return
switch(src.loaf_density)

if(0 to 10)
src.name = "prison loaf"
src.name = initial(src.name)
src.desc = "A barely edible brick of nutrients, designed as a low-cost solution to malnourishment."
src.icon_state = "loaf0"
src.icon_state = initial(src.icon_state) + "0"
src.force = 0
src.throwforce = 0
src.reagents.add_reagent(/datum/reagent/consumable/salt, 1)
if(11 to 100)
src.name = "dense prison loaf"
src.desc = "This loaf is noticeably heavier than usual."
src.icon_state = "loaf0"
src.name = "dense " + initial(src.name)
src.desc = initial(src.desc) + " This loaf is noticeably heavier than usual."
src.icon_state = initial(src.icon_state) + "0"
src.force = 3
src.throwforce = 3
src.reagents.add_reagent(/datum/reagent/consumable/salt, 3)
if(101 to 250)
src.name = "thicc ass prison loaf"
src.desc = "This loaf is caked UP"
src.icon_state = "loaf0"
src.name = "compacted " + initial(src.name)
src.desc = initial(src.desc) + " Hooh, this thing packs a punch. What are they putting into these?"
src.icon_state = initial(src.icon_state) + "0"
src.force = 5
src.throwforce = 5
src.throw_range = 6
src.reagents.add_reagent(/datum/reagent/consumable/salt, 8)
if(251 to 500)
src.name = "thicc ass prison loaf"
src.desc = "This loaf is caked UP"
src.icon_state = "loaf1"
src.name = "super-compressed " + initial(src.name)
src.desc = initial(src.desc) + " Hard enough to scratch a diamond, yet still somehow edible, this loaf seems to be emitting decay heat. Dear god."
src.icon_state = initial(src.icon_state) + "1"
src.force = 10
src.throwforce = 10
src.throw_range = 6
src.reagents.add_reagent(/datum/reagent/consumable/salt, 10)
if(501 to 2500)
src.name = "thicc ass prison loaf"
src.desc = "This loaf is caked UP"
src.icon_state = "loaf1"
src.name = "molecular " + initial(src.name)
src.desc = initial(src.desc) + " The loaf has become so dense that no food particulates are visible to the naked eye."
src.icon_state = initial(src.icon_state) + "2"
src.force = 20
src.throwforce = 20
src.throw_range = 5
if(2501 to 50000)
src.name = "thicc ass prison loaf"
src.desc = "This loaf is caked UP"
src.icon_state = "loaf1"
src.reagents.add_reagent(/datum/reagent/consumable/salt, 10)
if(2501 to 10000)
src.name = "atomic " + initial(src.name)
src.desc = initial(src.desc) + " Forget food particulates, the loaf is now comprised of flavor atoms."
src.icon_state = initial(src.icon_state) + "3"
src.force = 40
src.throwforce = 40
src.throw_range = 4
if(50001 to 250000)
src.name = "thicc ass prison loaf"
src.desc = "This loaf is caked UP"
src.icon_state = "loaf1"
src.reagents.add_reagent(/datum/reagent/consumable/salt, 10)
if(10001 to 25000)
src.name = "sub atomic " + initial(src.name)
src.desc = initial(src.desc) + " Oh good, the flavor atoms in this prison loaf have collapsed down to a a solid lump of neutrons."
src.icon_state = initial(src.icon_state) + "4"
src.force = 65
src.throwforce = 65
src.throw_range = 3
if(250001 to 1000000)
src.name = "thicc ass prison loaf"
src.desc = "This loaf is caked UP"
src.icon_state = "loaf1"
src.reagents.add_reagent(/datum/reagent/consumable/salt, 10)
if(25001 to 50000)
src.name = "quark " + initial(src.name)
src.desc = initial(src.desc) + " This nutritional loaf is collapsing into subatomic flavor particles. It is unfathmomably heavy."
src.icon_state = initial(src.icon_state) + "5"
src.force = 80
src.throwforce = 80
src.throw_range = 2
if(250001 to 1000000)
src.name = "thicc ass prison loaf"
src.desc = "This loaf is caked UP"
src.icon_state = "loaf1"
src.reagents.add_reagent(/datum/reagent/consumable/salt, 10)
if(50001 to 100000)
src.name = "strangelet " + initial(src.name)
src.desc = initial(src.desc) + " At this point you may be considering: has man gone too far? Are we meant to have food this powerful?"
src.icon_state = initial(src.icon_state) + "6"
src.force = 125
src.throwforce = 125
src.throw_range = 1
if(250001 to 1000000)
src.name = "quantum loaf"
src.desc = "This loaf is caked UP"
src.icon_state = "loaf1"
src.reagents.add_reagent(/datum/reagent/consumable/salt, 10)
if(100001 to 1000000)
src.name = "quantum " + initial(src.name)
src.desc = initial(src.desc) + " The mere existence of this nutritional masterpiece is causing reality to distort!"
src.icon_state = initial(src.icon_state) + "7"
src.force = 250
src.throwforce = 250
src.throw_range = 0


src.reagents.add_reagent(/datum/reagent/consumable/salt, 10)
critical()
Loading

0 comments on commit 5663c0e

Please sign in to comment.