mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-06 06:52:39 +00:00
Basically, all ethereal charge capacity and interactions have been scaled upwards by 20x. Power wise, ethereals now hold up to 3000, with the max safe threshold being 2000. For reference, upgraded powercells can hold 2500, with high capacity holding 10K). All appropriate values have been tweaked to match this change. There shouldn't be ANY sort of noticeable difference in game, aside from power sources depleting faster, and a few values which I decided to tweak for balance reasons. They are: power cell draining time is 1.5 seconds longer, and light draining time is 0.5 shorter. Also, draining cells has less of a punishment multiplier upon the cell now, (originally, the the cell lost 33x as much as you received. now its 12x). (to avoid returning to this in why its good, I did this because now that ethereals are capable of holding more, I can afford to have less of a punishment, while still maintaining a reasonable level of punishment). Also some minor code and grammar improvements.
410 lines
12 KiB
Plaintext
410 lines
12 KiB
Plaintext
#define CELL_DRAIN_TIME 35
|
|
#define CELL_POWER_GAIN 60
|
|
#define CELL_POWER_DRAIN 750
|
|
|
|
/obj/item/stock_parts/cell
|
|
name = "power cell"
|
|
desc = "A rechargeable electrochemical power cell."
|
|
icon = 'icons/obj/power.dmi'
|
|
icon_state = "cell"
|
|
inhand_icon_state = "cell"
|
|
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
|
|
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
|
|
force = 5
|
|
throwforce = 5
|
|
throw_speed = 2
|
|
throw_range = 5
|
|
w_class = WEIGHT_CLASS_SMALL
|
|
var/charge = 0 // note %age conveted to actual charge in New
|
|
var/maxcharge = 1000
|
|
custom_materials = list(/datum/material/iron=700, /datum/material/glass=50)
|
|
grind_results = list(/datum/reagent/lithium = 15, /datum/reagent/iron = 5, /datum/reagent/silicon = 5)
|
|
var/rigged = FALSE /// If the cell has been booby-trapped by injecting it with plasma. Chance on use() to explode.
|
|
var/corrupted = FALSE /// If the power cell was damaged by an explosion, chance for it to become corrupted and function the same as rigged.
|
|
var/chargerate = 100 //how much power is given every tick in a recharger
|
|
var/self_recharge = 0 //does it self recharge, over time, or not?
|
|
var/ratingdesc = TRUE
|
|
var/grown_battery = FALSE // If it's a grown that acts as a battery, add a wire overlay to it.
|
|
|
|
/obj/item/stock_parts/cell/get_cell()
|
|
return src
|
|
|
|
/obj/item/stock_parts/cell/Initialize(mapload, override_maxcharge)
|
|
. = ..()
|
|
START_PROCESSING(SSobj, src)
|
|
create_reagents(5, INJECTABLE | DRAINABLE)
|
|
if (override_maxcharge)
|
|
maxcharge = override_maxcharge
|
|
charge = maxcharge
|
|
if(ratingdesc)
|
|
desc += " This one has a rating of [DisplayEnergy(maxcharge)], and you should not swallow it."
|
|
update_icon()
|
|
|
|
/obj/item/stock_parts/cell/Destroy()
|
|
STOP_PROCESSING(SSobj, src)
|
|
return ..()
|
|
|
|
/obj/item/stock_parts/cell/vv_edit_var(var_name, var_value)
|
|
switch(var_name)
|
|
if(NAMEOF(src, self_recharge))
|
|
if(var_value)
|
|
START_PROCESSING(SSobj, src)
|
|
else
|
|
STOP_PROCESSING(SSobj, src)
|
|
. = ..()
|
|
|
|
/obj/item/stock_parts/cell/process(delta_time)
|
|
if(self_recharge)
|
|
give(chargerate * 0.125 * delta_time)
|
|
else
|
|
return PROCESS_KILL
|
|
|
|
/obj/item/stock_parts/cell/update_overlays()
|
|
. = ..()
|
|
if(grown_battery)
|
|
. += mutable_appearance('icons/obj/power.dmi', "grown_wires")
|
|
if(charge < 0.01)
|
|
return
|
|
else if(charge/maxcharge >=0.995)
|
|
. += mutable_appearance('icons/obj/power.dmi', "cell-o2")
|
|
else
|
|
. += mutable_appearance('icons/obj/power.dmi', "cell-o1")
|
|
|
|
/obj/item/stock_parts/cell/proc/percent() // return % charge of cell
|
|
return 100*charge/maxcharge
|
|
|
|
// use power from a cell
|
|
/obj/item/stock_parts/cell/use(amount)
|
|
if(rigged && amount > 0)
|
|
explode()
|
|
return FALSE
|
|
if(charge < amount)
|
|
return FALSE
|
|
charge = (charge - amount)
|
|
if(!istype(loc, /obj/machinery/power/apc))
|
|
SSblackbox.record_feedback("tally", "cell_used", 1, type)
|
|
return TRUE
|
|
|
|
// recharge the cell
|
|
/obj/item/stock_parts/cell/proc/give(amount)
|
|
if(rigged && amount > 0)
|
|
explode()
|
|
return 0
|
|
if(maxcharge < amount)
|
|
amount = maxcharge
|
|
var/power_used = min(maxcharge-charge,amount)
|
|
charge += power_used
|
|
return power_used
|
|
|
|
/obj/item/stock_parts/cell/examine(mob/user)
|
|
. = ..()
|
|
if(rigged)
|
|
. += "<span class='danger'>This power cell seems to be faulty!</span>"
|
|
else
|
|
. += "The charge meter reads [round(src.percent() )]%."
|
|
|
|
/obj/item/stock_parts/cell/suicide_act(mob/user)
|
|
user.visible_message("<span class='suicide'>[user] is licking the electrodes of [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
|
return (FIRELOSS)
|
|
|
|
/obj/item/stock_parts/cell/on_reagent_change(changetype)
|
|
rigged = (corrupted || reagents.has_reagent(/datum/reagent/toxin/plasma, 5)) //has_reagent returns the reagent datum
|
|
return ..()
|
|
|
|
|
|
/obj/item/stock_parts/cell/proc/explode()
|
|
var/turf/T = get_turf(src.loc)
|
|
if (charge==0)
|
|
return
|
|
var/devastation_range = -1 //round(charge/11000)
|
|
var/heavy_impact_range = round(sqrt(charge)/60)
|
|
var/light_impact_range = round(sqrt(charge)/30)
|
|
var/flash_range = light_impact_range
|
|
if (light_impact_range==0)
|
|
rigged = FALSE
|
|
corrupt()
|
|
return
|
|
//explosion(T, 0, 1, 2, 2)
|
|
explosion(T, devastation_range, heavy_impact_range, light_impact_range, flash_range)
|
|
qdel(src)
|
|
|
|
/obj/item/stock_parts/cell/proc/corrupt()
|
|
charge /= 2
|
|
maxcharge = max(maxcharge/2, chargerate)
|
|
if (prob(10))
|
|
rigged = TRUE //broken batterys are dangerous
|
|
corrupted = TRUE
|
|
|
|
/obj/item/stock_parts/cell/emp_act(severity)
|
|
. = ..()
|
|
if(. & EMP_PROTECT_SELF)
|
|
return
|
|
charge -= 1000 / severity
|
|
if (charge < 0)
|
|
charge = 0
|
|
|
|
/obj/item/stock_parts/cell/ex_act(severity, target)
|
|
..()
|
|
if(!QDELETED(src))
|
|
switch(severity)
|
|
if(2)
|
|
if(prob(50))
|
|
corrupt()
|
|
if(3)
|
|
if(prob(25))
|
|
corrupt()
|
|
|
|
/obj/item/stock_parts/cell/attack_self(mob/user)
|
|
if(isethereal(user))
|
|
var/mob/living/carbon/human/H = user
|
|
var/datum/species/ethereal/E = H.dna.species
|
|
var/charge_limit = ETHEREAL_CHARGE_DANGEROUS - CELL_POWER_GAIN
|
|
if(E.drain_time > world.time)
|
|
return
|
|
if(charge < CELL_POWER_DRAIN)
|
|
to_chat(H, "<span class='warning'>[src] doesn't have enough power!</span>")
|
|
return
|
|
var/obj/item/organ/stomach/ethereal/stomach = H.getorganslot(ORGAN_SLOT_STOMACH)
|
|
if(stomach.crystal_charge > charge_limit)
|
|
to_chat(H, "<span class='warning'>Your charge is full!</span>")
|
|
return
|
|
to_chat(H, "<span class='notice'>You begin clumsily channeling power from [src] into your body.</span>")
|
|
E.drain_time = world.time + CELL_DRAIN_TIME
|
|
if(do_after(user, CELL_DRAIN_TIME, target = src))
|
|
if((charge < CELL_POWER_DRAIN) || (stomach.crystal_charge > charge_limit))
|
|
return
|
|
if(istype(stomach))
|
|
to_chat(H, "<span class='notice'>You receive some charge from [src], wasting some in the process.</span>")
|
|
stomach.adjust_charge(CELL_POWER_GAIN)
|
|
charge -= CELL_POWER_DRAIN //you waste way more than you receive, so that ethereals cant just steal one cell and forget about hunger
|
|
else
|
|
to_chat(H, "<span class='warning'>You can't receive charge from [src]!</span>")
|
|
return
|
|
|
|
|
|
/obj/item/stock_parts/cell/blob_act(obj/structure/blob/B)
|
|
SSexplosions.high_mov_atom += src
|
|
|
|
/obj/item/stock_parts/cell/proc/get_electrocute_damage()
|
|
if(charge >= 1000)
|
|
return clamp(20 + round(charge/25000), 20, 195) + rand(-5,5)
|
|
else
|
|
return 0
|
|
|
|
/obj/item/stock_parts/cell/get_part_rating()
|
|
return rating * maxcharge
|
|
|
|
/* Cell variants*/
|
|
/obj/item/stock_parts/cell/empty/Initialize()
|
|
. = ..()
|
|
charge = 0
|
|
|
|
/obj/item/stock_parts/cell/crap
|
|
name = "\improper Nanotrasen brand rechargeable AA battery"
|
|
desc = "You can't top the plasma top." //TOTALLY TRADEMARK INFRINGEMENT
|
|
maxcharge = 500
|
|
custom_materials = list(/datum/material/glass=40)
|
|
|
|
/obj/item/stock_parts/cell/crap/empty/Initialize()
|
|
. = ..()
|
|
charge = 0
|
|
update_icon()
|
|
|
|
/obj/item/stock_parts/cell/upgraded
|
|
name = "upgraded power cell"
|
|
desc = "A power cell with a slightly higher capacity than normal!"
|
|
maxcharge = 2500
|
|
custom_materials = list(/datum/material/glass=50)
|
|
chargerate = 1000
|
|
|
|
/obj/item/stock_parts/cell/upgraded/plus
|
|
name = "upgraded power cell+"
|
|
desc = "A power cell with an even higher capacity than the base model!"
|
|
maxcharge = 5000
|
|
|
|
/obj/item/stock_parts/cell/secborg
|
|
name = "security borg rechargeable D battery"
|
|
maxcharge = 600 //600 max charge / 100 charge per shot = six shots
|
|
custom_materials = list(/datum/material/glass=40)
|
|
|
|
/obj/item/stock_parts/cell/secborg/empty/Initialize()
|
|
. = ..()
|
|
charge = 0
|
|
update_icon()
|
|
|
|
/obj/item/stock_parts/cell/mini_egun
|
|
name = "miniature energy gun power cell"
|
|
maxcharge = 600
|
|
|
|
/obj/item/stock_parts/cell/hos_gun
|
|
name = "X-01 multiphase energy gun power cell"
|
|
maxcharge = 1200
|
|
|
|
/obj/item/stock_parts/cell/pulse //200 pulse shots
|
|
name = "pulse rifle power cell"
|
|
maxcharge = 40000
|
|
chargerate = 1500
|
|
|
|
/obj/item/stock_parts/cell/pulse/carbine //25 pulse shots
|
|
name = "pulse carbine power cell"
|
|
maxcharge = 5000
|
|
|
|
/obj/item/stock_parts/cell/pulse/pistol //10 pulse shots
|
|
name = "pulse pistol power cell"
|
|
maxcharge = 2000
|
|
|
|
/obj/item/stock_parts/cell/high
|
|
name = "high-capacity power cell"
|
|
icon_state = "hcell"
|
|
maxcharge = 10000
|
|
custom_materials = list(/datum/material/glass=60)
|
|
chargerate = 1500
|
|
|
|
/obj/item/stock_parts/cell/high/plus
|
|
name = "high-capacity power cell+"
|
|
desc = "Where did these come from?"
|
|
icon_state = "h+cell"
|
|
maxcharge = 15000
|
|
chargerate = 2250
|
|
rating = 2
|
|
|
|
/obj/item/stock_parts/cell/high/empty/Initialize()
|
|
. = ..()
|
|
charge = 0
|
|
update_icon()
|
|
|
|
/obj/item/stock_parts/cell/super
|
|
name = "super-capacity power cell"
|
|
icon_state = "scell"
|
|
maxcharge = 20000
|
|
custom_materials = list(/datum/material/glass=300)
|
|
chargerate = 2000
|
|
rating = 3
|
|
|
|
/obj/item/stock_parts/cell/super/empty/Initialize()
|
|
. = ..()
|
|
charge = 0
|
|
update_icon()
|
|
|
|
/obj/item/stock_parts/cell/hyper
|
|
name = "hyper-capacity power cell"
|
|
icon_state = "hpcell"
|
|
maxcharge = 30000
|
|
custom_materials = list(/datum/material/glass=400)
|
|
chargerate = 3000
|
|
rating = 4
|
|
|
|
/obj/item/stock_parts/cell/hyper/empty/Initialize()
|
|
. = ..()
|
|
charge = 0
|
|
update_icon()
|
|
|
|
/obj/item/stock_parts/cell/bluespace
|
|
name = "bluespace power cell"
|
|
desc = "A rechargeable transdimensional power cell."
|
|
icon_state = "bscell"
|
|
maxcharge = 40000
|
|
custom_materials = list(/datum/material/glass=600)
|
|
chargerate = 4000
|
|
rating = 5
|
|
|
|
/obj/item/stock_parts/cell/bluespace/empty/Initialize()
|
|
. = ..()
|
|
charge = 0
|
|
update_icon()
|
|
|
|
/obj/item/stock_parts/cell/infinite
|
|
name = "infinite-capacity power cell!"
|
|
icon_state = "icell"
|
|
maxcharge = 30000
|
|
custom_materials = list(/datum/material/glass=1000)
|
|
rating = 100
|
|
chargerate = 30000
|
|
|
|
/obj/item/stock_parts/cell/infinite/use()
|
|
return 1
|
|
|
|
/obj/item/stock_parts/cell/infinite/abductor
|
|
name = "void core"
|
|
desc = "An alien power cell that produces energy seemingly out of nowhere."
|
|
icon = 'icons/obj/abductor.dmi'
|
|
icon_state = "cell"
|
|
maxcharge = 50000
|
|
ratingdesc = FALSE
|
|
|
|
/obj/item/stock_parts/cell/infinite/abductor/ComponentInitialize()
|
|
. = ..()
|
|
AddElement(/datum/element/update_icon_blocker)
|
|
|
|
/obj/item/stock_parts/cell/potato
|
|
name = "potato battery"
|
|
desc = "A rechargeable starch based power cell."
|
|
icon = 'icons/obj/hydroponics/harvest.dmi'
|
|
icon_state = "potato"
|
|
charge = 100
|
|
maxcharge = 300
|
|
custom_materials = null
|
|
grown_battery = TRUE //it has the overlays for wires
|
|
|
|
/obj/item/stock_parts/cell/high/slime
|
|
name = "charged slime core"
|
|
desc = "A yellow slime core infused with plasma, it crackles with power."
|
|
icon = 'icons/mob/slimes.dmi'
|
|
icon_state = "yellow slime extract"
|
|
custom_materials = null
|
|
rating = 5 //self-recharge makes these desirable
|
|
self_recharge = 1 // Infused slime cores self-recharge, over time
|
|
|
|
/*Hypercharged slime cell - located in /code/modules/research/xenobiology/crossbreeding/_misc.dm
|
|
/obj/item/stock_parts/cell/high/slime/hypercharged */
|
|
|
|
/obj/item/stock_parts/cell/emproof
|
|
name = "\improper EMP-proof cell"
|
|
desc = "An EMP-proof cell."
|
|
maxcharge = 500
|
|
rating = 3
|
|
|
|
/obj/item/stock_parts/cell/emproof/empty/Initialize()
|
|
. = ..()
|
|
charge = 0
|
|
update_icon()
|
|
|
|
/obj/item/stock_parts/cell/emproof/empty/ComponentInitialize()
|
|
. = ..()
|
|
AddComponent(/datum/component/empprotection, EMP_PROTECT_SELF)
|
|
|
|
/obj/item/stock_parts/cell/emproof/corrupt()
|
|
return
|
|
|
|
/obj/item/stock_parts/cell/beam_rifle
|
|
name = "beam rifle capacitor"
|
|
desc = "A high powered capacitor that can provide huge amounts of energy in an instant."
|
|
maxcharge = 50000
|
|
chargerate = 5000 //Extremely energy intensive
|
|
|
|
/obj/item/stock_parts/cell/beam_rifle/corrupt()
|
|
return
|
|
|
|
/obj/item/stock_parts/cell/beam_rifle/emp_act(severity)
|
|
. = ..()
|
|
if(. & EMP_PROTECT_SELF)
|
|
return
|
|
charge = clamp((charge-(10000/severity)),0,maxcharge)
|
|
|
|
/obj/item/stock_parts/cell/emergency_light
|
|
name = "miniature power cell"
|
|
desc = "A tiny power cell with a very low power capacity. Used in light fixtures to power them in the event of an outage."
|
|
maxcharge = 120 //Emergency lights use 0.2 W per tick, meaning ~10 minutes of emergency power from a cell
|
|
custom_materials = list(/datum/material/glass = 20)
|
|
w_class = WEIGHT_CLASS_TINY
|
|
|
|
/obj/item/stock_parts/cell/emergency_light/Initialize()
|
|
. = ..()
|
|
var/area/A = get_area(src)
|
|
if(!A.lightswitch || !A.light_power)
|
|
charge = 0 //For naturally depowered areas, we start with no power
|
|
|
|
#undef CELL_DRAIN_TIME
|
|
#undef CELL_POWER_GAIN
|
|
#undef CELL_POWER_DRAIN
|