Merge branch 'master' into upstream-merge-29940
This commit is contained in:
+1
-1
@@ -141,7 +141,7 @@
|
||||
afterDraw()
|
||||
|
||||
/obj/effect/ebeam
|
||||
mouse_opacity = 0
|
||||
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
||||
anchored = TRUE
|
||||
var/datum/beam/owner
|
||||
|
||||
|
||||
@@ -1,25 +1,70 @@
|
||||
/datum/component
|
||||
var/enabled = TRUE
|
||||
var/dupe_mode = COMPONENT_DUPE_HIGHLANDER
|
||||
var/dupe_type
|
||||
var/list/signal_procs
|
||||
var/datum/parent
|
||||
|
||||
/datum/component/New(datum/P, ...)
|
||||
parent = P
|
||||
var/list/arguments = args.Copy()
|
||||
arguments.Cut(1, 2)
|
||||
Initialize(arglist(arguments))
|
||||
|
||||
var/dm = dupe_mode
|
||||
if(dm != COMPONENT_DUPE_ALLOWED)
|
||||
var/datum/component/old = P.GetExactComponent(type)
|
||||
if(old)
|
||||
switch(dm)
|
||||
if(COMPONENT_DUPE_HIGHLANDER)
|
||||
InheritComponent(old, FALSE)
|
||||
qdel(old)
|
||||
if(COMPONENT_DUPE_UNIQUE)
|
||||
old.InheritComponent(src, TRUE)
|
||||
qdel(src)
|
||||
return
|
||||
var/dt = dupe_type
|
||||
var/datum/component/old
|
||||
if(!dt)
|
||||
old = P.GetExactComponent(type)
|
||||
else
|
||||
old = P.GetComponent(dt)
|
||||
switch(dm)
|
||||
if(COMPONENT_DUPE_UNIQUE)
|
||||
old.InheritComponent(src, TRUE)
|
||||
parent = null //prevent COMPONENT_REMOVING signal
|
||||
qdel(src)
|
||||
return
|
||||
if(COMPONENT_DUPE_HIGHLANDER)
|
||||
InheritComponent(old, FALSE)
|
||||
qdel(old)
|
||||
|
||||
//let the others know
|
||||
P.SendSignal(COMSIG_COMPONENT_ADDED, src)
|
||||
LAZYADD(P.datum_components, src)
|
||||
parent = P
|
||||
|
||||
//lazy init the parent's dc list
|
||||
var/list/dc = P.datum_components
|
||||
if(!dc)
|
||||
P.datum_components = dc = list()
|
||||
|
||||
//set up the typecache
|
||||
var/our_type = type
|
||||
for(var/I in _GetInverseTypeList(our_type))
|
||||
var/test = dc[I]
|
||||
if(test) //already another component of this type here
|
||||
var/list/components_of_type
|
||||
if(!islist(test))
|
||||
components_of_type = list(test)
|
||||
dc[I] = components_of_type
|
||||
else
|
||||
components_of_type = test
|
||||
if(I == our_type) //exact match, take priority
|
||||
var/inserted = FALSE
|
||||
for(var/J in 1 to components_of_type.len)
|
||||
var/datum/component/C = components_of_type[J]
|
||||
if(C.type != our_type) //but not over other exact matches
|
||||
components_of_type.Insert(J, I)
|
||||
inserted = TRUE
|
||||
break
|
||||
if(!inserted)
|
||||
components_of_type += src
|
||||
else //indirect match, back of the line with ya
|
||||
components_of_type += src
|
||||
else //only component of this type, no list
|
||||
dc[I] = src
|
||||
|
||||
/datum/component/proc/Initialize(...)
|
||||
return
|
||||
|
||||
/datum/component/Destroy()
|
||||
enabled = FALSE
|
||||
@@ -33,7 +78,20 @@
|
||||
/datum/component/proc/_RemoveNoSignal()
|
||||
var/datum/P = parent
|
||||
if(P)
|
||||
LAZYREMOVE(P.datum_components, src)
|
||||
var/list/dc = P.datum_components
|
||||
var/our_type = type
|
||||
for(var/I in _GetInverseTypeList(our_type))
|
||||
var/list/components_of_type = dc[I]
|
||||
if(islist(components_of_type)) //
|
||||
var/list/subtracted = components_of_type - src
|
||||
if(subtracted.len == 1) //only 1 guy left
|
||||
dc[I] = subtracted[1] //make him special
|
||||
else
|
||||
dc[I] = subtracted
|
||||
else //just us
|
||||
dc -= I
|
||||
if(!dc.len)
|
||||
P.datum_components = null
|
||||
parent = null
|
||||
|
||||
/datum/component/proc/RegisterSignal(sig_type, proc_on_self, override = FALSE)
|
||||
@@ -66,36 +124,66 @@
|
||||
/datum/component/proc/OnTransfer(datum/new_parent)
|
||||
return
|
||||
|
||||
/datum/component/proc/AfterComponentActivated()
|
||||
return
|
||||
|
||||
/datum/component/proc/_GetInverseTypeList(current_type)
|
||||
. = list(current_type)
|
||||
while (current_type != /datum/component)
|
||||
current_type = type2parent(current_type)
|
||||
. += current_type
|
||||
|
||||
/datum/proc/SendSignal(sigtype, ...)
|
||||
var/list/comps = datum_components
|
||||
. = FALSE
|
||||
for(var/I in comps)
|
||||
var/datum/component/C = I
|
||||
if(!C.enabled)
|
||||
continue
|
||||
if(C.ReceiveSignal(arglist(args)))
|
||||
if(!comps)
|
||||
return
|
||||
var/target = comps[/datum/component]
|
||||
if(!islist(target))
|
||||
var/datum/component/C = target
|
||||
if(C.enabled && C.ReceiveSignal(arglist(args)))
|
||||
ComponentActivated(C)
|
||||
. = TRUE
|
||||
C.AfterComponentActivated()
|
||||
return TRUE
|
||||
else
|
||||
for(var/I in target)
|
||||
var/datum/component/C = I
|
||||
if(!C.enabled)
|
||||
continue
|
||||
if(C.ReceiveSignal(arglist(args)))
|
||||
ComponentActivated(C)
|
||||
. = TRUE
|
||||
|
||||
/datum/proc/ComponentActivated(datum/component/C)
|
||||
return
|
||||
|
||||
/datum/proc/GetComponent(c_type)
|
||||
for(var/I in datum_components)
|
||||
if(istype(I, c_type))
|
||||
return I
|
||||
var/list/dc = datum_components
|
||||
if(!dc)
|
||||
return null
|
||||
. = dc[c_type]
|
||||
if(islist(.))
|
||||
return .[1]
|
||||
|
||||
/datum/proc/GetExactComponent(c_type)
|
||||
for(var/I in datum_components)
|
||||
var/datum/component/C = I
|
||||
var/list/dc = datum_components
|
||||
if(!dc)
|
||||
return null
|
||||
var/datum/component/C = dc[c_type]
|
||||
if(C)
|
||||
if(islist(C))
|
||||
C = C[1]
|
||||
if(C.type == c_type)
|
||||
return I
|
||||
return C
|
||||
return null
|
||||
|
||||
/datum/proc/GetComponents(c_type)
|
||||
. = list()
|
||||
for(var/I in datum_components)
|
||||
if(istype(I, c_type))
|
||||
. += I
|
||||
var/list/dc = datum_components
|
||||
if(!dc)
|
||||
return null
|
||||
. = dc[c_type]
|
||||
if(!islist(.))
|
||||
return list(.)
|
||||
|
||||
/datum/proc/AddComponent(new_type, ...)
|
||||
var/nt = new_type
|
||||
@@ -103,6 +191,11 @@
|
||||
var/datum/component/C = new nt(arglist(args))
|
||||
return QDELING(C) ? GetComponent(new_type) : C
|
||||
|
||||
/datum/proc/LoadComponent(component_type, ...)
|
||||
. = GetComponent(component_type)
|
||||
if(!.)
|
||||
return AddComponent(arglist(args))
|
||||
|
||||
/datum/proc/TakeComponent(datum/component/C)
|
||||
if(!C)
|
||||
return
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
-
|
||||
@@ -43,7 +43,7 @@
|
||||
SSdisease.active_diseases += DD //Add it to the active diseases list, now that it's actually in a mob and being processed.
|
||||
|
||||
//Copy properties over. This is so edited diseases persist.
|
||||
var/list/skipped = list("affected_mob","holder","carrier","stage","type","parent_type","vars","transformed")
|
||||
var/list/skipped = list("affected_mob","holder","carrier","stage","type","parent_type","vars","transformed","symptoms")
|
||||
for(var/V in DD.vars)
|
||||
if(V in skipped)
|
||||
continue
|
||||
|
||||
@@ -57,9 +57,7 @@
|
||||
symptoms = GenerateSymptoms(0, 2)
|
||||
else
|
||||
for(var/datum/symptom/S in D.symptoms)
|
||||
var/datum/symptom/new_symp = new S.type
|
||||
new_symp.name = S.name
|
||||
new_symp.neutered = S.neutered
|
||||
var/datum/symptom/new_symp = S.Copy()
|
||||
symptoms += new_symp
|
||||
|
||||
Refresh()
|
||||
|
||||
+9
-1
@@ -400,7 +400,15 @@
|
||||
if (assigned_role in GLOB.command_positions)
|
||||
text += "<b>HEAD</b>|loyal|employee|headrev|rev"
|
||||
else if (src in SSticker.mode.head_revolutionaries)
|
||||
text += "head|loyal|<a href='?src=\ref[src];revolution=clear'>employee</a>|<b>HEADREV</b>|<a href='?src=\ref[src];revolution=rev'>rev</a>"
|
||||
var/last_healthy_headrev = TRUE
|
||||
for(var/I in SSticker.mode.head_revolutionaries)
|
||||
if(I == src)
|
||||
continue
|
||||
var/mob/M = I
|
||||
if(M.z == ZLEVEL_STATION && !M.stat)
|
||||
last_healthy_headrev = FALSE
|
||||
break
|
||||
text += "head|loyal|<a href='?src=\ref[src];revolution=clear'>employee</a>|<b>[last_healthy_headrev ? "<font color='red'>LAST </font> " : ""]HEADREV</b>|<a href='?src=\ref[src];revolution=rev'>rev</a>"
|
||||
text += "<br>Flash: <a href='?src=\ref[src];revolution=flash'>give</a>"
|
||||
|
||||
var/list/L = current.get_contents()
|
||||
|
||||
Reference in New Issue
Block a user