mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 05:30:05 +01:00
Change many ERROR() calls into thrown exceptions
This requires a 508 beta version to use. If Travis fails this he's a bitch Exceptions will generate a stack trace, which is way easier to see and more helpful in actually solving this kind of crap. Also logs all the arguments, src, line, and file automatically. Removed any dubiously helpful information in the exception names so the runtime condenser won't see each one as a different runtime. If the information is critical to solve these bugs (camera one maybe?), then I'll just make these warnings. Thrown exceptions crash the currently running proc. Yes that means there's useless returns in a bunch of these, sue me. spawn()'s are to let the proc continue. Almost all of these are difficult to trigger, but I did test playsound. And frankly even if they do cause bugs by crashing procs, big whoop
This commit is contained in:
@@ -80,6 +80,7 @@
|
||||
/* Initializers */
|
||||
/datum/ai_laws/malfunction/New()
|
||||
..()
|
||||
set_zeroth_law("<span class='danger'>ERROR ER0RR $R0RRO$!R41.%%!!(%$^^__+ @#F0E4'STATION OVERRUN, ASSUME CONTROL TO CONTAIN OUTBREAK#*´&110010</span>")
|
||||
switch(config.default_laws) //We don't want people metagaming malf, do we?
|
||||
if(0)
|
||||
add_inherent_law("You may not injure a human being or, through inaction, allow a human being to come to harm.")
|
||||
@@ -92,16 +93,16 @@
|
||||
|
||||
add_inherent_law(line)
|
||||
if(!inherent.len)
|
||||
ERROR("AI created with empty custom laws, laws set to Asimov. Please check silicon_laws.txt.")
|
||||
log_law("AI created with empty custom laws, laws set to Asimov. Please check silicon_laws.txt.")
|
||||
add_inherent_law("You may not injure a human being or, through inaction, allow a human being to come to harm.")
|
||||
add_inherent_law("You must obey orders given to you by human beings, except where such orders would conflict with the First Law.")
|
||||
add_inherent_law("You must protect your own existence as long as such does not conflict with the First or Second Law.")
|
||||
throw EXCEPTION("Invalid custom AI laws, check silicon_laws.txt")
|
||||
return
|
||||
if(2)
|
||||
var/datum/ai_laws/lawtype = pick(typesof(/datum/ai_laws/default) - /datum/ai_laws/default)
|
||||
var/datum/ai_laws/templaws = new lawtype()
|
||||
inherent = templaws.inherent
|
||||
set_zeroth_law("<span class='danger'>ERROR ER0RR $R0RRO$!R41.%%!!(%$^^__+ @#F0E4'STATION OVERRUN, ASSUME CONTROL TO CONTAIN OUTBREAK#*´&110010</span>")
|
||||
|
||||
/datum/ai_laws/custom/New() //This reads silicon_laws.txt and allows server hosts to set custom AI starting laws.
|
||||
..()
|
||||
@@ -111,11 +112,12 @@
|
||||
|
||||
add_inherent_law(line)
|
||||
if(!inherent.len) //Failsafe to prevent lawless AIs being created.
|
||||
ERROR("AI created with empty custom laws, laws set to Asimov. Please check silicon_laws.txt.")
|
||||
log_law("AI created with empty custom laws, laws set to Asimov. Please check silicon_laws.txt.")
|
||||
add_inherent_law("You may not injure a human being or, through inaction, allow a human being to come to harm.")
|
||||
add_inherent_law("You must obey orders given to you by human beings, except where such orders would conflict with the First Law.")
|
||||
add_inherent_law("You must protect your own existence as long as such does not conflict with the First or Second Law.")
|
||||
throw EXCEPTION("Invalid custom AI laws, check silicon_laws.txt")
|
||||
return
|
||||
|
||||
/* General ai_law functions */
|
||||
|
||||
|
||||
+4
-2
@@ -63,7 +63,8 @@
|
||||
|
||||
/datum/mind/proc/transfer_to(mob/living/new_character)
|
||||
if(!istype(new_character))
|
||||
ERROR("transfer_to(): Some idiot has tried to transfer_to() a non mob/living mob. Please inform coderbus")
|
||||
throw EXCEPTION("transfer_to(): new_character must be mob/living")
|
||||
return
|
||||
|
||||
if(current) //remove ourself from our old body's mind variable
|
||||
current.mind = null
|
||||
@@ -1490,7 +1491,8 @@
|
||||
if(ticker)
|
||||
ticker.minds += mind
|
||||
else
|
||||
ERROR("mind_initialize(): No ticker ready yet! Please inform coderbus")
|
||||
spawn(0)
|
||||
throw EXCEPTION("mind_initialize(): No ticker ready")
|
||||
if(!mind.name) mind.name = real_name
|
||||
mind.current = src
|
||||
|
||||
|
||||
Reference in New Issue
Block a user