Merge branch 'master' into upstream-merge-32307

This commit is contained in:
LetterJay
2017-11-01 07:22:39 -04:00
committed by GitHub
19 changed files with 299 additions and 644 deletions
+11 -13
View File
@@ -6,6 +6,10 @@
var/datum/parent
/datum/component/New(datum/P, ...)
if(type == /datum/component)
qdel(src)
CRASH("[type] instantiated!")
parent = P
var/list/arguments = args.Copy()
arguments.Cut(1, 2)
@@ -56,7 +60,7 @@
var/test = dc[I]
if(test) //already another component of this type here
var/list/components_of_type
if(!islist(test))
if(!length(test))
components_of_type = list(test)
dc[I] = components_of_type
else
@@ -91,10 +95,9 @@
/datum/component/proc/_RemoveFromParent()
var/datum/P = parent
var/list/dc = P.datum_components
var/our_type = type
for(var/I in _GetInverseTypeList(our_type))
for(var/I in _GetInverseTypeList())
var/list/components_of_type = dc[I]
if(islist(components_of_type)) //
if(length(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
@@ -133,10 +136,6 @@
set waitfor = FALSE
return
<<<<<<< HEAD
/datum/component/proc/_GetInverseTypeList(current_type)
. = list(current_type)
=======
/datum/component/proc/_GetInverseTypeList(our_type = type)
#if DM_VERSION > 511
#warning Remove this hack for http://www.byond.com/forum/?post=73469
@@ -146,7 +145,6 @@
var/current_type = parent_type
. = list(our_type, current_type)
//and since most components are root level + 1, this won't even have to run
>>>>>>> 828ff86... Merge pull request #32307 from tgstation/Cyberboss-patch-1
while (current_type != /datum/component)
current_type = type2parent(current_type)
. += current_type
@@ -158,7 +156,7 @@
var/list/arguments = args.Copy()
arguments.Cut(1, 2)
var/target = comps[/datum/component]
if(!islist(target))
if(!length(target))
var/datum/component/C = target
if(!C.enabled)
return FALSE
@@ -194,7 +192,7 @@
if(!dc)
return null
. = dc[c_type]
if(islist(.))
if(length(.))
return .[1]
/datum/proc/GetExactComponent(c_type)
@@ -203,7 +201,7 @@
return null
var/datum/component/C = dc[c_type]
if(C)
if(islist(C))
if(length(C))
C = C[1]
if(C.type == c_type)
return C
@@ -214,7 +212,7 @@
if(!dc)
return null
. = dc[c_type]
if(!islist(.))
if(!length(.))
return list(.)
/datum/proc/AddComponent(new_type, ...)