Files
Bubberstation/code/game/objects/items/implants/implant.dm
MrMelbert f8f3dbed98 Completely removes proc_holders from existence. Refactors all wizard, xeno, spider, and genetics powers to be actions. Also refactors and sorts ton of accompanying code. (#67083)
* destroy proc holder pt1
- change proc_holder/spell to action/cooldown/spell
- docs all the spell vars, renames some of them
- removes some useless vars
- start with pointed spells, as they're easy

* kill proc_holder pt2
- kill a buncha vars and replace it with flags
- convert a ton over
- general code improvements

* kill proc_holders pt3
- convert a good few more spells
- rename some signals
- handle statpanel
- better docs

* kiill proc_holder pt4:
- restructure the file system of action.dm, separating a good amount of item actions and miscellaneous garbage into files where they belong slightly better. Also splits off item actions, cooldown actions, innate actions, etc. into their own files, overlal making it much better to work with
- converts touch attacks to actions
- converts blood crawl, jaunt subtype

* kills proc_holder pt5
- clears up some icon issues so all the currently converted pages don't have errors
- shapeshift
- some more action cleanup

* kills proc_holder pt5.5:
- some documentation
- reworks feedback to prevent oversight with teleports and stuff

* kills proc_holder pt6:
- converted cult spells
- converted magic missile
- converted mime spells
- chipped away at the errors
- removed some vars which were too general, replaced them with more locally applicable vars. for example "range" which could mean "projectile range" or "aoe radius" or whatever - instead of having a broad net which everyone applies to in a confusing matter, instead lets each spell delegate on their own.
- merged magic/spell and magic/aoe, as the comment intended
- more unified behavior for spell levelling

* kill proc_holders pt 6.5:
- replacing a buncha old proc_holders that have been updated to reduce some errors. sub 900 baby

* kills proc_holder pt 6.75:
- minor fixes

* kills proc_holder pt7:
- cuts down on some errors
- refactors some wiz events

* kills proc_holder pt 7.5:
- malf ranged modules
- some minor errors

* kills proc_holder pt 7.75:
- mor eminor error handling, cleaning up changes

* kill proc_holder pt8:
- refactors spell book
- refactors spell implant
- some more minor error fixing

* kill proc_holder pt 8.5:
- scan ability

* Adds some robust documentation

* kill proc_holder pt9:
- converts some / most mutations over

* kill proc_holder pt10:
- sort out all the granters
- refactor them slightly
- fix some compile errors

* Some set-unset sanity - going to need to test removing Share()

* Removes transfer actions. It doesn't seem to do anything.
- Transfer_actions was called when current = new_character so locially speaking the early return in Grant() should cause it to NOOP. Test this in the future though

* Removes sharing from actions, docs actions better

* Some better documentation for spell and spell components

* Kills proc_holder pt11:
- Finally finishes ALL THE SPELLS IN THE SPELL FOLDER
- Fixes some more errors

* kills proc_holder pt11.5:
- minor error fixing and sanity

* Method of sharing actions. Can be improved  in the future, needs testing

* Implements a way to update the stat panel entry for a spell. Also gets rid of VV stuff, as you can update the bigflags directly in VV now.

* Curse of madness bug I put in.

* kills proc_holder pt12:
- sub 500 errors!
- converts cytology mobs
- converts and refactors spiders slightly
- some minor fixing around the place as usual

* kill proc_holder pt13
- Finishes heretic spells
- Sub 300 errors!
- some touch refactoring to account for mansus grasp

* kills proc_holder pt14:
- revenant
- minor bugfixing for heretic stuff

* kills proc_holder pt14.5:
- some missed stuff for revenant + heretic

* kills proc_holder pt15:
- alien abilities
- more minor fixing
- sub 100 errors. The end is nigh

* kill proc_holder pt16? 17:
- Finishes cult spells
- sub 50 errors!
- refactors the way charge works
- renames / moves some signals

* kills proc_holder pt final:
- sdql spells
- no more errors!

* Bugfixes round 1

* Various bugfixing
- documentation done
- give spell works
- can cast spell gives feedback conditionally
- is available takes into account casting ability

* Some accidental reversions + fixes

* Unit tests

* Completely refactors jaunting
- All bloodcrawling is now handled on the action itself instead of across various living procs
- slaughter demons have their own blood crawls
- jaunting dummies don't have side effects on destroy() anymore

* Wizard spell logging and even more refactoring
2022-07-01 02:01:02 -04:00

141 lines
4.2 KiB
Plaintext

/**
* Parent class for all implants
*/
/obj/item/implant
name = "implant"
icon = 'icons/obj/implants.dmi'
icon_state = "generic" //Shows up as the action button icon
item_flags = DROPDEL
// This gives the user an action button that allows them to activate the implant.
// If the implant needs no action button, then null this out.
// Or, if you want to add a unique action button, then replace this.
actions_types = list(/datum/action/item_action/hands_free/activate)
///the mob that's implanted with this
var/mob/living/imp_in = null
///implant color, used for selecting either the "b" version or the "r" version of the implant case sprite when the implant is in a case.
var/implant_color = "b"
///if false, upon implantation of a duplicate implant, an attempt to combine the new implant's uses with the old one's uses will be made, deleting the new implant if successful or stopping the implantation if not
var/allow_multiple = FALSE
///how many times this can do something, only relevant for implants with limited uses
var/uses = -1
/obj/item/implant/proc/activate()
SEND_SIGNAL(src, COMSIG_IMPLANT_ACTIVATED)
/obj/item/implant/ui_action_click()
INVOKE_ASYNC(src, .proc/activate, "action_button")
/obj/item/implant/item_action_slot_check(slot, mob/user)
return user == imp_in
/obj/item/implant/proc/can_be_implanted_in(mob/living/target)
if(issilicon(target))
return FALSE
if(isslime(target))
return TRUE
if(isanimal(target))
var/mob/living/simple_animal/animal = target
// Robots and most non-organics aren't healable.
return animal.healable
return TRUE
/**
* What does the implant do upon injection?
*
* return true if the implant injects
* return false if there is no room for implant / it fails
* Arguments:
* * mob/living/target - mob being implanted
* * mob/user - mob doing the implanting
* * silent - unused here
* * force - if true, implantation will not fail if can_be_implanted_in returns false
*/
/obj/item/implant/proc/implant(mob/living/target, mob/user, silent = FALSE, force = FALSE)
if(SEND_SIGNAL(src, COMSIG_IMPLANT_IMPLANTING, args) & COMPONENT_STOP_IMPLANTING)
return
LAZYINITLIST(target.implants)
if(!force && !can_be_implanted_in(target))
return FALSE
for(var/X in target.implants)
var/obj/item/implant/other_implant = X
var/flags = SEND_SIGNAL(other_implant, COMSIG_IMPLANT_OTHER, args, src)
if(flags & COMPONENT_STOP_IMPLANTING)
UNSETEMPTY(target.implants)
return FALSE
if(flags & COMPONENT_DELETE_NEW_IMPLANT)
UNSETEMPTY(target.implants)
qdel(src)
return TRUE
if(flags & COMPONENT_DELETE_OLD_IMPLANT)
qdel(other_implant)
continue
if(!istype(other_implant, type) || allow_multiple)
continue
if(other_implant.uses < initial(other_implant.uses)*2)
if(uses == -1)
other_implant.uses = -1
else
other_implant.uses = min(other_implant.uses + uses, initial(other_implant.uses)*2)
qdel(src)
return TRUE
else
return FALSE
forceMove(target)
imp_in = target
target.implants += src
for(var/datum/action/implant_action as anything in actions)
implant_action.Grant(target)
if(ishuman(target))
var/mob/living/carbon/human/target_human = target
target_human.sec_hud_set_implants()
if(user)
log_combat(user, target, "implanted", "\a [name]")
SEND_SIGNAL(src, COMSIG_IMPLANT_IMPLANTED, target, user, silent, force)
return TRUE
/**
* Remove implant from mob.
*
* This removes the effects of the implant and moves it out of the mob and into nullspace.
* Arguments:
* * mob/living/source - What the implant is being removed from
* * silent - unused here
* * special - unused here
*/
/obj/item/implant/proc/removed(mob/living/source, silent = FALSE, special = 0)
moveToNullspace()
imp_in = null
source.implants -= src
for(var/datum/action/implant_action as anything in actions)
implant_action.Remove(source)
if(ishuman(source))
var/mob/living/carbon/human/human_source = source
human_source.sec_hud_set_implants()
SEND_SIGNAL(src, COMSIG_IMPLANT_REMOVED, source, silent, special)
return TRUE
/obj/item/implant/Destroy()
if(imp_in)
removed(imp_in)
return ..()
/**
* Gets implant specifications for the implant pad
*/
/obj/item/implant/proc/get_data()
return "No information available"
/obj/item/implant/dropped(mob/user)
. = TRUE
..()