mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-25 01:22:13 +00:00
/obj/effects is now /obj/effect. /obj/station_objects is now /obj/structure. Did a bit of minor blob work. The Bay 12 body bags were replaced with closets because having two sets of code that do almost the same thing is silly. Changed back a few of the last jobproc edits as the remove from list before assign was a check to see if the mob was fucked up and if it was remove it so we did not check it again as it would still be fucked up. The medbay/tox monkeys names are random once more. More random name monkeys will help with changeling and clean up the observe/mob menus. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2324 316c924e-a436-60f5-8080-3fe189b3f50e
265 lines
6.6 KiB
Plaintext
265 lines
6.6 KiB
Plaintext
//TODO: Move cyber organs active/inactive stats to vars.
|
|
|
|
//flags for organType
|
|
#define CYBER 1
|
|
#define SPELL 2
|
|
|
|
/obj/effect/organstructure //used obj for the "contents" var
|
|
name = "organs"
|
|
|
|
var/obj/item/weapon/cell/mainPowerCell = null //for ease of refernce for installed c. implants
|
|
var/species = "mob" //for speaking in unknown languages purposes
|
|
|
|
var/obj/effect/organ/limb/arms/arms = null
|
|
var/obj/effect/organ/limb/legs/legs = null
|
|
var/obj/effect/organ/chest/chest = null
|
|
|
|
proc/FindMainPowercell()
|
|
if(chest) //priority goes to chest implant, if there is one
|
|
if((chest.organType & CYBER) && chest.canExportPower && chest.cell)
|
|
mainPowerCell = chest.cell
|
|
return
|
|
var/list/organs = GetAllContents()
|
|
for(var/obj/effect/organ/otherOrgan in organs) //otherwise, maybe some other organ fits the criteria?
|
|
if((otherOrgan.organType & CYBER) && otherOrgan.canExportPower && otherOrgan.cell)
|
|
mainPowerCell = otherOrgan:cell
|
|
return
|
|
mainPowerCell = null //otherwise, seems there's no main cell
|
|
return
|
|
|
|
proc/GetSpeciesName()
|
|
var/list/speciesPresent = list()
|
|
|
|
for(var/obj/effect/organ/organ in src) //only external organs count, since it's judging by the appearance
|
|
if(speciesPresent[organ.species])
|
|
speciesPresent[organ.species]++
|
|
else
|
|
speciesPresent[organ.species] = 1 //not sure, but I think it's not initialised before that, so can't ++
|
|
|
|
var/list/dominantSpecies = list()
|
|
|
|
for(var/speciesName in speciesPresent)
|
|
if(!dominantSpecies.len)
|
|
dominantSpecies += speciesName
|
|
else
|
|
if(speciesPresent[dominantSpecies[1]] == speciesPresent[speciesName])
|
|
dominantSpecies += speciesName
|
|
else if(speciesPresent[dominantSpecies[1]] < speciesPresent[speciesName])
|
|
dominantSpecies = list(speciesName)
|
|
|
|
if(!dominantSpecies.len)
|
|
species = "mob"
|
|
else
|
|
species = pick(dominantSpecies)
|
|
|
|
return
|
|
|
|
proc/RecalculateStructure()
|
|
var/list/organs = GetAllContents()
|
|
|
|
arms = locate(/obj/effect/organ/limb/arms) in organs
|
|
legs = locate(/obj/effect/organ/limb/legs) in organs
|
|
chest = locate(/obj/effect/organ/chest) in organs
|
|
|
|
GetSpeciesName()
|
|
FindMainPowercell()
|
|
|
|
return
|
|
|
|
proc/ProcessOrgans()
|
|
set background = 1
|
|
|
|
var/list/organs = GetAllContents()
|
|
for(var/obj/effect/organ/organ in organs)
|
|
organ.ProcessOrgan()
|
|
|
|
return
|
|
|
|
New()
|
|
..()
|
|
RecalculateStructure()
|
|
|
|
/obj/effect/organstructure/human
|
|
name = "human organs"
|
|
|
|
New()
|
|
//new /obj/effect/organ/limb/arms/human(src)
|
|
//new /obj/effect/organ/limb/legs/human(src)
|
|
new /obj/effect/organ/chest/human(src)
|
|
..()
|
|
|
|
/obj/effect/organstructure/cyber
|
|
name = "cyborg organs"
|
|
|
|
New()
|
|
//new /obj/effect/organ/limb/arms/cyber(src)
|
|
//new /obj/effect/organ/limb/legs/cyber(src)
|
|
new /obj/effect/organ/chest/cyber(src)
|
|
..()
|
|
|
|
/obj/effect/organ
|
|
name = "organ"
|
|
|
|
//All types
|
|
var/organType = 0 //CYBER and SPELL go here
|
|
var/species = "mob"
|
|
var/obj/effect/organstructure/rootOrganStructure = null
|
|
|
|
New(location)
|
|
..()
|
|
|
|
rootOrganStructure = FindRootStructure()
|
|
|
|
proc/FindRootStructure()
|
|
if(istype(loc,/obj/effect/organ))
|
|
var/obj/effect/organ/parent = loc
|
|
return parent.FindRootStructure()
|
|
else if(istype(loc,/obj/effect/organstructure))
|
|
return loc
|
|
return null
|
|
|
|
proc/ProcessOrgan()
|
|
set background = 1
|
|
|
|
if(organType & CYBER)
|
|
var/hasPower = DrainPower()
|
|
if(!hasPower && active)
|
|
Deactivate()
|
|
else if(hasPower && !active)
|
|
Activate()
|
|
|
|
//CYBORG type
|
|
var/obj/item/weapon/cell/cell = null
|
|
var/canExportPower = 0 //only comes in play if it has a cell
|
|
var/active = 0
|
|
var/powerDrainPerTick = 0
|
|
|
|
proc/DrainPower()
|
|
set background = 1
|
|
|
|
if(!powerDrainPerTick)
|
|
return 1
|
|
if(cell)
|
|
if(cell.charge >= powerDrainPerTick)
|
|
cell.charge -= powerDrainPerTick
|
|
return 1
|
|
if(rootOrganStructure.mainPowerCell)
|
|
if(rootOrganStructure.mainPowerCell.charge >= powerDrainPerTick)
|
|
rootOrganStructure.mainPowerCell.charge -= powerDrainPerTick
|
|
return 1
|
|
return 0
|
|
|
|
proc/Activate() //depends on the organ, involves setting active to 1 and changing the organ's vars to reflect its "activated" state
|
|
rootOrganStructure.loc << "\blue Your [name] powers up!"
|
|
active = 1
|
|
return
|
|
|
|
proc/Deactivate() //depends on the organ, involves setting active to 0 and changing the organ's vars to reflect its "deactivated" state
|
|
rootOrganStructure.loc << "\red Your [name] powers down."
|
|
active = 0
|
|
return
|
|
|
|
/obj/effect/organ/limb
|
|
name = "limb"
|
|
|
|
/obj/effect/organ/limb/arms
|
|
name = "arms"
|
|
|
|
var/minDamage = 5 //punching damage
|
|
var/maxDamage = 5
|
|
// var/strangleDelay = 1 //The code is a bit too complicated for that right now
|
|
|
|
/obj/effect/organ/limb/arms/human
|
|
name = "human arms"
|
|
species = "human"
|
|
minDamage = 1
|
|
maxDamage = 9
|
|
|
|
/obj/effect/organ/limb/arms/cyber
|
|
name = "cyborg arms"
|
|
species = "cyborg"
|
|
organType = CYBER
|
|
powerDrainPerTick = 5
|
|
|
|
Activate()
|
|
..()
|
|
minDamage = 3
|
|
maxDamage = 14
|
|
|
|
Deactivate()
|
|
..()
|
|
minDamage = 0
|
|
maxDamage = 3
|
|
|
|
|
|
/obj/effect/organ/limb/legs
|
|
name = "legs"
|
|
|
|
var/moveRunDelay = 1 //not sure about how that works
|
|
var/moveWalkDelay = 7
|
|
//var/knockdownResist = 0
|
|
|
|
/obj/effect/organ/limb/legs/human
|
|
name = "human legs"
|
|
species = "human"
|
|
|
|
/obj/effect/organ/limb/legs/cyber
|
|
name = "cyborg legs"
|
|
species = "cyborg"
|
|
organType = CYBER
|
|
powerDrainPerTick = 5
|
|
|
|
Activate()
|
|
..()
|
|
moveRunDelay = 0
|
|
moveWalkDelay = 3
|
|
|
|
Deactivate()
|
|
..()
|
|
moveRunDelay = 2
|
|
moveWalkDelay = 10
|
|
|
|
|
|
/obj/effect/organ/chest
|
|
name = "chest"
|
|
var/maxHealth = 50 //right now, the mob's (only humans for now) health depends only on it. Will be fixed later
|
|
|
|
/obj/effect/organ/chest/human
|
|
name = "human chest"
|
|
species = "human"
|
|
maxHealth = 100
|
|
|
|
New()
|
|
..()
|
|
new /obj/effect/organ/limb/arms/human(src)
|
|
new /obj/effect/organ/limb/legs/human(src)
|
|
|
|
/obj/effect/organ/chest/cyber
|
|
name = "cyborg chest"
|
|
species = "cyborg"
|
|
organType = CYBER
|
|
canExportPower = 1
|
|
maxHealth = 150
|
|
|
|
New()
|
|
..()
|
|
cell = new /obj/item/weapon/cell/high(src)
|
|
cell.charge = cell.maxcharge
|
|
new /obj/effect/organ/limb/arms/cyber(src)
|
|
new /obj/effect/organ/limb/legs/cyber(src)
|
|
|
|
Activate()
|
|
..()
|
|
canExportPower = 1
|
|
maxHealth = 150
|
|
if(rootOrganStructure.loc && istype(rootOrganStructure.loc,/mob/living))
|
|
var/mob/living/holder = rootOrganStructure.loc
|
|
holder.updatehealth()
|
|
|
|
Deactivate()
|
|
..()
|
|
canExportPower = 0
|
|
maxHealth = 120
|
|
if(rootOrganStructure.loc && istype(rootOrganStructure.loc,/mob/living))
|
|
var/mob/living/holder = rootOrganStructure.loc
|
|
holder.updatehealth() |