Merge branch 'master' of https://github.com/Citadel-Station-13/Citadel-Station-13 into hijackbackup
This commit is contained in:
+103
-58
@@ -1,55 +1,72 @@
|
||||
/*
|
||||
USAGE:
|
||||
|
||||
var/datum/callback/C = new(object|null, /proc/type/path|"procstring", arg1, arg2, ... argn)
|
||||
var/timerid = addtimer(C, time, timertype)
|
||||
OR
|
||||
var/timerid = addtimer(CALLBACK(object|null, /proc/type/path|procstring, arg1, arg2, ... argn), time, timertype)
|
||||
|
||||
Note: proc strings can only be given for datum proc calls, global procs must be proc paths
|
||||
Also proc strings are strongly advised against because they don't compile error if the proc stops existing
|
||||
See the note on proc typepath shortcuts
|
||||
|
||||
INVOKING THE CALLBACK:
|
||||
var/result = C.Invoke(args, to, add) //additional args are added after the ones given when the callback was created
|
||||
OR
|
||||
var/result = C.InvokeAsync(args, to, add) //Sleeps will not block, returns . on the first sleep (then continues on in the "background" after the sleep/block ends), otherwise operates normally.
|
||||
OR
|
||||
INVOKE_ASYNC(<CALLBACK args>) to immediately create and call InvokeAsync
|
||||
|
||||
PROC TYPEPATH SHORTCUTS (these operate on paths, not types, so to these shortcuts, datum is NOT a parent of atom, etc...)
|
||||
|
||||
global proc while in another global proc:
|
||||
.procname
|
||||
Example:
|
||||
CALLBACK(GLOBAL_PROC, .some_proc_here)
|
||||
|
||||
proc defined on current(src) object (when in a /proc/ and not an override) OR overridden at src or any of it's parents:
|
||||
.procname
|
||||
Example:
|
||||
CALLBACK(src, .some_proc_here)
|
||||
|
||||
|
||||
when the above doesn't apply:
|
||||
.proc/procname
|
||||
Example:
|
||||
CALLBACK(src, .proc/some_proc_here)
|
||||
|
||||
proc defined on a parent of a some type:
|
||||
/some/type/.proc/some_proc_here
|
||||
|
||||
|
||||
|
||||
Other wise you will have to do the full typepath of the proc (/type/of/thing/proc/procname)
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
*# Callback Datums
|
||||
*A datum that holds a proc to be called on another object, used to track proccalls to other objects
|
||||
*
|
||||
* ## USAGE
|
||||
*
|
||||
* ```
|
||||
* var/datum/callback/C = new(object|null, /proc/type/path|"procstring", arg1, arg2, ... argn)
|
||||
* var/timerid = addtimer(C, time, timertype)
|
||||
* you can also use the compiler define shorthand
|
||||
* var/timerid = addtimer(CALLBACK(object|null, /proc/type/path|procstring, arg1, arg2, ... argn), time, timertype)
|
||||
* ```
|
||||
*
|
||||
* Note: proc strings can only be given for datum proc calls, global procs must be proc paths
|
||||
*
|
||||
* Also proc strings are strongly advised against because they don't compile error if the proc stops existing
|
||||
*
|
||||
* In some cases you can provide a shortform of the procname, see the proc typepath shortcuts documentation below
|
||||
*
|
||||
* ## INVOKING THE CALLBACK
|
||||
*`var/result = C.Invoke(args, to, add)` additional args are added after the ones given when the callback was created
|
||||
*
|
||||
* `var/result = C.InvokeAsync(args, to, add)` Asyncronous - returns . on the first sleep then continues on in the background
|
||||
* after the sleep/block ends, otherwise operates normally.
|
||||
*
|
||||
* ## PROC TYPEPATH SHORTCUTS
|
||||
* (these operate on paths, not types, so to these shortcuts, datum is NOT a parent of atom, etc...)
|
||||
*
|
||||
* ### global proc while in another global proc:
|
||||
* .procname
|
||||
*
|
||||
* `CALLBACK(GLOBAL_PROC, .some_proc_here)`
|
||||
*
|
||||
* ### proc defined on current(src) object (when in a /proc/ and not an override) OR overridden at src or any of it's parents:
|
||||
* .procname
|
||||
*
|
||||
* `CALLBACK(src, .some_proc_here)`
|
||||
*
|
||||
* ### when the above doesn't apply:
|
||||
*.proc/procname
|
||||
*
|
||||
* `CALLBACK(src, .proc/some_proc_here)`
|
||||
*
|
||||
*
|
||||
* proc defined on a parent of a some type
|
||||
*
|
||||
* `/some/type/.proc/some_proc_here`
|
||||
*
|
||||
* Otherwise you must always provide the full typepath of the proc (/type/of/thing/proc/procname)
|
||||
*/
|
||||
/datum/callback
|
||||
|
||||
///The object we will be calling the proc on
|
||||
var/datum/object = GLOBAL_PROC
|
||||
///The proc we will be calling on the object
|
||||
var/delegate
|
||||
///A list of arguments to pass into the proc
|
||||
var/list/arguments
|
||||
///A weak reference to the user who triggered this callback
|
||||
var/datum/weakref/user
|
||||
|
||||
/**
|
||||
* Create a new callback datum
|
||||
*
|
||||
* Arguments
|
||||
* * thingtocall the object to call the proc on
|
||||
* * proctocall the proc to call on the target object
|
||||
* * ... an optional list of extra arguments to pass to the proc
|
||||
*/
|
||||
/datum/callback/New(thingtocall, proctocall, ...)
|
||||
if (thingtocall)
|
||||
object = thingtocall
|
||||
@@ -58,7 +75,14 @@
|
||||
arguments = args.Copy(3)
|
||||
if(usr)
|
||||
user = WEAKREF(usr)
|
||||
|
||||
/**
|
||||
* Immediately Invoke proctocall on thingtocall, with waitfor set to false
|
||||
*
|
||||
* Arguments:
|
||||
* * thingtocall Object to call on
|
||||
* * proctocall Proc to call on that object
|
||||
* * ... optional list of arguments to pass as arguments to the proc being called
|
||||
*/
|
||||
/world/proc/ImmediateInvokeAsync(thingtocall, proctocall, ...)
|
||||
set waitfor = FALSE
|
||||
|
||||
@@ -72,6 +96,14 @@
|
||||
else
|
||||
call(thingtocall, proctocall)(arglist(calling_arguments))
|
||||
|
||||
/**
|
||||
* Invoke this callback
|
||||
*
|
||||
* Calls the registered proc on the registered object, if the user ref
|
||||
* can be resolved it also inclues that as an arg
|
||||
*
|
||||
* If the datum being called on is varedited, the call is wrapped via WrapAdminProcCall
|
||||
*/
|
||||
/datum/callback/proc/Invoke(...)
|
||||
if(!usr)
|
||||
var/datum/weakref/W = user
|
||||
@@ -97,7 +129,14 @@
|
||||
return call(delegate)(arglist(calling_arguments))
|
||||
return call(object, delegate)(arglist(calling_arguments))
|
||||
|
||||
//copy and pasted because fuck proc overhead
|
||||
/**
|
||||
* Invoke this callback async (waitfor=false)
|
||||
*
|
||||
* Calls the registered proc on the registered object, if the user ref
|
||||
* can be resolved it also inclues that as an arg
|
||||
*
|
||||
* If the datum being called on is varedited, the call is wrapped via WrapAdminProcCall
|
||||
*/
|
||||
/datum/callback/proc/InvokeAsync(...)
|
||||
set waitfor = FALSE
|
||||
|
||||
@@ -125,7 +164,9 @@
|
||||
return call(delegate)(arglist(calling_arguments))
|
||||
return call(object, delegate)(arglist(calling_arguments))
|
||||
|
||||
|
||||
/**
|
||||
Helper datum for the select callbacks proc
|
||||
*/
|
||||
/datum/callback_select
|
||||
var/list/finished
|
||||
var/pendingcount
|
||||
@@ -150,15 +191,17 @@
|
||||
if (savereturn)
|
||||
finished[index] = rtn
|
||||
|
||||
|
||||
|
||||
|
||||
//runs a list of callbacks asynchronously, returning once all of them return.
|
||||
//callbacks can be repeated.
|
||||
//callbacks-args is an optional list of argument lists, in the same order as the callbacks,
|
||||
// the inner lists will be sent to the callbacks when invoked() as additional args.
|
||||
//can optionly save and return a list of return values, in the same order as the original list of callbacks
|
||||
//resolution is the number of byond ticks between checks.
|
||||
/**
|
||||
* Runs a list of callbacks asyncronously, returning only when all have finished
|
||||
*
|
||||
* Callbacks can be repeated, to call it multiple times
|
||||
*
|
||||
* Arguments:
|
||||
* * list/callbacks the list of callbacks to be called
|
||||
* * list/callback_args the list of lists of arguments to pass into each callback
|
||||
* * savereturns Optionally save and return the list of returned values from each of the callbacks
|
||||
* * resolution The number of byond ticks between each time you check if all callbacks are complete
|
||||
*/
|
||||
/proc/callback_select(list/callbacks, list/callback_args, savereturns = TRUE, resolution = 1)
|
||||
if (!callbacks)
|
||||
return
|
||||
@@ -178,3 +221,5 @@
|
||||
sleep(resolution*world.tick_lag)
|
||||
return CS.finished
|
||||
|
||||
/proc/___callbacknew(typepath, arguments)
|
||||
new typepath(arglist(arguments))
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
/datum/component/nanites/RegisterWithParent()
|
||||
. = ..()
|
||||
RegisterSignal(parent, COMSIG_HAS_NANITES, .proc/confirm_nanites)
|
||||
RegisterSignal(parent, COMSIG_NANITE_IS_STEALTHY, .proc/check_stealth)
|
||||
RegisterSignal(parent, COMSIG_NANITE_UI_DATA, .proc/nanite_ui_data)
|
||||
RegisterSignal(parent, COMSIG_NANITE_GET_PROGRAMS, .proc/get_programs)
|
||||
RegisterSignal(parent, COMSIG_NANITE_SET_VOLUME, .proc/set_volume)
|
||||
@@ -57,10 +58,12 @@
|
||||
RegisterSignal(parent, COMSIG_LIVING_MINOR_SHOCK, .proc/on_minor_shock)
|
||||
RegisterSignal(parent, COMSIG_SPECIES_GAIN, .proc/check_viable_biotype)
|
||||
RegisterSignal(parent, COMSIG_NANITE_SIGNAL, .proc/receive_signal)
|
||||
RegisterSignal(parent, COMSIG_NANITE_COMM_SIGNAL, .proc/receive_comm_signal)
|
||||
|
||||
/datum/component/nanites/UnregisterFromParent()
|
||||
. = ..()
|
||||
UnregisterSignal(parent, list(COMSIG_HAS_NANITES,
|
||||
COMSIG_NANITE_IS_STEALTHY,
|
||||
COMSIG_NANITE_UI_DATA,
|
||||
COMSIG_NANITE_GET_PROGRAMS,
|
||||
COMSIG_NANITE_SET_VOLUME,
|
||||
@@ -79,7 +82,8 @@
|
||||
COMSIG_LIVING_MINOR_SHOCK,
|
||||
COMSIG_MOVABLE_HEAR,
|
||||
COMSIG_SPECIES_GAIN,
|
||||
COMSIG_NANITE_SIGNAL))
|
||||
COMSIG_NANITE_SIGNAL,
|
||||
COMSIG_NANITE_COMM_SIGNAL))
|
||||
|
||||
/datum/component/nanites/Destroy()
|
||||
STOP_PROCESSING(SSnanites, src)
|
||||
@@ -188,6 +192,9 @@
|
||||
var/datum/nanite_program/NP = X
|
||||
NP.on_minor_shock()
|
||||
|
||||
/datum/component/nanites/proc/check_stealth(datum/source)
|
||||
return stealth
|
||||
|
||||
/datum/component/nanites/proc/on_death(datum/source, gibbed)
|
||||
for(var/X in programs)
|
||||
var/datum/nanite_program/NP = X
|
||||
@@ -198,6 +205,12 @@
|
||||
var/datum/nanite_program/NP = X
|
||||
NP.receive_signal(code, source)
|
||||
|
||||
/datum/component/nanites/proc/receive_comm_signal(datum/source, comm_code, comm_message, comm_source = "an unidentified source")
|
||||
for(var/X in programs)
|
||||
if(istype(X, /datum/nanite_program/triggered/comm))
|
||||
var/datum/nanite_program/triggered/comm/NP = X
|
||||
NP.receive_comm_signal(comm_code, comm_message, comm_source)
|
||||
|
||||
/datum/component/nanites/proc/check_viable_biotype()
|
||||
if(!(MOB_ORGANIC in host_mob.mob_biotypes) && !(MOB_UNDEAD in host_mob.mob_biotypes))
|
||||
qdel(src) //bodytype no longer sustains nanites
|
||||
|
||||
@@ -96,7 +96,6 @@
|
||||
CLONE:<font size='1'><a href='?_src_=vars;[HrefToken()];mobToDamage=[refid];adjustDamage=clone' id='clone'>[M.getCloneLoss()]</a>
|
||||
BRAIN:<font size='1'><a href='?_src_=vars;[HrefToken()];mobToDamage=[refid];adjustDamage=brain' id='brain'>[M.getOrganLoss(ORGAN_SLOT_BRAIN)]</a>
|
||||
STAMINA:<font size='1'><a href='?_src_=vars;[HrefToken()];mobToDamage=[refid];adjustDamage=stamina' id='stamina'>[M.getStaminaLoss()]</a>
|
||||
AROUSAL:<font size='1'><a href='?_src_=vars;[HrefToken()];mobToDamage=[refid];adjustDamage=arousal' id='arousal'>[M.getArousalLoss()]</a>
|
||||
"}
|
||||
if(GLOB.Debug2)
|
||||
atomsnowflake += {"
|
||||
@@ -1359,9 +1358,6 @@
|
||||
if("stamina")
|
||||
L.adjustStaminaLoss(amount)
|
||||
newamt = L.getStaminaLoss()
|
||||
if("arousal")
|
||||
L.adjustArousalLoss(amount)
|
||||
newamt = L.getArousalLoss()
|
||||
if("heart")
|
||||
L.adjustOrganLoss(ORGAN_SLOT_HEART, amount)
|
||||
newamt = L.getOrganLoss(ORGAN_SLOT_HEART)
|
||||
|
||||
+2
-6
@@ -132,12 +132,8 @@
|
||||
//CIT CHANGE - makes arousal update when transfering bodies
|
||||
if(isliving(new_character)) //New humans and such are by default enabled arousal. Let's always use the new mind's prefs.
|
||||
var/mob/living/L = new_character
|
||||
if(L.client && L.client.prefs)
|
||||
L.canbearoused = L.client.prefs.arousable //Technically this should make taking over a character mean the body gain the new minds setting...
|
||||
L.update_arousal_hud() //Removes the old icon
|
||||
if (L.client.prefs.auto_ooc)
|
||||
if (L.client.prefs.chat_toggles & CHAT_OOC)
|
||||
L.client.prefs.chat_toggles ^= CHAT_OOC
|
||||
if(L.client && L.client.prefs & L.client.prefs.auto_ooc & L.client.prefs.chat_toggles & CHAT_OOC)
|
||||
DISABLE_BITFIELD(L.client.prefs.chat_toggles,CHAT_OOC)
|
||||
|
||||
SEND_SIGNAL(src, COMSIG_MIND_TRANSFER, new_character, old_character)
|
||||
SEND_SIGNAL(new_character, COMSIG_MOB_ON_NEW_MIND)
|
||||
|
||||
@@ -239,7 +239,14 @@
|
||||
mood_change = -3
|
||||
timeout = 1000
|
||||
|
||||
/datum/mood_event/nanite_sadness
|
||||
description = "<span class='warning robot'>+++++++HAPPINESS SUPPRESSION+++++++</span>\n"
|
||||
mood_change = -7
|
||||
/datum/mood_event/daylight_2
|
||||
description = "<span class='boldwarning'>I have been scorched by the unforgiving rays of the sun.</span>\n"
|
||||
mood_change = -6
|
||||
timeout = 1200
|
||||
|
||||
/datum/mood_event/nanite_sadness/add_effects(message)
|
||||
description = "<span class='warning robot'>+++++++[message]+++++++</span>\n"
|
||||
|
||||
|
||||
@@ -142,6 +142,16 @@
|
||||
mood_change = 2
|
||||
timeout = 15 MINUTES
|
||||
|
||||
/datum/mood_event/nanite_happiness
|
||||
description = "<span class='nicegreen robot'>+++++++HAPPINESS ENHANCEMENT+++++++</span>\n"
|
||||
mood_change = 7
|
||||
|
||||
/datum/mood_event/nanite_happiness/add_effects(message)
|
||||
description = "<span class='nicegreen robot'>+++++++[message]+++++++</span>\n"
|
||||
|
||||
/datum/mood_event/area
|
||||
description = "" //Fill this out in the area
|
||||
mood_change = 0
|
||||
//Power gamer stuff below
|
||||
/datum/mood_event/drankblood
|
||||
description = "<span class='nicegreen'>I have fed greedly from that which nourishes me.</span>\n"
|
||||
|
||||
@@ -92,19 +92,10 @@
|
||||
name = "Nymphomania"
|
||||
desc = "You're always feeling a bit in heat. Also, you get aroused faster than usual."
|
||||
value = 0
|
||||
mob_trait = TRAIT_NYMPHO
|
||||
mob_trait = TRAIT_PERMABONER
|
||||
gain_text = "<span class='notice'>You are feeling extra wild.</span>"
|
||||
lose_text = "<span class='notice'>You don't feel that burning sensation anymore.</span>"
|
||||
|
||||
/datum/quirk/libido/add()
|
||||
quirk_holder.min_arousal = 16
|
||||
quirk_holder.arousal_rate = 3
|
||||
|
||||
/datum/quirk/libido/remove()
|
||||
if(quirk_holder)
|
||||
quirk_holder.min_arousal = initial(quirk_holder.min_arousal)
|
||||
quirk_holder.arousal_rate = initial(quirk_holder.arousal_rate)
|
||||
|
||||
/datum/quirk/maso
|
||||
name = "Masochism"
|
||||
desc = "You are aroused by pain."
|
||||
@@ -113,15 +104,6 @@
|
||||
gain_text = "<span class='notice'>You desire to be hurt.</span>"
|
||||
lose_text = "<span class='notice'>Pain has become less exciting for you.</span>"
|
||||
|
||||
/datum/quirk/exhibitionism
|
||||
name = "Exhibitionism"
|
||||
desc = "You don't mind showing off your bare body to strangers, in fact you find it quite satistying."
|
||||
value = 0
|
||||
medical_record_text = "Patient has been diagnosed with exhibitionistic disorder."
|
||||
mob_trait = TRAIT_EXHIBITIONIST
|
||||
gain_text = "<span class='notice'>You feel like exposing yourself to the world.</span>"
|
||||
lose_text = "<span class='notice'>Indecent exposure doesn't sound as charming to you anymore.</span>"
|
||||
|
||||
/datum/quirk/coldblooded
|
||||
name = "Cold-blooded"
|
||||
desc = "Your body doesn't create its own internal heat, requiring external heat regulation."
|
||||
|
||||
Reference in New Issue
Block a user