mirror of
https://github.com/KabKebab/GS13.git
synced 2026-07-12 08:27:24 +01:00
Fixed up spawning issues, comments up code, overall polishing
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
/datum/component/fattening_door
|
||||
var/fatten = FALSE // whether player will be fattened
|
||||
var/fat_to_add = 2 // fatness per tick stunned
|
||||
var/stuck = FALSE // whether player is stuck
|
||||
var/stuck_delay = 0 // set in proc/Fatten
|
||||
// var/fatten_delay = 1 // ticks per periodic loop
|
||||
// var/blocked = FALSE // whether door is blocked // Unneeded now as FatStun replaces this loop requirement.
|
||||
|
||||
/datum/component/fattening_door/Initialize()
|
||||
if(!istype(parent, /obj/structure/mineral_door)) // if the attached object isn't a door, return incompatible!
|
||||
@@ -14,62 +10,37 @@
|
||||
|
||||
|
||||
/datum/component/fattening_door/proc/Fatten() //GS13
|
||||
to_chat(world, "fattenPass1")
|
||||
//blocked = FALSE
|
||||
|
||||
var/stuck_delay = 0
|
||||
var/turf/T = get_turf(parent)
|
||||
|
||||
for(var/mob/living/carbon/M in T)
|
||||
//blocked = TRUE
|
||||
stuck = M.AmountFatStunned()
|
||||
// determine if mob should get stuck and be fattened
|
||||
if(M.fatness >= FATNESS_LEVEL_BARELYMOBILE)
|
||||
if(M.fatness >= FATNESS_LEVEL_FAT)
|
||||
fatten = TRUE
|
||||
if(!stuck)
|
||||
stuck_delay = 120
|
||||
M.visible_message(
|
||||
"<span class='boldnotice'>[M] gets stuck in the doorway!</span>",
|
||||
"<span class='boldwarning'>You feel yourself get stuck in the doorway!</span>")
|
||||
else if(M.fatness >= FATNESS_LEVEL_MORBIDLY_OBESE)
|
||||
fatten = TRUE
|
||||
if(!stuck)
|
||||
stuck_delay = 50
|
||||
M.visible_message(
|
||||
"<span class='boldnotice'>[M] barely squeezes through the doorway!</span>",
|
||||
"<span class='boldwarning'>You feel your sides barely squeeze through the doorway!</span>")
|
||||
else if(M.fatness >= FATNESS_LEVEL_FATTER)
|
||||
fatten = TRUE
|
||||
if(!stuck)
|
||||
stuck_delay = 15
|
||||
M.visible_message(
|
||||
"<span class='boldnotice'>[M]'s sides briefly smush against the doorway.</span>",
|
||||
"<span class='boldwarning'>You feel your sides smush against the doorway!.</span>")
|
||||
else if(M.fatness >= FATNESS_LEVEL_FAT)
|
||||
fatten = TRUE
|
||||
if(!stuck)
|
||||
if(!M.AmountFatStunned())
|
||||
stuck_delay = 5
|
||||
M.visible_message(
|
||||
"<span class='boldnotice'>[M]'s sides briefly brush against the doorway.</span>",
|
||||
"<span class='boldwarning'>You feel your sides briefly brush against the doorway!</span>")
|
||||
else
|
||||
fatten = FALSE
|
||||
stuck = FALSE
|
||||
stuck_delay = 0
|
||||
|
||||
// Scales depending on this switch.
|
||||
switch(M.fatness)
|
||||
if(FATNESS_LEVEL_BARELYMOBILE to INFINITY)
|
||||
stuck_delay = 120
|
||||
M.visible_message(
|
||||
"<span class='boldnotice'>[M] gets stuck in the doorway!</span>",
|
||||
"<span class='boldwarning'>You feel yourself get stuck in the doorway!</span>")
|
||||
if((FATNESS_LEVEL_FATTER+1) to FATNESS_LEVEL_MORBIDLY_OBESE)
|
||||
stuck_delay = 50
|
||||
M.visible_message(
|
||||
"<span class='boldnotice'>[M] barely squeezes through the doorway!</span>",
|
||||
"<span class='boldwarning'>You feel your sides barely squeeze through the doorway!</span>")
|
||||
if((FATNESS_LEVEL_FAT+1) to FATNESS_LEVEL_FATTER)
|
||||
stuck_delay = 15
|
||||
M.visible_message(
|
||||
"<span class='boldnotice'>[M]'s sides briefly smush against the doorway.</span>",
|
||||
"<span class='boldwarning'>You feel your sides smush against the doorway!.</span>")
|
||||
|
||||
// This requires a rework unfortunately now that its moved into a datum component.
|
||||
// I'll just make a custom status effect which stuns the player and while stunned, adds fatness :3
|
||||
// if (fatten) // get stuck
|
||||
// if (!stuck)
|
||||
// M.Stun(stuck_delay/2) // give player time to escape
|
||||
// stuck = TRUE
|
||||
// if (stuck_delay > 0) // wait for stun to end
|
||||
// stuck_delay = stuck_delay - fatten_delay
|
||||
// if (stuck_delay <= 0)
|
||||
// stuck_delay = 0
|
||||
// // gain weight while stuck
|
||||
// M.adjust_fatness(fat_to_add, FATTENING_TYPE_ITEM)
|
||||
|
||||
// Apply the fatstun
|
||||
if(fatten)
|
||||
M.FatStun(stuck_delay, fatAmount = fat_to_add)
|
||||
|
||||
// if (!blocked)
|
||||
// stuck = FALSE // ready to go again
|
||||
|
||||
@@ -5,10 +5,14 @@
|
||||
sheetType = /obj/item/stack/sheet/mineral/calorite
|
||||
max_integrity = 200
|
||||
light_range = 1
|
||||
// Sets it open by default
|
||||
state = TRUE
|
||||
density = FALSE
|
||||
|
||||
// If you ever want to make any door like this, just simply add the component like this :3
|
||||
/obj/structure/mineral_door/calorite/Initialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/fattening_door)
|
||||
update_icon()
|
||||
|
||||
update_icon() // Updates the sprite when spawned in cause it's closed by default.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user