mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 02:09:41 +00:00
Flash rebalance.
This commit is contained in:
@@ -8,7 +8,11 @@ obj/machinery/recharger
|
||||
idle_power_usage = 4
|
||||
active_power_usage = 40000 //40 kW
|
||||
var/obj/item/charging = null
|
||||
<<<<<<< HEAD
|
||||
var/list/allowed_devices = list(/obj/item/weapon/gun/energy, /obj/item/weapon/melee/baton, /obj/item/device/laptop, /obj/item/weapon/cell, /obj/item/device/flashlight, /obj/item/device/electronic_assembly, /obj/item/weapon/weldingtool/electric, /obj/item/ammo_magazine/smart, /obj/item/ammo_casing/nsfw_batt) //VOREStation Add - NSFW Batteries
|
||||
=======
|
||||
var/list/allowed_devices = list(/obj/item/weapon/gun/energy, /obj/item/weapon/melee/baton, /obj/item/device/laptop, /obj/item/weapon/cell, /obj/item/device/flashlight, /obj/item/device/electronic_assembly, /obj/item/weapon/weldingtool/electric, /obj/item/ammo_magazine/smart, /obj/item/device/flash)
|
||||
>>>>>>> 33efaed... Flash rebalance. (#5907)
|
||||
var/icon_state_charged = "recharger2"
|
||||
var/icon_state_charging = "recharger1"
|
||||
var/icon_state_idle = "recharger0" //also when unpowered
|
||||
|
||||
@@ -11,10 +11,79 @@
|
||||
origin_tech = list(TECH_MAGNET = 2, TECH_COMBAT = 1)
|
||||
|
||||
var/times_used = 0 //Number of times it's been used.
|
||||
var/broken = 0 //Is the flash burnt out?
|
||||
var/broken = FALSE //Is the flash burnt out?
|
||||
var/last_used = 0 //last world.time it was used.
|
||||
var/max_flashes = 10 // How many times the flash can be used before needing to self recharge.
|
||||
var/halloss_per_flash = 30
|
||||
var/break_mod = 3 // The percent to break increased by every use on the flash.
|
||||
|
||||
var/can_break = TRUE // Can the flash break?
|
||||
var/can_repair = FALSE // Can you repair the flash?
|
||||
var/repairing = FALSE // Are we repairing right now?
|
||||
|
||||
var/safe_flashes = 2 // How many flashes are kept in 1% breakchance?
|
||||
|
||||
var/charge_only = FALSE // Does the flash run purely on charge?
|
||||
|
||||
var/base_icon = "flash"
|
||||
|
||||
var/obj/item/weapon/cell/power_supply //What type of power cell this uses
|
||||
var/charge_cost = 30 //How much energy is needed to flash.
|
||||
var/use_external_power = FALSE // Do we use charge from an external source?
|
||||
|
||||
var/cell_type = /obj/item/weapon/cell/device
|
||||
|
||||
/obj/item/device/flash/Initialize()
|
||||
..()
|
||||
power_supply = new cell_type(src)
|
||||
|
||||
/obj/item/device/flash/attackby(var/obj/item/W, var/mob/user)
|
||||
if(W.is_screwdriver() && broken)
|
||||
if(repairing)
|
||||
to_chat(user, "<span class='notice'>\The [src] is already being repaired!</span>")
|
||||
return
|
||||
user.visible_message("<span class='notice'>\The [user] starts trying to repair \the [src]'s bulb.</span>")
|
||||
repairing = TRUE
|
||||
if(do_after(user, (40 SECONDS + rand(0, 20 SECONDS)) * W.toolspeed) && can_repair)
|
||||
if(prob(30))
|
||||
user.visible_message("<span class='notice'>\The [user] successfully repairs \the [src]!</span>")
|
||||
broken = FALSE
|
||||
update_icon()
|
||||
playsound(src.loc, W.usesound, 50, 1)
|
||||
else
|
||||
user.visible_message("<span class='notice'>\The [user] fails to repair \the [src].</span>")
|
||||
repairing = FALSE
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/item/device/flash/update_icon()
|
||||
var/obj/item/weapon/cell/battery = power_supply
|
||||
|
||||
if(use_external_power)
|
||||
battery = get_external_power_supply()
|
||||
|
||||
if(broken || !battery || battery.charge < charge_cost)
|
||||
icon_state = "[base_icon]burnt"
|
||||
else
|
||||
icon_state = "[base_icon]"
|
||||
return
|
||||
|
||||
/obj/item/device/flash/get_cell()
|
||||
return power_supply
|
||||
|
||||
/obj/item/device/flash/proc/get_external_power_supply()
|
||||
if(isrobot(src.loc))
|
||||
var/mob/living/silicon/robot/R = src.loc
|
||||
return R.cell
|
||||
if(istype(src.loc, /obj/item/rig_module))
|
||||
var/obj/item/rig_module/module = src.loc
|
||||
if(module.holder && module.holder.wearer)
|
||||
var/mob/living/carbon/human/H = module.holder.wearer
|
||||
if(istype(H) && H.back)
|
||||
var/obj/item/weapon/rig/suit = H.back
|
||||
if(istype(suit))
|
||||
return suit.cell
|
||||
return null
|
||||
|
||||
/obj/item/device/flash/proc/clown_check(var/mob/user)
|
||||
if(user && (CLUMSY in user.mutations) && prob(50))
|
||||
@@ -29,31 +98,53 @@
|
||||
for(var/i=0, i < max_flashes, i++)
|
||||
if(last_used + 10 SECONDS > world.time)
|
||||
break
|
||||
|
||||
else if(use_external_power)
|
||||
var/obj/item/weapon/cell/external = get_external_power_supply()
|
||||
if(!external || !external.use(charge_cost)) //Take power from the borg or rig!
|
||||
break
|
||||
|
||||
else if(!power_supply || !power_supply.checked_use(charge_cost))
|
||||
break
|
||||
|
||||
last_used += 10 SECONDS
|
||||
times_used--
|
||||
|
||||
last_used = world.time
|
||||
times_used = max(0,round(times_used)) //sanity
|
||||
update_icon()
|
||||
|
||||
// Returns true if the device can flash.
|
||||
/obj/item/device/flash/proc/check_capacitor(var/mob/user)
|
||||
//spamming the flash before it's fully charged (60 seconds) increases the chance of it breaking
|
||||
//It will never break on the first use.
|
||||
if(times_used <= max_flashes)
|
||||
var/obj/item/weapon/cell/battery = power_supply
|
||||
|
||||
if(use_external_power)
|
||||
battery = get_external_power_supply()
|
||||
|
||||
if(times_used <= max_flashes && battery && battery.checked_use(charge_cost))
|
||||
last_used = world.time
|
||||
if(prob( round(times_used / 2) )) //if you use it 10 times in a minute it has a 5% chance to break.
|
||||
broken = 1
|
||||
if(prob( max(0, times_used - safe_flashes) * 2 + (times_used >= 1) ) && can_break) //if you use it 10 times in a minute it has a 30% chance to break.
|
||||
broken = TRUE
|
||||
if(user)
|
||||
to_chat(user, "<span class='warning'>The bulb has burnt out!</span>")
|
||||
icon_state = "flashburnt"
|
||||
update_icon()
|
||||
return FALSE
|
||||
else
|
||||
times_used++
|
||||
update_icon()
|
||||
return TRUE
|
||||
else //can only use it 10 times a minute
|
||||
else if(!charge_only) //can only use it 10 times a minute, unless it runs purely on charge.
|
||||
if(user)
|
||||
update_icon()
|
||||
to_chat(user, "<span class='warning'><i>click</i></span>")
|
||||
playsound(src.loc, 'sound/weapons/empty.ogg', 80, 1)
|
||||
return FALSE
|
||||
else if(battery && battery.checked_use(charge_cost + (round(charge_cost / 4) * max(0, times_used - max_flashes)))) // Using over your maximum flashes starts taking more charge per added flash.
|
||||
times_used++
|
||||
update_icon()
|
||||
return TRUE
|
||||
|
||||
//attack_as_weapon
|
||||
/obj/item/device/flash/attack(mob/living/M, mob/living/user, var/target_zone)
|
||||
@@ -206,6 +297,8 @@
|
||||
desc = "When a problem arises, SCIENCE is the solution."
|
||||
icon_state = "sflash"
|
||||
origin_tech = list(TECH_MAGNET = 2, TECH_COMBAT = 1)
|
||||
base_icon = "sflash"
|
||||
can_repair = FALSE
|
||||
|
||||
//attack_as_weapon
|
||||
/obj/item/device/flash/synthetic/attack(mob/living/M, mob/living/user, var/target_zone)
|
||||
@@ -213,11 +306,17 @@
|
||||
if(!broken)
|
||||
broken = 1
|
||||
to_chat(user, "<span class='warning'>The bulb has burnt out!</span>")
|
||||
icon_state = "flashburnt"
|
||||
update_icon()
|
||||
|
||||
/obj/item/device/flash/synthetic/attack_self(mob/living/carbon/user as mob, flag = 0, emp = 0)
|
||||
..()
|
||||
if(!broken)
|
||||
broken = 1
|
||||
to_chat(user, "<span class='warning'>The bulb has burnt out!</span>")
|
||||
icon_state = "flashburnt"
|
||||
update_icon()
|
||||
|
||||
/obj/item/device/flash/robot
|
||||
name = "mounted flash"
|
||||
can_break = FALSE
|
||||
use_external_power = TRUE
|
||||
charge_only = TRUE
|
||||
|
||||
@@ -155,7 +155,7 @@ var/global/list/robot_modules = list(
|
||||
// Cyborgs (non-drones), default loadout. This will be given to every module.
|
||||
/obj/item/weapon/robot_module/robot/New()
|
||||
..()
|
||||
src.modules += new /obj/item/device/flash(src)
|
||||
src.modules += new /obj/item/device/flash/robot(src)
|
||||
src.modules += new /obj/item/weapon/tool/crowbar/cyborg(src)
|
||||
src.modules += new /obj/item/weapon/extinguisher(src)
|
||||
src.modules += new /obj/item/device/gps/robot(src)
|
||||
|
||||
39
html/changelogs/Mechoid - Flashes.yml
Normal file
39
html/changelogs/Mechoid - Flashes.yml
Normal file
@@ -0,0 +1,39 @@
|
||||
################################
|
||||
# Example Changelog File
|
||||
#
|
||||
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
|
||||
#
|
||||
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
|
||||
# When it is, any changes listed below will disappear.
|
||||
#
|
||||
# Valid Prefixes:
|
||||
# bugfix
|
||||
# wip (For works in progress)
|
||||
# tweak
|
||||
# soundadd
|
||||
# sounddel
|
||||
# rscadd (general adding of nice things)
|
||||
# rscdel (general deleting of nice things)
|
||||
# imageadd
|
||||
# imagedel
|
||||
# maptweak
|
||||
# spellcheck (typo fixes)
|
||||
# experiment
|
||||
#################################
|
||||
|
||||
# Your name.
|
||||
author: Mechoid
|
||||
|
||||
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
|
||||
delete-after: True
|
||||
|
||||
# Any changes you've made. See valid prefix list above.
|
||||
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
|
||||
# SCREW THIS UP AND IT WON'T WORK.
|
||||
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
|
||||
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
|
||||
changes:
|
||||
- tweak: "Flashes now actually run the risk of burning out."
|
||||
- tweak: "Flashes that burn out can be repaired after approximately 40 seconds and with some luck, via a screwdriver."
|
||||
- tweak: "Cyborg flashes use charge only, and do not have the 10 flash limit. They instead begin burning large amounts of charge."
|
||||
- tweak: "Flashes use miniscule charge in addition to their capacitor burn-out, totalling 12 uses, taking 4 to down a human. They can be charged within a standard charger."
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 67 KiB |
Reference in New Issue
Block a user