mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
[MIRROR] Changing changeling (Refactor) (#11142)
Co-authored-by: Cameron Lennox <killer65311@gmail.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
9feb91ec4c
commit
a0c273ce1f
@@ -146,6 +146,27 @@
|
||||
loc.update_icon()
|
||||
return amount_used
|
||||
|
||||
/// Recharges the cell over time. 100 per second multiplied by the multiplier.
|
||||
/obj/item/cell/proc/gradual_charge(iterations, multiplier, sparks, mob/living/user)
|
||||
var/charged_object = src
|
||||
if(!multiplier || iterations <= 0)
|
||||
return
|
||||
if(user) //If we have a user, time to check to make sure they're adjacent/holding us!
|
||||
if(istype(loc, /obj/machinery/power/apc)) //We're in an APC!
|
||||
charged_object = loc
|
||||
if(loc != user && !(user in orange(1,charged_object))) //If we have a user fed to us, they need to hold us or be in range of us.
|
||||
if(loc.loc && !istype(loc.loc, user)) //Are we inside of something the user is holding?
|
||||
return
|
||||
charge += 100 * multiplier
|
||||
if(charge > maxcharge)
|
||||
charge = maxcharge
|
||||
if(sparks)
|
||||
var/T = get_turf(src)
|
||||
new /obj/effect/effect/sparks(T)
|
||||
update_icon()
|
||||
iterations--
|
||||
addtimer(CALLBACK(src, PROC_REF(gradual_charge), iterations, multiplier, sparks, user), 1 SECOND, TIMER_DELETE_ME)
|
||||
|
||||
|
||||
/obj/item/cell/examine(mob/user)
|
||||
. = ..()
|
||||
|
||||
Reference in New Issue
Block a user