Merge pull request #21693 from ChangelingRain/cyborgrepair

Fixes cyborg proselytizers being unable to repair clockwork structures with power
This commit is contained in:
AnturK
2016-11-24 21:20:18 +01:00
committed by GitHub
2 changed files with 18 additions and 3 deletions
@@ -187,7 +187,7 @@
var/healing_for_cycle = min(amount_to_heal, repair_amount)
var/alloy_required = healing_for_cycle
if(!proselytizer.can_use_alloy(RATVAR_ALLOY_CHECK))
healing_for_cycle = min(healing_for_cycle, proselytizer.stored_alloy)
healing_for_cycle = min(healing_for_cycle, proselytizer.get_power_alloy())
if(!healing_for_cycle || (!proselytizer.can_use_alloy(RATVAR_ALLOY_CHECK) && !proselytizer.can_use_alloy(healing_for_cycle)))
user << "<span class='warning'>You need at least <b>[alloy_required]</b> liquified alloy to start repairing [src], and at least <b>[amount_to_heal]</b> to fully repair it!</span>"
return
@@ -201,7 +201,7 @@
break
healing_for_cycle = min(amount_to_heal, repair_amount)
if(!proselytizer.can_use_alloy(RATVAR_ALLOY_CHECK))
healing_for_cycle = min(healing_for_cycle, proselytizer.stored_alloy)
healing_for_cycle = min(healing_for_cycle, proselytizer.get_power_alloy())
if(!healing_for_cycle || (!proselytizer.can_use_alloy(RATVAR_ALLOY_CHECK) && !proselytizer.can_use_alloy(healing_for_cycle)) || \
!do_after(user, healing_for_cycle * proselytizer.speed_multiplier, target = src) || \
!proselytizer || (!proselytizer.can_use_alloy(RATVAR_ALLOY_CHECK) && !proselytizer.can_use_alloy(healing_for_cycle)))
@@ -211,7 +211,7 @@
break
healing_for_cycle = min(amount_to_heal, repair_amount)
if(!proselytizer.can_use_alloy(RATVAR_ALLOY_CHECK))
healing_for_cycle = min(healing_for_cycle, proselytizer.stored_alloy)
healing_for_cycle = min(healing_for_cycle, proselytizer.get_power_alloy())
if(!healing_for_cycle || (!proselytizer.can_use_alloy(RATVAR_ALLOY_CHECK) && !proselytizer.can_use_alloy(healing_for_cycle)))
break
obj_integrity = Clamp(obj_integrity + healing_for_cycle, 0, max_integrity)
@@ -48,6 +48,18 @@
..()
if(is_servant_of_ratvar(user) || isobserver(user))
user << "<span class='alloy'>It will use cell charge at a rate of <b>[CLOCKCULT_ALLOY_TO_POWER_MULTIPLIER]</b> charge to <b>1</b> alloy if it has insufficient alloy.</span>"
user << "<span class='alloy'><b>[get_power_alloy()]</b> is usable in this manner.</span>"
/obj/item/clockwork/clockwork_proselytizer/cyborg/get_power_alloy() //returns alloy plus the alloy we have from power, where we need such
var/mob/living/silicon/robot/R = loc
var/alloy_power = 0
var/current_charge = 0
if(istype(R) && R.cell)
current_charge = R.cell.charge
while(current_charge > CLOCKCULT_ALLOY_TO_POWER_MULTIPLIER)
current_charge -= CLOCKCULT_ALLOY_TO_POWER_MULTIPLIER
alloy_power++
return ..() + alloy_power
/obj/item/clockwork/clockwork_proselytizer/cyborg/can_use_alloy(amount)
if(amount != RATVAR_ALLOY_CHECK)
@@ -115,6 +127,9 @@
return ..()
proselytize(target, user)
/obj/item/clockwork/clockwork_proselytizer/proc/get_power_alloy()
return stored_alloy
/obj/item/clockwork/clockwork_proselytizer/proc/modify_stored_alloy(amount)
stored_alloy = Clamp(stored_alloy + amount, 0, max_alloy)
return TRUE