mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-19 11:05:03 +01:00
Mob life fix, firedoors
This commit does the following;
- Repairs mob breathing by adding a new ticker process, mob_master, as
air_master is an unreliable ticker with it's customizable speed
- Restore firedoor attack_hand access
- You can now open and close firedoors by using no item, provided you
have access to them and they aren't locked.
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
name = "mob"
|
||||
schedule_interval = 20 // every 2 seconds
|
||||
updateQueueInstance = new
|
||||
if(!mob_master)
|
||||
mob_master = new
|
||||
mob_master.Setup()
|
||||
|
||||
/datum/controller/process/mob/started()
|
||||
..()
|
||||
@@ -18,3 +21,17 @@
|
||||
if(updateQueueInstance)
|
||||
updateQueueInstance.init(mob_list, "Life")
|
||||
updateQueueInstance.Run()
|
||||
mob_master.process()
|
||||
|
||||
var/global/datum/controller/mob_system/mob_master
|
||||
|
||||
/datum/controller/mob_system
|
||||
var/current_cycle
|
||||
var/starttime
|
||||
|
||||
/datum/controller/mob_system/proc/Setup()
|
||||
world << "\red Mob ticker starting up."
|
||||
starttime = world.timeofday
|
||||
|
||||
/datum/controller/mob_system/proc/process()
|
||||
current_cycle++
|
||||
@@ -17,6 +17,8 @@
|
||||
var/blocked = 0
|
||||
var/nextstate = null
|
||||
|
||||
var/logged_users
|
||||
|
||||
/obj/machinery/door/firedoor/New()
|
||||
. = ..()
|
||||
for(var/obj/machinery/door/firedoor/F in loc)
|
||||
@@ -57,37 +59,154 @@
|
||||
stat |= NOPOWER
|
||||
return
|
||||
|
||||
/obj/machinery/door/firedoor/attack_hand(mob/user as mob)
|
||||
return attackby(null, user)
|
||||
|
||||
/obj/machinery/door/firedoor/attackby(obj/item/weapon/C as obj, mob/user as mob)
|
||||
/obj/machinery/door/firedoor/attackby(obj/item/weapon/C as obj, mob/user as mob, params)
|
||||
add_fingerprint(user)
|
||||
if(operating) return//Already doing something.
|
||||
if(operating)
|
||||
return//Already doing something.
|
||||
|
||||
if(istype(C, /obj/item/weapon/weldingtool))
|
||||
var/obj/item/weapon/weldingtool/W = C
|
||||
if(W.remove_fuel(0, user))
|
||||
blocked = !blocked
|
||||
user << text("\red You [blocked?"welded":"unwelded"] the [src]")
|
||||
user.visible_message("\red \The [user] [blocked ? "welds" : "unwelds"] \the [src] with \a [W].",\
|
||||
"You [blocked ? "weld" : "unweld"] \the [src] with \the [W].",\
|
||||
"You hear something being welded.")
|
||||
update_icon()
|
||||
return
|
||||
|
||||
if(istype(C, /obj/item/weapon/crowbar) || (istype(C,/obj/item/weapon/twohanded/fireaxe) && C:wielded == 1))
|
||||
if(blocked || operating) return
|
||||
if(blocked)
|
||||
user << "\red \The [src] is welded solid!"
|
||||
return
|
||||
|
||||
var/area/A = get_area_master(src)
|
||||
ASSERT(istype(A)) // This worries me.
|
||||
var/alarmed = A.air_doors_activated || A.fire
|
||||
|
||||
if( istype(C, /obj/item/weapon/crowbar) || ( istype(C,/obj/item/weapon/twohanded/fireaxe) && C:wielded == 1 ) )
|
||||
if(operating)
|
||||
return
|
||||
if(blocked)
|
||||
user.visible_message("\red \The [user] pries at \the [src] with \a [C], but \the [src] is welded in place!",\
|
||||
"You try to pry \the [src] [density ? "open" : "closed"], but it is welded in place!",\
|
||||
"You hear someone struggle and metal straining.")
|
||||
|
||||
if(stat & (BROKEN|NOPOWER) || !density || !alarmed)
|
||||
user.visible_message("\red \The [user] forces \the [src] [density ? "open" : "closed"] with \a [C]!",\
|
||||
"You force \the [src] [density ? "open" : "closed"] with \the [C]!",\
|
||||
"You hear metal strain, and a door [density ? "open" : "close"].")
|
||||
|
||||
else if(allowed(user))
|
||||
user.visible_message("\blue \The [user] lifts \the [src] with \a [C].",\
|
||||
"\The [src] scans your ID, and obediently opens as you apply your [C].",\
|
||||
"You hear metal move, and a door [density ? "open" : "close"].")
|
||||
|
||||
if(density)
|
||||
spawn(0)
|
||||
open()
|
||||
else
|
||||
spawn(0)
|
||||
close()
|
||||
return
|
||||
|
||||
var/access_granted = 0
|
||||
var/users_name
|
||||
if(!istype(C, /obj)) //If someone hit it with their hand. We need to see if they are allowed.
|
||||
if(allowed(user))
|
||||
access_granted = 1
|
||||
if(ishuman(user))
|
||||
users_name = FindNameFromID(user)
|
||||
else
|
||||
users_name = "Unknown"
|
||||
|
||||
if(ishuman(user) && !stat && (istype(C, /obj/item/weapon/card/id) || istype(C, /obj/item/device/pda)))
|
||||
var/obj/item/weapon/card/id/ID = C
|
||||
|
||||
if( istype(C, /obj/item/device/pda) )
|
||||
var/obj/item/device/pda/pda = C
|
||||
ID = pda.id
|
||||
if(!istype(ID))
|
||||
ID = null
|
||||
|
||||
if(ID)
|
||||
users_name = ID.registered_name
|
||||
|
||||
if(check_access(ID))
|
||||
access_granted = 1
|
||||
|
||||
var/answer = alert(user, "Are you sure you want to [density ? "open" : "close"] \the [src]?","\The [src] confirmation","Yes","No")
|
||||
if(answer == "No")
|
||||
return
|
||||
|
||||
if(user.stat || user.stunned || user.weakened || user.paralysis || get_dist(src, user) > 1)
|
||||
user << "Sorry, you must remain able bodied and close to \the [src] in order to use it."
|
||||
return
|
||||
|
||||
if(alarmed && density && !access_granted)
|
||||
user << "<span class='warning'>Access denied. Please wait for authorities to arrive, or for the alert to clear.</span>"
|
||||
return
|
||||
|
||||
else
|
||||
user.visible_message("\blue \The [src] [density ? "open" : "close"]s for \the [user].",\
|
||||
"\The [src] [density ? "open" : "close"]s.",\
|
||||
"You hear a beep, and a door opening.")
|
||||
// Accountability!
|
||||
if(!logged_users)
|
||||
logged_users = list()
|
||||
logged_users += users_name
|
||||
|
||||
var/needs_to_close = 0
|
||||
if(density)
|
||||
if(alarmed)
|
||||
needs_to_close = 1
|
||||
spawn()
|
||||
open()
|
||||
return
|
||||
else //close it up again //fucking 10/10 commenting here einstein
|
||||
else
|
||||
spawn()
|
||||
close()
|
||||
return
|
||||
return
|
||||
|
||||
if(needs_to_close)
|
||||
spawn(50)
|
||||
if(alarmed)
|
||||
nextstate = CLOSED
|
||||
|
||||
/obj/machinery/door/firedoor/attack_ai(mob/user as mob)
|
||||
add_fingerprint(user)
|
||||
if(blocked || operating || stat & NOPOWER)
|
||||
if(operating || stat & NOPOWER)
|
||||
return //Already doing something or depowered.
|
||||
|
||||
if(blocked)
|
||||
user << "\red \The [src] is welded solid!"
|
||||
return
|
||||
|
||||
var/area/A = get_area_master(src)
|
||||
ASSERT(istype(A)) // This worries me.
|
||||
var/alarmed = A.air_doors_activated || A.fire
|
||||
|
||||
var/access_granted = 0
|
||||
if(isAI(user) || isrobot(user))
|
||||
access_granted = 1
|
||||
|
||||
if(access_granted == 1)
|
||||
user.visible_message("\blue \The [src] [density ? "open" : "close"]s for \the [user].",\
|
||||
"\The [src] [density ? "open" : "close"]s.",\
|
||||
"You hear a beep, and a door opening.")
|
||||
|
||||
var/needs_to_close = 0
|
||||
if(density)
|
||||
open()
|
||||
if(alarmed)
|
||||
needs_to_close = 1
|
||||
spawn()
|
||||
open()
|
||||
else
|
||||
close()
|
||||
return
|
||||
spawn()
|
||||
close()
|
||||
|
||||
if(needs_to_close)
|
||||
spawn(50)
|
||||
if(alarmed)
|
||||
nextstate = CLOSED
|
||||
|
||||
/obj/machinery/door/firedoor/do_animate(animation)
|
||||
switch(animation)
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
//First, resolve location and get a breath
|
||||
|
||||
if(air_master.current_cycle%4==2)
|
||||
if(mob_master.current_cycle%4==2)
|
||||
//Only try to take a breath every 4 seconds, unless suffocating
|
||||
spawn(0) breathe()
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
amount_grown++
|
||||
|
||||
//First, resolve location and get a breath
|
||||
if(air_master.current_cycle%4==2)
|
||||
if(mob_master.current_cycle%4==2)
|
||||
//Only try to take a breath every 4 seconds, unless suffocating
|
||||
spawn(0) breathe()
|
||||
else //Still give containing object the chance to interact
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
stomach_contents.Remove(M)
|
||||
qdel(M)
|
||||
continue
|
||||
if(air_master.current_cycle%3==1)
|
||||
if(mob_master.current_cycle%3==1)
|
||||
if(!(M.status_flags & GODMODE))
|
||||
M.adjustBruteLoss(5)
|
||||
nutrition += 10
|
||||
|
||||
@@ -74,7 +74,7 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
|
||||
|
||||
//No need to update all of these procs if the guy is dead.
|
||||
if(stat != DEAD && !in_stasis)
|
||||
if(air_master.current_cycle%4==2 || failed_last_breath) //First, resolve location and get a breath
|
||||
if(mob_master.current_cycle%4==2 || failed_last_breath) //First, resolve location and get a breath
|
||||
breathe() //Only try to take a breath every 4 ticks, unless suffocating
|
||||
|
||||
else //Still give containing object the chance to interact
|
||||
@@ -1412,7 +1412,7 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
|
||||
stomach_contents.Remove(M)
|
||||
del(M)
|
||||
continue
|
||||
if(air_master.current_cycle%3==1)
|
||||
if(mob_master.current_cycle%3==1)
|
||||
if(!(M.status_flags & GODMODE))
|
||||
M.adjustBruteLoss(5)
|
||||
nutrition += 10
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
if (stat != DEAD)
|
||||
if(!istype(src,/mob/living/carbon/monkey/diona)) //still breathing
|
||||
//First, resolve location and get a breath
|
||||
if(air_master.current_cycle%4==2)
|
||||
if(mob_master.current_cycle%4==2)
|
||||
//Only try to take a breath every 4 seconds, unless suffocating
|
||||
breathe()
|
||||
else //Still give containing object the chance to interact
|
||||
|
||||
@@ -221,6 +221,7 @@
|
||||
if(H.reagents)
|
||||
H.reagents.add_reagent("plasma", Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE))
|
||||
H.toxins_alert = max(H.toxins_alert, 1)
|
||||
|
||||
else if(O2_pp > vox_oxygen_max && name == "Vox") //Oxygen is toxic to vox.
|
||||
var/ratio = (breath.oxygen/vox_oxygen_max) * 1000
|
||||
H.adjustToxLoss(Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE))
|
||||
|
||||
Reference in New Issue
Block a user