mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 03:27:05 +01:00
Merge pull request #2533 from tigercat2000/whhhyyyyy
Fixes medhud/sechud/etc shit, ai life refactor
This commit is contained in:
@@ -3,7 +3,7 @@ Use the regular_hud_updates() proc before process_med_hud(mob) or process_sec_hu
|
||||
the HUD updates properly! */
|
||||
|
||||
//Medical HUD outputs. Called by the Life() proc of the mob using it, usually.
|
||||
proc/process_med_hud(var/mob/M, var/local_scanner, var/mob/Alt)
|
||||
/proc/process_med_hud(var/mob/M, var/local_scanner, var/mob/Alt)
|
||||
if(!can_process_hud(M))
|
||||
return
|
||||
|
||||
@@ -25,7 +25,7 @@ proc/process_med_hud(var/mob/M, var/local_scanner, var/mob/Alt)
|
||||
P.Client.images += patient.hud_list[STATUS_HUD]
|
||||
|
||||
//Security HUDs. Pass a value for the second argument to enable implant viewing or other special features.
|
||||
proc/process_sec_hud(var/mob/M, var/advanced_mode, var/mob/Alt)
|
||||
/proc/process_sec_hud(var/mob/M, var/advanced_mode, var/mob/Alt)
|
||||
if(!can_process_hud(M))
|
||||
return
|
||||
var/datum/arranged_hud_process/P = arrange_hud_process(M, Alt, sec_hud_users)
|
||||
@@ -41,7 +41,7 @@ proc/process_sec_hud(var/mob/M, var/advanced_mode, var/mob/Alt)
|
||||
P.Client.images += perp.hud_list[IMPCHEM_HUD]
|
||||
|
||||
|
||||
proc/process_antag_hud(var/mob/M, var/mob/Alt)
|
||||
/proc/process_antag_hud(var/mob/M, var/mob/Alt)
|
||||
if(!can_process_hud(M))
|
||||
return
|
||||
var/datum/arranged_hud_process/P = arrange_hud_process(M, Alt, antag_hud_users)
|
||||
@@ -51,12 +51,12 @@ proc/process_antag_hud(var/mob/M, var/mob/Alt)
|
||||
|
||||
P.Client.images += target.hud_list[SPECIALROLE_HUD]
|
||||
|
||||
datum/arranged_hud_process
|
||||
/datum/arranged_hud_process
|
||||
var/client/Client
|
||||
var/mob/Mob
|
||||
var/turf/Turf
|
||||
|
||||
proc/arrange_hud_process(var/mob/M, var/mob/Alt, var/list/hud_list)
|
||||
/proc/arrange_hud_process(var/mob/M, var/mob/Alt, var/list/hud_list)
|
||||
hud_list |= M
|
||||
var/datum/arranged_hud_process/P = new
|
||||
P.Client = M.client
|
||||
@@ -64,7 +64,7 @@ proc/arrange_hud_process(var/mob/M, var/mob/Alt, var/list/hud_list)
|
||||
P.Turf = get_turf(P.Mob)
|
||||
return P
|
||||
|
||||
proc/can_process_hud(var/mob/M)
|
||||
/proc/can_process_hud(var/mob/M)
|
||||
if(!M)
|
||||
return 0
|
||||
if(!M.client)
|
||||
@@ -74,16 +74,16 @@ proc/can_process_hud(var/mob/M)
|
||||
return 1
|
||||
|
||||
//Deletes the current HUD images so they can be refreshed with new ones.
|
||||
mob/proc/regular_hud_updates() //Used in the life.dm of mobs that can use HUDs.
|
||||
/mob/proc/regular_hud_updates() //Used in the life.dm of mobs that can use HUDs.
|
||||
if(client)
|
||||
for(var/image/hud in client.images)
|
||||
if(copytext(hud.icon_state,1,4) == "hud")
|
||||
if(copytext(hud.icon_state,1,4) == "hud") //this makes me weep
|
||||
client.images -= hud
|
||||
med_hud_users -= src
|
||||
sec_hud_users -= src
|
||||
antag_hud_users -= src
|
||||
|
||||
mob/proc/in_view(var/turf/T)
|
||||
/mob/proc/in_view(var/turf/T)
|
||||
return view(T)
|
||||
|
||||
/mob/aiEye/in_view(var/turf/T)
|
||||
|
||||
@@ -54,7 +54,9 @@
|
||||
update_canmove()
|
||||
|
||||
if(client)
|
||||
handle_regular_hud_updates()
|
||||
regular_hud_updates() //THIS DOESN'T FUCKING UPDATE SHIT
|
||||
handle_regular_hud_updates() //IT JUST REMOVES FUCKING HUD IMAGES
|
||||
|
||||
|
||||
/mob/living/proc/handle_breathing()
|
||||
return
|
||||
|
||||
@@ -1,188 +1,158 @@
|
||||
/mob/living/silicon/ai/Life()
|
||||
if (src.stat == 2)
|
||||
//doesn't call parent because it's a horrible mess
|
||||
if(stat == DEAD)
|
||||
return
|
||||
else //I'm not removing that shitton of tabs, unneeded as they are. -- Urist
|
||||
//Being dead doesn't mean your temperature never changes
|
||||
var/turf/T = get_turf(src)
|
||||
|
||||
if (src.stat!=0)
|
||||
src.cameraFollow = null
|
||||
src.reset_view(null)
|
||||
src.unset_machine()
|
||||
var/turf/T = get_turf(src)
|
||||
if(stat != CONSCIOUS) //ai's fucked
|
||||
cameraFollow = null
|
||||
reset_view(null)
|
||||
unset_machine()
|
||||
|
||||
src.updatehealth()
|
||||
updatehealth()
|
||||
update_gravity(mob_has_gravity())
|
||||
|
||||
update_gravity(mob_has_gravity())
|
||||
if (health <= config.health_threshold_dead)
|
||||
death()
|
||||
return 0
|
||||
|
||||
if (src.malfhack)
|
||||
if (src.malfhack.aidisabled)
|
||||
src << "\red ERROR: APC access disabled, hack attempt canceled."
|
||||
src.malfhacking = 0
|
||||
src.malfhack = null
|
||||
if(malfhack)
|
||||
if(malfhack.aidisabled)
|
||||
src << "<span class='danger'>ERROR: APC access disabled, hack attempt canceled.</span>"
|
||||
malfhacking = 0
|
||||
malfhack = null
|
||||
|
||||
if(aiRestorePowerRoutine)
|
||||
adjustOxyLoss(1)
|
||||
else
|
||||
adjustOxyLoss(-1)
|
||||
|
||||
if (src.health <= config.health_threshold_dead)
|
||||
death()
|
||||
return
|
||||
handle_stunned()
|
||||
|
||||
// Handle power damage (oxy)
|
||||
if(src:aiRestorePowerRoutine != 0)
|
||||
// Lost power
|
||||
adjustOxyLoss(1)
|
||||
else
|
||||
// Gain Power
|
||||
adjustOxyLoss(-1)
|
||||
var/is_blind = 0 //THIS WAS JUST FUCKING 'blind' WHICH CONFLICTED WITH A NORMAL VARIABLE
|
||||
var/area/my_area = get_area(src)
|
||||
if(istype(my_area))
|
||||
if(!my_area.power_equip && !is_type_in_list(loc, list(/obj/item, /obj/mecha)))
|
||||
is_blind = 1 //HOW THE FUCK DID THAT EVEN COMPILE JESUS CHRIST
|
||||
|
||||
// Handle EMP-stun
|
||||
handle_stunned()
|
||||
if(!is_blind)
|
||||
sight |= SEE_TURFS
|
||||
sight |= SEE_MOBS
|
||||
sight |= SEE_OBJS
|
||||
|
||||
//stage = 1
|
||||
//if (istype(src, /mob/living/silicon/ai)) // Are we not sure what we are?
|
||||
var/blind = 0
|
||||
//stage = 2
|
||||
var/area/loc = null
|
||||
if (istype(T, /turf))
|
||||
//stage = 3
|
||||
loc = T.loc
|
||||
if (istype(loc, /area))
|
||||
//stage = 4
|
||||
if (!loc.power_equip && !is_type_in_list(src.loc,list(/obj/item, /obj/mecha)))
|
||||
//stage = 5
|
||||
blind = 1
|
||||
see_in_dark = 8
|
||||
see_invisible = SEE_INVISIBLE_LEVEL_TWO
|
||||
|
||||
if (!blind) //lol? if(!blind) #if(src.blind.layer) <--something here is clearly wrong :P
|
||||
//I'll get back to this when I find out how this is -supposed- to work ~Carn //removed this shit since it was confusing as all hell --39kk9t
|
||||
//stage = 4.5
|
||||
src.sight |= SEE_TURFS
|
||||
src.sight |= SEE_MOBS
|
||||
src.sight |= SEE_OBJS
|
||||
src.see_in_dark = 8
|
||||
src.see_invisible = SEE_INVISIBLE_LEVEL_TWO
|
||||
if(see_override)
|
||||
see_invisible = see_override
|
||||
if(see_override)
|
||||
see_invisible = see_override
|
||||
|
||||
//Congratulations! You've found a way for AI's to run without using power!
|
||||
//Todo: Without snowflaking up master_controller procs find a way to make AI use_power but only when APC's clear the area usage the tick prior
|
||||
// since mobs are in master_controller before machinery. We also have to do it in a manner where we don't reset the entire area's need to update
|
||||
// the power usage.
|
||||
//
|
||||
// We can probably create a new machine that resides inside of the AI contents that uses power using the idle_usage of 1000 and nothing else and
|
||||
// be fine.
|
||||
/*
|
||||
var/area/home = get_area(src)
|
||||
if(!home) return//something to do with malf fucking things up I guess. <-- aisat is gone. is this still necessary? ~Carn
|
||||
if(home.powered(EQUIP))
|
||||
home.use_power(1000, EQUIP)
|
||||
*/
|
||||
if(aiRestorePowerRoutine == 2)
|
||||
src << "Alert cancelled. Power has been restored without our assistance."
|
||||
aiRestorePowerRoutine = 0
|
||||
blind.layer = 0
|
||||
else if(aiRestorePowerRoutine == 3)
|
||||
src << "Alert cancelled. Power has been restored."
|
||||
aiRestorePowerRoutine = 0
|
||||
blind.layer = 0
|
||||
|
||||
if (src:aiRestorePowerRoutine==2)
|
||||
src << "Alert cancelled. Power has been restored without our assistance."
|
||||
src:aiRestorePowerRoutine = 0
|
||||
src.blind.layer = 0
|
||||
return
|
||||
else if (src:aiRestorePowerRoutine==3)
|
||||
src << "Alert cancelled. Power has been restored."
|
||||
src:aiRestorePowerRoutine = 0
|
||||
src.blind.layer = 0
|
||||
return
|
||||
else
|
||||
return
|
||||
|
||||
//stage = 6
|
||||
else
|
||||
|
||||
var/area/current_area = get_area(src)
|
||||
blind.screen_loc = "1,1 to 15,15"
|
||||
if(blind.layer != 18)
|
||||
blind.layer = 18
|
||||
sight &= ~SEE_TURFS
|
||||
sight &= ~SEE_MOBS
|
||||
sight &= ~SEE_OBJS
|
||||
|
||||
src.blind.screen_loc = "1,1 to 15,15"
|
||||
if (src.blind.layer!=18)
|
||||
src.blind.layer = 18
|
||||
src.sight = src.sight&~SEE_TURFS
|
||||
src.sight = src.sight&~SEE_MOBS
|
||||
src.sight = src.sight&~SEE_OBJS
|
||||
src.see_in_dark = 0
|
||||
src.see_invisible = SEE_INVISIBLE_LIVING
|
||||
see_in_dark = 0
|
||||
see_invisible = SEE_INVISIBLE_LIVING
|
||||
|
||||
if (((!loc.power_equip) || istype(T, /turf/space)) && !is_type_in_list(src.loc,list(/obj/item, /obj/mecha)))
|
||||
if (src:aiRestorePowerRoutine==0)
|
||||
src:aiRestorePowerRoutine = 1
|
||||
if(((!my_area.power_equip) || istype(T, /turf/space)) && !is_type_in_list(loc, list(/obj/item, /obj/mecha)))
|
||||
if(!aiRestorePowerRoutine)
|
||||
aiRestorePowerRoutine = 1
|
||||
|
||||
src << "You've lost power!"
|
||||
// world << "DEBUG CODE TIME! [loc] is the area the AI is sucking power from"
|
||||
if (!is_special_character(src))
|
||||
src.set_zeroth_law("")
|
||||
//src.clear_supplied_laws() // Don't reset our laws.
|
||||
//var/time = time2text(world.realtime,"hh:mm:ss")
|
||||
//lawchanges.Add("[time] <b>:</b> [src.name]'s noncore laws have been reset due to power failure")
|
||||
spawn(20)
|
||||
src << "Backup battery online. Scanners, camera, and radio interface offline. Beginning fault-detection."
|
||||
sleep(50)
|
||||
if (loc.power_equip)
|
||||
src << "<span class='danger'>You have lost power!</span>"
|
||||
|
||||
if(!is_special_character(src))
|
||||
set_zeroth_law("")
|
||||
|
||||
spawn(20)
|
||||
src << "Backup battery online. Scanners, camera, and radio interface offline. Beginning fault-detection."
|
||||
sleep(50)
|
||||
my_area = get_area(src)
|
||||
T = get_turf(src)
|
||||
if(my_area && my_area.power_equip && !istype(T, /turf/space))
|
||||
src << "Alert cancelled. Power has been restored without our assistance."
|
||||
aiRestorePowerRoutine = 0
|
||||
blind.layer = 0
|
||||
return
|
||||
src << "Fault confirmed: missing external power. Shutting down main control system to save power."
|
||||
sleep(20)
|
||||
src << "Emergency control system online. Verifying connection to power network."
|
||||
sleep(50)
|
||||
T = get_turf(src)
|
||||
if(istype(T, /turf/space))
|
||||
src << "Unable to verify! No power connection detected!"
|
||||
aiRestorePowerRoutine = 2
|
||||
return
|
||||
src << "Connection verified. Searching for APC in power network."
|
||||
sleep(50)
|
||||
|
||||
my_area = get_area(src)
|
||||
T = get_turf(src)
|
||||
|
||||
var/obj/machinery/power/apc/theAPC = null
|
||||
|
||||
var/PRP
|
||||
for(PRP = 1, PRP <= 4, PRP++)
|
||||
for(var/obj/machinery/power/apc/APC in my_area)
|
||||
if (!(APC.stat & BROKEN))
|
||||
theAPC = APC
|
||||
break
|
||||
|
||||
if(!theAPC)
|
||||
switch(PRP)
|
||||
if(1) src << "Unable to locate APC!"
|
||||
else src << "Lost connection with the APC!"
|
||||
aiRestorePowerRoutine = 2
|
||||
return
|
||||
|
||||
if(my_area.power_equip)
|
||||
if (!istype(T, /turf/space))
|
||||
src << "Alert cancelled. Power has been restored without our assistance."
|
||||
src:aiRestorePowerRoutine = 0
|
||||
src.blind.layer = 0
|
||||
aiRestorePowerRoutine = 0
|
||||
blind.layer = 0
|
||||
return
|
||||
src << "Fault confirmed: missing external power. Shutting down main control system to save power."
|
||||
sleep(20)
|
||||
src << "Emergency control system online. Verifying connection to power network."
|
||||
sleep(50)
|
||||
if (istype(T, /turf/space))
|
||||
src << "Unable to verify! No power connection detected!"
|
||||
src:aiRestorePowerRoutine = 2
|
||||
return
|
||||
src << "Connection verified. Searching for APC in power network."
|
||||
sleep(50)
|
||||
var/obj/machinery/power/apc/theAPC = null
|
||||
/*
|
||||
for (var/something in loc)
|
||||
if (istype(something, /obj/machinery/power/apc))
|
||||
if (!(something:stat & BROKEN))
|
||||
theAPC = something
|
||||
break
|
||||
*/
|
||||
var/PRP
|
||||
for (PRP=1, PRP<=4, PRP++)
|
||||
for (var/obj/machinery/power/apc/APC in current_area)
|
||||
if (!(APC.stat & BROKEN))
|
||||
theAPC = APC
|
||||
break
|
||||
|
||||
if (!theAPC)
|
||||
switch(PRP)
|
||||
if (1) src << "Unable to locate APC!"
|
||||
else src << "Lost connection with the APC!"
|
||||
src:aiRestorePowerRoutine = 2
|
||||
return
|
||||
if (loc.power_equip)
|
||||
if (!istype(T, /turf/space))
|
||||
src << "Alert cancelled. Power has been restored without our assistance."
|
||||
src:aiRestorePowerRoutine = 0
|
||||
src.blind.layer = 0 //This, too, is a fix to issue 603
|
||||
return
|
||||
switch(PRP)
|
||||
if (1) src << "APC located. Optimizing route to APC to avoid needless power waste."
|
||||
if (2) src << "Best route identified. Hacking offline APC power port."
|
||||
if (3) src << "Power port upload access confirmed. Loading control program into APC power port software."
|
||||
if (4)
|
||||
src << "Transfer complete. Forcing APC to execute program."
|
||||
sleep(50)
|
||||
src << "Receiving control information from APC."
|
||||
sleep(2)
|
||||
//bring up APC dialog
|
||||
apc_override = 1
|
||||
theAPC.attack_ai(src)
|
||||
apc_override = 0
|
||||
src:aiRestorePowerRoutine = 3
|
||||
src << "Here are your current laws:"
|
||||
src.show_laws()
|
||||
sleep(50)
|
||||
theAPC = null
|
||||
switch(PRP)
|
||||
if(1) src << "APC located. Optimizing route to APC to avoid needless power waste."
|
||||
if(2) src << "Best route identified. Hacking offline APC power port."
|
||||
if(3) src << "Power port upload access confirmed. Loading control program into APC power port software."
|
||||
if(4)
|
||||
src << "Transfer complete. Forcing APC to execute program."
|
||||
sleep(50)
|
||||
src << "Receiving control information from APC."
|
||||
sleep(2)
|
||||
//bring up APC dialog
|
||||
apc_override = 1
|
||||
theAPC.attack_ai(src)
|
||||
apc_override = 0
|
||||
aiRestorePowerRoutine = 3
|
||||
src << "Here are your current laws:"
|
||||
src.show_laws() //WHY THE FUCK IS THIS HERE
|
||||
sleep(50)
|
||||
theAPC = null
|
||||
|
||||
process_queued_alarms()
|
||||
regular_hud_updates()
|
||||
switch(src.sensor_mode)
|
||||
|
||||
switch(sensor_mode)
|
||||
if (SEC_HUD)
|
||||
process_sec_hud(src,1,src.eyeobj)
|
||||
process_sec_hud(src, 1, eyeobj)
|
||||
if (MED_HUD)
|
||||
process_med_hud(src,1,src.eyeobj)
|
||||
process_med_hud(src, 1, eyeobj)
|
||||
|
||||
/mob/living/silicon/ai/updatehealth()
|
||||
if(status_flags & GODMODE)
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
/mob/living/silicon/pai/Life()
|
||||
. = ..()
|
||||
if(.)
|
||||
regular_hud_updates()
|
||||
|
||||
if(src.secHUD == 1)
|
||||
if(secHUD == 1)
|
||||
process_sec_hud(src, 1)
|
||||
if(src.medHUD == 1)
|
||||
if(medHUD == 1)
|
||||
process_med_hud(src, 1)
|
||||
if(silence_time)
|
||||
if(world.timeofday >= silence_time)
|
||||
|
||||
@@ -244,8 +244,6 @@
|
||||
if(!client)
|
||||
return
|
||||
|
||||
regular_hud_updates()
|
||||
|
||||
switch(sensor_mode)
|
||||
if(SEC_HUD)
|
||||
process_sec_hud(src,1)
|
||||
|
||||
Reference in New Issue
Block a user