mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Conflicts: baystation12.dme code/ATMOSPHERICS/components/unary/vent_pump.dm code/ATMOSPHERICS/components/unary/vent_scrubber.dm code/__HELPERS/game.dm code/controllers/shuttle_controller.dm code/datums/datumvars.dm code/datums/supplypacks.dm code/defines/obj/storage.dm code/defines/obj/vending.dm code/defines/obj/weapon.dm code/defines/procs/command_alert.dm code/game/area/Space Station 13 areas.dm code/game/atoms.dm code/game/gamemodes/changeling/modularchangling.dm code/game/gamemodes/cult/runes.dm code/game/gamemodes/events.dm code/game/gamemodes/events/dust.dm code/game/gamemodes/events/miniblob.dm code/game/gamemodes/events/ninja_equipment.dm code/game/gamemodes/factions.dm code/game/gamemodes/game_mode.dm code/game/gamemodes/gameticker.dm code/game/jobs/access.dm code/game/jobs/job/assistant.dm code/game/jobs/job/captain.dm code/game/jobs/job/civilian.dm code/game/jobs/job/engineering.dm code/game/jobs/job/medical.dm code/game/jobs/job/science.dm code/game/jobs/job/security.dm code/game/jobs/job_controller.dm code/game/machinery/alarm.dm code/game/machinery/atmo_control.dm code/game/machinery/atmoalter/area_atmos_computer.dm code/game/machinery/bots/medbot.dm code/game/machinery/computer/HolodeckControl.dm code/game/machinery/computer/ai_core.dm code/game/machinery/computer/atmos_alert.dm code/game/machinery/computer/card.dm code/game/machinery/computer/cloning.dm code/game/machinery/computer/computer.dm code/game/machinery/computer/message.dm code/game/machinery/computer/pod.dm code/game/machinery/computer/prisoner.dm code/game/machinery/computer/syndicate_shuttle.dm code/game/machinery/constructable_frame.dm code/game/machinery/doors/door.dm code/game/machinery/doors/firedoor.dm code/game/machinery/newscaster.dm code/game/machinery/recharger.dm code/game/machinery/spaceheater.dm code/game/machinery/telecomms/broadcaster.dm code/game/machinery/telecomms/logbrowser.dm code/game/machinery/telecomms/machine_interactions.dm code/game/machinery/teleporter.dm code/game/machinery/wishgranter.dm code/game/mecha/mech_fabricator.dm code/game/mecha/working/ripley.dm code/game/objects/items.dm code/game/objects/items/blueprints.dm code/game/objects/items/devices/flashlight.dm code/game/objects/items/devices/radio/encryptionkey.dm code/game/objects/items/devices/uplinks.dm code/game/objects/items/stacks/medical.dm code/game/objects/items/weapons/cards_ids.dm code/game/objects/items/weapons/gift_wrappaper.dm code/game/objects/items/weapons/hydroponics.dm code/game/objects/items/weapons/manuals.dm code/game/objects/items/weapons/secstorage/secstorage.dm code/game/objects/items/weapons/storage/backpack.dm code/game/objects/items/weapons/storage/firstaid.dm code/game/objects/items/weapons/storage/kit.dm code/game/objects/items/weapons/storage/storage.dm code/game/objects/items/weapons/storage/toolbox.dm code/game/objects/items/weapons/storage/uplink_kits.dm code/game/objects/items/weapons/stunbaton.dm code/game/objects/items/weapons/surgery_tools.dm code/game/objects/items/weapons/tools.dm code/game/objects/structures/crates_lockers/closets/secure/cargo.dm code/game/objects/structures/crates_lockers/closets/secure/hydroponics.dm code/game/objects/structures/crates_lockers/closets/secure/scientist.dm code/game/objects/structures/crates_lockers/closets/secure/security.dm code/game/objects/structures/electricchair.dm code/game/objects/structures/extinguisher.dm code/game/objects/structures/watercloset.dm code/game/objects/weapons.dm code/game/turfs/turf.dm code/game/vehicles/airtight/airtight.dm code/game/vehicles/vehicle.dm code/global.dm code/modules/DetectiveWork/evidence.dm code/modules/admin/IsBanned.dm code/modules/admin/player_panel.dm code/modules/admin/verbs/diagnostics.dm code/modules/admin/verbs/getlogs.dm code/modules/client/preferences.dm code/modules/clothing/masks/miscellaneous.dm code/modules/clothing/spacesuits/rig.dm code/modules/clothing/suits/miscellaneous.dm code/modules/critters/critter_defenses.dm code/modules/detectivework/scanner.dm code/modules/flufftext/Hallucination.dm code/modules/food/recipes_microwave.dm code/modules/mining/mine_items.dm code/modules/mining/mine_turfs.dm code/modules/mining/satchel_ore_boxdm.dm code/modules/mob/dead/observer/observer.dm code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm code/modules/mob/living/carbon/alien/special/facehugger.dm code/modules/mob/living/carbon/carbon.dm code/modules/mob/living/carbon/carbon_defines.dm code/modules/mob/living/carbon/human/human.dm code/modules/mob/living/carbon/human/human_attackhand.dm code/modules/mob/living/carbon/human/life.dm code/modules/mob/living/carbon/human/say.dm code/modules/mob/living/carbon/human/update_icons.dm code/modules/mob/living/carbon/metroid/metroid.dm code/modules/mob/living/living.dm code/modules/mob/living/silicon/ai/life.dm code/modules/mob/living/silicon/robot/robot.dm code/modules/mob/mob_cleanup.dm code/modules/mob/mob_defines.dm code/modules/mob/mob_transformation_simple.dm code/modules/paperwork/clipboard.dm code/modules/paperwork/folders.dm code/modules/paperwork/paper.dm code/modules/paperwork/paperbin.dm code/modules/paperwork/pen.dm code/modules/power/cable.dm code/modules/projectiles/guns/energy/special.dm code/modules/projectiles/guns/projectile/revolver.dm code/modules/projectiles/projectile/change.dm code/modules/projectiles/projectile/special.dm code/modules/reagents/Chemistry-Reagents.dm code/modules/reagents/reagent_containers/glass.dm code/modules/reagents/reagent_containers/hypospray.dm code/modules/recycling/sortingmachinery.dm code/modules/research/designs.dm config/config.txt html/changelog.html icons/mob/head.dmi icons/mob/hud.dmi icons/mob/items_lefthand.dmi icons/mob/items_righthand.dmi icons/mob/mask.dmi icons/mob/suit.dmi icons/mob/ties.dmi icons/mob/uniform.dmi icons/obj/clothing/hats.dmi icons/obj/clothing/masks.dmi icons/obj/clothing/suits.dmi icons/obj/clothing/ties.dmi icons/obj/grenade.dmi icons/obj/projectiles.dmi Signed-off-by: Cael_Aislinn <cael_aislinn@yahoo.com.au>
181 lines
4.8 KiB
Plaintext
181 lines
4.8 KiB
Plaintext
// the power cell
|
|
// charge from 0 to 100%
|
|
// fits in APC to provide backup power
|
|
|
|
/obj/item/weapon/cell/New()
|
|
..()
|
|
charge = maxcharge
|
|
|
|
spawn(5)
|
|
updateicon()
|
|
|
|
/obj/item/weapon/cell/proc/updateicon()
|
|
overlays.Cut()
|
|
|
|
if(charge < 0.01)
|
|
return
|
|
else if(charge/maxcharge >=0.995)
|
|
overlays += image('icons/obj/power.dmi', "cell-o2")
|
|
else
|
|
overlays += image('icons/obj/power.dmi', "cell-o1")
|
|
|
|
/obj/item/weapon/cell/proc/percent() // return % charge of cell
|
|
return 100.0*charge/maxcharge
|
|
|
|
// use power from a cell
|
|
/obj/item/weapon/cell/proc/use(var/amount)
|
|
if(rigged && amount > 0)
|
|
explode()
|
|
return 0
|
|
|
|
if(charge < amount) return 0
|
|
charge = (charge - amount)
|
|
return 1
|
|
|
|
// recharge the cell
|
|
/obj/item/weapon/cell/proc/give(var/amount)
|
|
if(rigged && amount > 0)
|
|
explode()
|
|
return 0
|
|
|
|
if(maxcharge < amount) return 0
|
|
var/power_used = min(maxcharge-charge,amount)
|
|
if(crit_fail) return 0
|
|
if(!prob(reliability))
|
|
minor_fault++
|
|
if(prob(minor_fault))
|
|
crit_fail = 1
|
|
return 0
|
|
charge += power_used
|
|
return power_used
|
|
|
|
|
|
/obj/item/weapon/cell/examine()
|
|
set src in view(1)
|
|
if(usr /*&& !usr.stat*/)
|
|
if(maxcharge <= 2500)
|
|
usr << "[desc]\nThe manufacturer's label states this cell has a power rating of [maxcharge], and that you should not swallow it.\nThe charge meter reads [round(src.percent() )]%."
|
|
else
|
|
usr << "This power cell has an exciting chrome finish, as it is an uber-capacity cell type! It has a power rating of [maxcharge]!\nThe charge meter reads [round(src.percent() )]%."
|
|
if(crit_fail)
|
|
usr << "\red This power cell seems to be faulty."
|
|
|
|
/obj/item/weapon/cell/attack_self(mob/user as mob)
|
|
src.add_fingerprint(user)
|
|
if(ishuman(user))
|
|
if(istype(user:gloves, /obj/item/clothing/gloves/space_ninja)&&user:gloves:candrain&&!user:gloves:draining)
|
|
call(/obj/item/clothing/gloves/space_ninja/proc/drain)("CELL",src,user:wear_suit)
|
|
return
|
|
|
|
/obj/item/weapon/cell/attackby(obj/item/W, mob/user)
|
|
..()
|
|
if(istype(W, /obj/item/weapon/reagent_containers/syringe))
|
|
var/obj/item/weapon/reagent_containers/syringe/S = W
|
|
|
|
user << "You inject the solution into the power cell."
|
|
|
|
if(S.reagents.has_reagent("plasma", 5))
|
|
|
|
rigged = 1
|
|
|
|
log_admin("LOG: [user.name] ([user.ckey]) injected a power cell with plasma, rigging it to explode.")
|
|
message_admins("LOG: [user.name] ([user.ckey]) injected a power cell with plasma, rigging it to explode.")
|
|
|
|
S.reagents.clear_reagents()
|
|
|
|
|
|
/obj/item/weapon/cell/proc/explode()
|
|
var/turf/T = get_turf(src.loc)
|
|
/*
|
|
* 1000-cell explosion(T, -1, 0, 1, 1)
|
|
* 2500-cell explosion(T, -1, 0, 1, 1)
|
|
* 10000-cell explosion(T, -1, 1, 3, 3)
|
|
* 15000-cell explosion(T, -1, 2, 4, 4)
|
|
* */
|
|
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 = 0
|
|
corrupt()
|
|
return
|
|
//explosion(T, 0, 1, 2, 2)
|
|
|
|
log_admin("LOG: Rigged power cell explosion, last touched by [fingerprintslast]")
|
|
message_admins("LOG: Rigged power cell explosion, last touched by [fingerprintslast]")
|
|
|
|
explosion(T, devastation_range, heavy_impact_range, light_impact_range, flash_range)
|
|
|
|
spawn(1)
|
|
del(src)
|
|
|
|
/obj/item/weapon/cell/proc/corrupt()
|
|
charge /= 2
|
|
maxcharge /= 2
|
|
if (prob(10))
|
|
rigged = 1 //broken batterys are dangerous
|
|
|
|
/obj/item/weapon/cell/emp_act(severity)
|
|
charge -= 1000 / severity
|
|
if (charge < 0)
|
|
charge = 0
|
|
if(reliability != 100 && prob(50/severity))
|
|
reliability -= 10 / severity
|
|
..()
|
|
|
|
/obj/item/weapon/cell/ex_act(severity)
|
|
|
|
switch(severity)
|
|
if(1.0)
|
|
del(src)
|
|
return
|
|
if(2.0)
|
|
if (prob(50))
|
|
del(src)
|
|
return
|
|
if (prob(50))
|
|
corrupt()
|
|
if(3.0)
|
|
if (prob(25))
|
|
del(src)
|
|
return
|
|
if (prob(25))
|
|
corrupt()
|
|
return
|
|
|
|
/obj/item/weapon/cell/blob_act()
|
|
if(prob(75))
|
|
explode()
|
|
|
|
/obj/item/weapon/cell/proc/get_electrocute_damage()
|
|
switch (charge)
|
|
/* if (9000 to INFINITY)
|
|
return min(rand(90,150),rand(90,150))
|
|
if (2500 to 9000-1)
|
|
return min(rand(70,145),rand(70,145))
|
|
if (1750 to 2500-1)
|
|
return min(rand(35,110),rand(35,110))
|
|
if (1500 to 1750-1)
|
|
return min(rand(30,100),rand(30,100))
|
|
if (750 to 1500-1)
|
|
return min(rand(25,90),rand(25,90))
|
|
if (250 to 750-1)
|
|
return min(rand(20,80),rand(20,80))
|
|
if (100 to 250-1)
|
|
return min(rand(20,65),rand(20,65))*/
|
|
if (1000000 to INFINITY)
|
|
return min(rand(50,160),rand(50,160))
|
|
if (200000 to 1000000-1)
|
|
return min(rand(25,80),rand(25,80))
|
|
if (100000 to 200000-1)//Ave powernet
|
|
return min(rand(20,60),rand(20,60))
|
|
if (50000 to 100000-1)
|
|
return min(rand(15,40),rand(15,40))
|
|
if (1000 to 50000-1)
|
|
return min(rand(10,20),rand(10,20))
|
|
else
|
|
return 0
|