mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-27 15:01:04 +01:00
Custom Kinetic Accelerators (#4802)
This is honestly one of my biggest and most ambitious projects. I hope people are happy with this. Custom kinetic accelerators are special, customizable mining weapons that are meant to give a sense of progression, and a sense of pride and accomplishment while mining. Each custom KA is made up of 3 or 4 parts: The Frame (5 to choose from) The Cell (5 to choose from, +1 traitor) The Barrel (5 to choose from, +1 traitor) The Upgrade Chip (7 to choose from, +1 traitor) The sprites change with each addon, they are truly dynamic and there are so many combinations of parts that a miner can have. You can have several different builds for each desired mining style, it's quite a robust system. You can have a KA that shoots slowly, but delivers high-penetrating shots that go through several walls of rock. You can have a KA that shoots REALLY fast, but precisely destroys 1 rock at a time. You can have an absolute canon of a beast, that destroys rocks in a 3 tile radius around it. The parts can be obtained via research, via abandoned crates, or via RNG in the cargo warehouse. There are some custom KAs that spawn on the raider's ship, on the mercs ship, and a laser one on the merc's headquarters. That laser one can also be bought from the traitor uplink as well. ERT get a class 4 KA for use in special operations, if they choose to use it.
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
/obj/item/custom_ka_upgrade/barrels/barrel01
|
||||
name = "standard core KA power converter"
|
||||
build_name = "'Standard'"
|
||||
desc = "A very standard kinetic accelerator energy converter and barrel assembly. Has poor range, but gets the job done."
|
||||
icon_state = "barrel01"
|
||||
damage_increase = 10
|
||||
firedelay_increase = 0.75 SECONDS
|
||||
range_increase = 2
|
||||
recoil_increase = 2
|
||||
cost_increase = 1
|
||||
cell_increase = 0
|
||||
capacity_increase = -1
|
||||
fire_sound = 'sound/weapons/Kenetic_accel.ogg'
|
||||
projectile_type = /obj/item/projectile/kinetic
|
||||
origin_tech = list(TECH_MATERIAL = 2,TECH_ENGINEERING = 2,TECH_MAGNET = 2)
|
||||
|
||||
/obj/item/custom_ka_upgrade/barrels/barrel02
|
||||
name = "professional core KA power converter"
|
||||
build_name = "'Professional'"
|
||||
desc = "A more advanced kinetic accelerator energy converter and barrel assembly intended for professional miners out on the rock."
|
||||
icon_state = "barrel02"
|
||||
damage_increase = 15
|
||||
firedelay_increase = 0.75 SECONDS
|
||||
range_increase = 3
|
||||
recoil_increase = 3
|
||||
cost_increase = 1
|
||||
cell_increase = 0
|
||||
capacity_increase = -2
|
||||
fire_sound = 'sound/weapons/Kenetic_accel.ogg'
|
||||
projectile_type = /obj/item/projectile/kinetic
|
||||
origin_tech = list(TECH_MATERIAL = 3,TECH_ENGINEERING = 3,TECH_MAGNET = 3)
|
||||
|
||||
/obj/item/custom_ka_upgrade/barrels/barrel03
|
||||
name = "meteor core KA power converter"
|
||||
build_name = "'Meteor'"
|
||||
desc = "A very robust kinetic accelerator energy converter used by professional mining contractors intended for the use in mining soft metals such as gold on asteroids."
|
||||
icon_state = "barrel03"
|
||||
damage_increase = 20
|
||||
firedelay_increase = 0.75 SECONDS
|
||||
range_increase = 4
|
||||
recoil_increase = 4
|
||||
cost_increase = 2
|
||||
cell_increase = 0
|
||||
capacity_increase = -3
|
||||
fire_sound = 'sound/weapons/resonator_fire.ogg'
|
||||
projectile_type = /obj/item/projectile/kinetic
|
||||
origin_tech = list(TECH_MATERIAL = 4,TECH_ENGINEERING = 4,TECH_MAGNET = 4)
|
||||
|
||||
|
||||
/obj/item/custom_ka_upgrade/barrels/barrel04
|
||||
name = "planet core KA power converter"
|
||||
build_name = "'Planet'"
|
||||
desc = "An incredibly powerful and efficient kinetic accelerator energy converter intended for the use in atmospheric areas such as planets and gas giants."
|
||||
icon_state = "barrel04"
|
||||
damage_increase = 25
|
||||
firedelay_increase = 1 SECONDS
|
||||
range_increase = 5
|
||||
recoil_increase = 6
|
||||
cost_increase = 5
|
||||
cell_increase = 0
|
||||
capacity_increase = -4
|
||||
fire_sound = 'sound/weapons/pulse.ogg'
|
||||
projectile_type = /obj/item/projectile/kinetic
|
||||
origin_tech = list(TECH_MATERIAL = 5,TECH_ENGINEERING = 5,TECH_MAGNET = 5)
|
||||
|
||||
/obj/item/custom_ka_upgrade/barrels/barrel05
|
||||
name = "experimental core KA power converter"
|
||||
build_name = "'Experimental'"
|
||||
desc = "A very experimental kinetic accelerator energy converter. Not much is known about this thing, other than it kicks like a mule and stings like an e-sword."
|
||||
icon_state = "barrel05"
|
||||
damage_increase = 30
|
||||
firedelay_increase = 1 SECONDS
|
||||
range_increase = 6
|
||||
recoil_increase = 10
|
||||
cost_increase = 10
|
||||
cell_increase = 0
|
||||
capacity_increase = -5
|
||||
fire_sound = 'sound/weapons/resonator_blast.ogg'
|
||||
projectile_type = /obj/item/projectile/kinetic
|
||||
origin_tech = list(TECH_MATERIAL = 6,TECH_ENGINEERING = 6,TECH_MAGNET = 6)
|
||||
|
||||
/obj/item/custom_ka_upgrade/barrels/illegal
|
||||
name = "laser KA power converter"
|
||||
build_name = "'Syndicate''"
|
||||
desc = "A laser crystal ripped from a laser rifle and repurposed for kinetic accelerator assemblies."
|
||||
icon_state = "barrel_laser"
|
||||
damage_increase = 15
|
||||
firedelay_increase = 1.5 SECONDS
|
||||
range_increase = 64
|
||||
recoil_increase = 6
|
||||
cost_increase = 4
|
||||
cell_increase = 0
|
||||
capacity_increase = 0
|
||||
fire_sound = 'sound/weapons/lasercannonfire.ogg'
|
||||
projectile_type = /obj/item/projectile/beam/midlaser
|
||||
origin_tech = list(TECH_MATERIAL = 4,TECH_ENGINEERING = 4,TECH_MAGNET = 4,TECH_COMBAT = 5,TECH_ILLEGAL = 5)
|
||||
@@ -0,0 +1,136 @@
|
||||
/obj/item/custom_ka_upgrade/cells/attack_self(mob/user as mob)
|
||||
|
||||
if(is_pumping)
|
||||
return
|
||||
|
||||
if(pump_restore)
|
||||
is_pumping = TRUE
|
||||
if(stored_charge >= cell_increase)
|
||||
to_chat(user,"The pump on the [src] refuses to move.")
|
||||
else
|
||||
if(!pump_delay || do_after(user,pump_delay,use_user_turf = -1))
|
||||
if(isturf(src.loc))
|
||||
to_chat(user,"You pump \the [src].")
|
||||
else
|
||||
to_chat(user,"You pump \the [src.loc].")
|
||||
stored_charge = min(stored_charge + pump_restore,cell_increase)
|
||||
playsound(src,'sound/weapons/kenetic_reload.ogg', 50, 0)
|
||||
|
||||
is_pumping = FALSE
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
|
||||
/obj/item/custom_ka_upgrade/cells/cell01
|
||||
//Pump Action
|
||||
name = "pump action KA cell"
|
||||
build_name = "pump-action"
|
||||
desc = "A very basic power cell and pump action combo that stores a single charge. A pump is required after each shot, however it deals increased damage and has increased range."
|
||||
icon_state = "cell01"
|
||||
damage_increase = 5
|
||||
firedelay_increase = 0.25 SECONDS
|
||||
range_increase = 3
|
||||
recoil_increase = -1
|
||||
cost_increase = -100 //Always have a single charge
|
||||
cell_increase = 1
|
||||
capacity_increase = -1
|
||||
mod_limit_increase = 0
|
||||
|
||||
pump_restore = 1
|
||||
pump_delay = 0.4 SECONDS
|
||||
|
||||
origin_tech = list(TECH_MATERIAL = 2,TECH_ENGINEERING = 2,TECH_MAGNET = 2,TECH_POWER = 2)
|
||||
|
||||
/obj/item/custom_ka_upgrade/cells/cell02
|
||||
//Pump Action
|
||||
name = "pump recharging KA cell"
|
||||
build_name = "pump-recharging"
|
||||
desc = "A somewhat more advanced, standard issue pump and cell assembly that allows the user to 'pre-pump' their charges, up to a capacity of 12. Can fire quite quickly."
|
||||
icon_state = "cell02"
|
||||
firedelay_increase = 0
|
||||
recoil_increase = 1
|
||||
cell_increase = 12
|
||||
capacity_increase = -2
|
||||
mod_limit_increase = 0
|
||||
|
||||
pump_restore = 1
|
||||
pump_delay = 0.5 SECONDS
|
||||
|
||||
origin_tech = list(TECH_MATERIAL = 3,TECH_ENGINEERING = 3,TECH_MAGNET = 3,TECH_POWER = 3)
|
||||
|
||||
/obj/item/custom_ka_upgrade/cells/cell03
|
||||
name = "kinetic charging KA cell"
|
||||
build_name = "kinetic-reloading"
|
||||
desc = "A complex pump and cell assembly that uses the kinetic energy of an initial pump to significantly charge the cell. Deals increased damage at the cost of severely increased recoil and reduced firerate."
|
||||
icon_state = "cell03"
|
||||
damage_increase = 10
|
||||
firedelay_increase = 0.5 SECONDS
|
||||
recoil_increase = 4
|
||||
cost_increase = -1
|
||||
cell_increase = 40
|
||||
capacity_increase = -3
|
||||
mod_limit_increase = 0
|
||||
|
||||
pump_restore = 40
|
||||
pump_delay = 1 SECONDS
|
||||
|
||||
origin_tech = list(TECH_MATERIAL = 4,TECH_ENGINEERING = 4,TECH_MAGNET = 4,TECH_POWER = 4)
|
||||
|
||||
/obj/item/custom_ka_upgrade/cells/cell04
|
||||
name = "uranium charging KA cell"
|
||||
build_name = "recharging"
|
||||
desc = "A pumpless cell assembly that containes a miniaturized nuclear reactor housed safely inside the assembly. Recharges the cell shortly over time, however deals slightly reduced damage."
|
||||
icon_state = "cell04"
|
||||
damage_increase = -5
|
||||
recoil_increase = 0
|
||||
cost_increase = -2
|
||||
cell_increase = 60
|
||||
capacity_increase = -4
|
||||
mod_limit_increase = 0
|
||||
|
||||
pump_restore = 0
|
||||
pump_delay = 0
|
||||
|
||||
origin_tech = list(TECH_MATERIAL = 5,TECH_ENGINEERING = 5,TECH_MAGNET = 5,TECH_POWER = 5)
|
||||
|
||||
/obj/item/custom_ka_upgrade/cells/cell04/on_update(var/obj/item/weapon/gun/custom_ka/the_gun)
|
||||
stored_charge = min(stored_charge + 4,cell_increase)
|
||||
|
||||
/obj/item/custom_ka_upgrade/cells/cell05
|
||||
name = "recoil reloader KA cell"
|
||||
build_name = "recoil-reloading"
|
||||
desc = "A very experimental and well designed cell and pump assembly that converts some of the kinetic energy from the weapon's recoil into usable energy. Only works if the recoil is high enough. Contains a basic top-mounted pump just in case."
|
||||
icon_state = "cell05"
|
||||
firedelay_increase = 0.4 SECONDS
|
||||
damage_increase = 0
|
||||
recoil_increase = -5
|
||||
cost_increase = -3
|
||||
cell_increase = 80
|
||||
capacity_increase = -5
|
||||
mod_limit_increase = 0
|
||||
|
||||
pump_restore = 5
|
||||
pump_delay = 0.5 SECONDS
|
||||
|
||||
origin_tech = list(TECH_MATERIAL = 6,TECH_ENGINEERING = 6,TECH_MAGNET = 6,TECH_POWER = 6)
|
||||
|
||||
/obj/item/custom_ka_upgrade/cells/cell05/on_fire(var/obj/item/weapon/gun/custom_ka/the_gun)
|
||||
if(the_gun.recoil_increase > 0)
|
||||
stored_charge = min(stored_charge + min(the_gun.recoil_increase*2,the_gun.cost_increase*0.5),cell_increase)
|
||||
|
||||
/obj/item/custom_ka_upgrade/cells/illegal
|
||||
//Pump Action
|
||||
name = "pump action KA cell"
|
||||
build_name = "static"
|
||||
desc = "A clusterfuck of circuitry and battery parts all snuggly fit inside a solid, static plastisteel frame."
|
||||
icon_state = "cell_illegal"
|
||||
firedelay_increase = 0
|
||||
recoil_increase = 0
|
||||
cost_increase = 0
|
||||
stored_charge = 20
|
||||
cell_increase = 20
|
||||
capacity_increase = 0
|
||||
mod_limit_increase = 0
|
||||
|
||||
pump_restore = 20
|
||||
pump_delay = 0.5 SECONDS
|
||||
|
||||
origin_tech = list(TECH_MATERIAL = 3,TECH_ENGINEERING = 3,TECH_MAGNET = 3,TECH_POWER = 3, TECH_ILLEGAL = 4)
|
||||
@@ -0,0 +1,495 @@
|
||||
/obj/item/weapon/gun/custom_ka
|
||||
name = null // Abstract
|
||||
var/official_name
|
||||
var/custom_name
|
||||
desc = "A kinetic accelerator assembly."
|
||||
icon = 'icons/obj/kinetic_accelerators.dmi'
|
||||
icon_state = ""
|
||||
item_state = "kineticgun"
|
||||
contained_sprite = 1
|
||||
flags = CONDUCT
|
||||
slot_flags = SLOT_BELT|SLOT_HOLSTER
|
||||
matter = list(DEFAULT_WALL_MATERIAL = 2000)
|
||||
w_class = 3
|
||||
origin_tech = list(TECH_MATERIAL = 2,TECH_ENGINEERING = 2)
|
||||
|
||||
burst = 1
|
||||
fire_delay = 0 //delay after shooting before the gun can be used again
|
||||
burst_delay = 2 //delay between shots, if firing in bursts
|
||||
move_delay = 1
|
||||
fire_sound = 'sound/weapons/Kenetic_accel.ogg'
|
||||
fire_sound_text = "blast"
|
||||
recoil = 0
|
||||
silenced = 0
|
||||
muzzle_flash = 3
|
||||
accuracy = 0 //accuracy is measured in tiles. +1 accuracy means that everything is effectively one tile closer for the purpose of miss chance, -1 means the opposite. launchers are not supported, at the moment.
|
||||
scoped_accuracy = null
|
||||
burst_accuracy = list(0) //allows for different accuracies for each shot in a burst. Applied on top of accuracy
|
||||
dispersion = list(0)
|
||||
reliability = 100
|
||||
|
||||
var/obj/item/projectile/projectile_type = /obj/item/projectile/kinetic
|
||||
|
||||
pin = /obj/item/device/firing_pin
|
||||
|
||||
sel_mode = 1 //index of the currently selected mode
|
||||
firemodes = list()
|
||||
|
||||
//wielding information
|
||||
fire_delay_wielded = 0
|
||||
recoil_wielded = 0
|
||||
accuracy_wielded = 0
|
||||
wielded = 0
|
||||
needspin = TRUE
|
||||
|
||||
var/build_name = ""
|
||||
|
||||
//Custom stuff
|
||||
var/obj/item/custom_ka_upgrade/cells/installed_cell
|
||||
var/obj/item/custom_ka_upgrade/barrels/installed_barrel
|
||||
var/obj/item/custom_ka_upgrade/upgrade_chips/installed_upgrade_chip
|
||||
|
||||
var/damage_increase = 0 //The amount of damage this weapon does, in total.
|
||||
var/firedelay_increase = 0 //How long it takes for the weapon to fire, in deciseconds.
|
||||
var/range_increase = 0
|
||||
var/recoil_increase = 0 //The amount of recoil this weapon has, in total.
|
||||
var/cost_increase = 0 //How much energy to take per shot, in total.
|
||||
var/cell_increase = 0 //The total increase in battery. This actually doesn't do anything and is just a display variable. Power is handled in their own parts.
|
||||
var/capacity_increase = 0 //How much/big this frame can hold a mod.
|
||||
var/mod_limit_increase = 0 //Maximum size of a mod this frame can take.
|
||||
var/aoe_increase = 0
|
||||
|
||||
var/current_highest_mod = 0
|
||||
|
||||
var/is_emagged = 0
|
||||
var/is_emped = 0
|
||||
|
||||
var/can_disassemble_cell = TRUE
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/examine(var/mob/user)
|
||||
. = ..()
|
||||
if(installed_upgrade_chip)
|
||||
to_chat(user,"It is equipped with \the [installed_barrel], \the [installed_cell], and \the [installed_upgrade_chip].")
|
||||
else if(installed_barrel)
|
||||
to_chat(user,"It is equipped with \the [installed_barrel] and \the [installed_cell]. It has space for an upgrade chip.")
|
||||
else if(installed_cell)
|
||||
to_chat(user,"It is equipped with \the [installed_cell]. The assembly lacks a barrel installation.")
|
||||
|
||||
if(installed_barrel)
|
||||
if(custom_name)
|
||||
to_chat(user,"[custom_name] is written crudely in pen across the side, covering up the offical designation.")
|
||||
else
|
||||
to_chat(user,"The offical designation \"[official_name]\" is etched neatly on the side.")
|
||||
|
||||
if(installed_cell)
|
||||
to_chat(user,"It has [round(installed_cell.stored_charge / cost_increase)] shots remaining.")
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/emag_act(var/remaining_charges, var/mob/user, var/emag_source)
|
||||
to_chat(user,"<span class='warning'>You override the safeties on the [src]...</span>")
|
||||
is_emagged = 1
|
||||
return 1
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/emp_act(severity)
|
||||
is_emped = 1
|
||||
return 1
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/Fire(atom/target, mob/living/user, clickparams, pointblank=0, reflex=0)
|
||||
|
||||
if(!fire_checks(target,user,clickparams,pointblank,reflex))
|
||||
return
|
||||
|
||||
//Custom fire checks
|
||||
var/warning_message
|
||||
var/disaster
|
||||
|
||||
if(is_emped && prob(10))
|
||||
var/list/warning_messages = list(
|
||||
"ERROR CODE: ERROR CODE",
|
||||
"ERROR CODE: PLEASE REPORT THIS",
|
||||
"ERROR CODE: OH GOD HELP",
|
||||
"ERROR CODE: 404 NOT FOUND",
|
||||
"ERROR CODE: KEYBOARD NOT FOUND, PRESS F11 TO CONTINUE",
|
||||
"ERROR CODE: CLICK OKAY TO CONTINUE",
|
||||
"ERROR CODE: AN ERROR HAS OCCURED TRYING TO DISPLAY AN ERROR CODE",
|
||||
"ERROR CODE: NO ERROR CODE FOUND",
|
||||
"ERROR CODE: LOADING.."
|
||||
)
|
||||
warning_message = pick(warning_messages)
|
||||
spark(src.loc, 3, alldirs)
|
||||
else if(!installed_cell || !installed_barrel)
|
||||
if(!is_emagged || (is_emped && prob(5)) )
|
||||
warning_message = "ERROR CODE: 0"
|
||||
else
|
||||
disaster = "spark"
|
||||
else if (damage_increase <= 0)
|
||||
if(!is_emagged || (is_emped && prob(5)) )
|
||||
warning_message = "ERROR CODE: 100"
|
||||
else
|
||||
disaster = "overheat"
|
||||
else if (range_increase < 2)
|
||||
if(!is_emagged || (is_emped && prob(5)) )
|
||||
warning_message = "ERROR CODE: 101"
|
||||
else
|
||||
disaster = "explode"
|
||||
else if (cost_increase > cell_increase)
|
||||
if(!is_emagged || (is_emped && prob(5)) )
|
||||
warning_message = "ERROR CODE: 102"
|
||||
else
|
||||
disaster = "overheat"
|
||||
else if (capacity_increase < 0)
|
||||
if(!is_emagged || (is_emped && prob(5)) )
|
||||
warning_message = "ERROR CODE: 201"
|
||||
else
|
||||
disaster = "overheat"
|
||||
else if (mod_limit_increase < current_highest_mod)
|
||||
if(is_emagged || (is_emped && prob(5)) )
|
||||
warning_message = "ERROR CODE: 202"
|
||||
else
|
||||
disaster = "overheat"
|
||||
|
||||
if(warning_message)
|
||||
to_chat(user,"<b>\The [src]</b> flashes, \"[warning_message].\"")
|
||||
playsound(src,'sound/machines/buzz-two.ogg', 50, 0)
|
||||
handle_click_empty(user)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN*4)
|
||||
return
|
||||
else
|
||||
switch(disaster)
|
||||
if("spark")
|
||||
to_chat(user,"<span class='danger'>\The [src] sparks!</span>")
|
||||
spark(src.loc, 3, alldirs)
|
||||
if("overheat")
|
||||
to_chat(user,"<span class='danger'>\The [src] turns red hot!</span>")
|
||||
user.IgniteMob()
|
||||
if("explode")
|
||||
to_chat(user,"<span class='danger'>\The [src] violently explodes!</span>")
|
||||
explosion(get_turf(src.loc), 0, 1, 2, 4)
|
||||
qdel(src)
|
||||
|
||||
//actually attempt to shoot
|
||||
var/turf/targloc = get_turf(target) //cache this in case target gets deleted during shooting, e.g. if it was a securitron that got destroyed.
|
||||
for(var/i in 1 to burst)
|
||||
var/obj/projectile = consume_next_projectile(user)
|
||||
if(!projectile)
|
||||
handle_click_empty(user)
|
||||
break
|
||||
|
||||
var/acc = burst_accuracy[min(i, burst_accuracy.len)]
|
||||
var/disp = dispersion[min(i, dispersion.len)]
|
||||
process_accuracy(projectile, user, target, acc, disp)
|
||||
|
||||
if(pointblank)
|
||||
process_point_blank(projectile, user, target)
|
||||
|
||||
if(process_projectile(projectile, user, target, user.zone_sel.selecting, clickparams))
|
||||
handle_post_fire(user, target, pointblank, reflex, i == burst)
|
||||
update_icon()
|
||||
|
||||
if(i < burst)
|
||||
sleep(burst_delay)
|
||||
|
||||
if(!(target && target.loc))
|
||||
target = targloc
|
||||
pointblank = 0
|
||||
|
||||
update_held_icon()
|
||||
//update timing
|
||||
user.setClickCooldown(DEFAULT_QUICK_COOLDOWN)
|
||||
user.setMoveCooldown(move_delay)
|
||||
next_fire_time = world.time + fire_delay
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/consume_next_projectile()
|
||||
if(!installed_cell || installed_cell.stored_charge < cost_increase)
|
||||
return null
|
||||
|
||||
installed_cell.stored_charge -= cost_increase
|
||||
|
||||
var/obj/item/projectile/shot_projectile
|
||||
//Send fire events
|
||||
if(installed_cell)
|
||||
installed_cell.on_fire(src)
|
||||
if(installed_barrel)
|
||||
installed_barrel.on_fire(src)
|
||||
shot_projectile = new installed_barrel.projectile_type(src.loc)
|
||||
if(installed_upgrade_chip)
|
||||
installed_upgrade_chip.on_fire(src)
|
||||
|
||||
shot_projectile.damage = damage_increase
|
||||
shot_projectile.range = range_increase
|
||||
shot_projectile.aoe = aoe_increase
|
||||
return shot_projectile
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/Initialize()
|
||||
. = ..()
|
||||
START_PROCESSING(SSprocessing, src)
|
||||
|
||||
if(installed_cell)
|
||||
installed_cell = new installed_cell(src)
|
||||
if(installed_barrel)
|
||||
installed_barrel = new installed_barrel(src)
|
||||
if(installed_upgrade_chip)
|
||||
installed_upgrade_chip = new installed_upgrade_chip(src)
|
||||
|
||||
update_stats()
|
||||
queue_icon_update()
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/Destroy()
|
||||
. = ..()
|
||||
STOP_PROCESSING(SSprocessing, src)
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/process()
|
||||
if(installed_cell)
|
||||
installed_cell.on_update(src)
|
||||
if(installed_barrel)
|
||||
installed_barrel.on_update(src)
|
||||
if(installed_upgrade_chip)
|
||||
installed_upgrade_chip.on_update(src)
|
||||
. = ..()
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/update_icon()
|
||||
. = ..()
|
||||
cut_overlays()
|
||||
var/name_list = list("","","","")
|
||||
|
||||
name_list[3] = src.build_name
|
||||
|
||||
if(installed_upgrade_chip)
|
||||
add_overlay(installed_upgrade_chip.icon_state)
|
||||
name_list[4] = installed_upgrade_chip.build_name
|
||||
|
||||
if(installed_cell)
|
||||
add_overlay(installed_cell.icon_state)
|
||||
name_list[1] = installed_cell.build_name
|
||||
|
||||
if(installed_barrel)
|
||||
add_overlay(installed_barrel.icon_state)
|
||||
name_list[2] = installed_barrel.build_name
|
||||
|
||||
official_name = sanitize(jointext(name_list," "))
|
||||
|
||||
if(installed_barrel)
|
||||
if(custom_name)
|
||||
name = custom_name
|
||||
else
|
||||
name = official_name
|
||||
else
|
||||
name = initial(name)
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/proc/update_stats()
|
||||
//pls don't bully me for this code
|
||||
damage_increase = initial(damage_increase)
|
||||
firedelay_increase = initial(firedelay_increase)
|
||||
range_increase = initial(range_increase)
|
||||
recoil_increase = initial(recoil_increase)
|
||||
cost_increase = initial(cost_increase)
|
||||
cell_increase = initial(cell_increase)
|
||||
capacity_increase = initial(capacity_increase)
|
||||
mod_limit_increase = initial(mod_limit_increase)
|
||||
aoe_increase = initial(aoe_increase)
|
||||
|
||||
if(installed_cell)
|
||||
damage_increase += installed_cell.damage_increase
|
||||
firedelay_increase += installed_cell.firedelay_increase
|
||||
range_increase += installed_cell.range_increase
|
||||
recoil_increase += installed_cell.recoil_increase
|
||||
cost_increase += installed_cell.cost_increase
|
||||
cell_increase += installed_cell.cell_increase
|
||||
capacity_increase += installed_cell.capacity_increase
|
||||
mod_limit_increase += installed_cell.mod_limit_increase
|
||||
aoe_increase += installed_cell.aoe_increase
|
||||
current_highest_mod = max(-installed_cell.capacity_increase,current_highest_mod)
|
||||
|
||||
if(installed_barrel)
|
||||
fire_sound = installed_barrel.fire_sound
|
||||
damage_increase += installed_barrel.damage_increase
|
||||
firedelay_increase += installed_barrel.firedelay_increase
|
||||
range_increase += installed_barrel.range_increase
|
||||
recoil_increase += installed_barrel.recoil_increase
|
||||
cost_increase += installed_barrel.cost_increase
|
||||
cell_increase += installed_barrel.cell_increase
|
||||
capacity_increase += installed_barrel.capacity_increase
|
||||
mod_limit_increase += installed_barrel.mod_limit_increase
|
||||
aoe_increase += installed_barrel.aoe_increase
|
||||
current_highest_mod = max(-installed_barrel.capacity_increase,current_highest_mod)
|
||||
|
||||
if(installed_upgrade_chip)
|
||||
damage_increase += installed_upgrade_chip.damage_increase
|
||||
firedelay_increase += installed_upgrade_chip.firedelay_increase
|
||||
range_increase += installed_upgrade_chip.range_increase
|
||||
recoil_increase += installed_upgrade_chip.recoil_increase
|
||||
cost_increase += installed_upgrade_chip.cost_increase
|
||||
cell_increase += installed_upgrade_chip.cell_increase
|
||||
capacity_increase += installed_upgrade_chip.capacity_increase
|
||||
mod_limit_increase += installed_upgrade_chip.mod_limit_increase
|
||||
aoe_increase += installed_upgrade_chip.aoe_increase
|
||||
current_highest_mod = max(-installed_upgrade_chip.capacity_increase,current_highest_mod)
|
||||
|
||||
//Explot fixing
|
||||
cell_increase = max(cell_increase,0)
|
||||
cost_increase = max(cost_increase,1)
|
||||
recoil_increase = max(recoil_increase,1)
|
||||
firedelay_increase = max(firedelay_increase,0.125 SECONDS)
|
||||
|
||||
aoe_increase += round(damage_increase/30)
|
||||
aoe_increase = max(0,aoe_increase)
|
||||
|
||||
//Gun stats
|
||||
recoil = recoil_increase*0.25
|
||||
fire_delay = firedelay_increase
|
||||
accuracy = round(recoil_increase*0.25)
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/attack_self(mob/user as mob)
|
||||
. = ..()
|
||||
if(installed_cell)
|
||||
installed_cell.attack_self(user)
|
||||
if(installed_barrel)
|
||||
installed_barrel.attack_self(user)
|
||||
if(installed_upgrade_chip)
|
||||
installed_upgrade_chip.attack_self(user)
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/attackby(var/obj/item/I as obj, var/mob/user as mob)
|
||||
|
||||
. = ..()
|
||||
|
||||
if(istype(I,/obj/item/weapon/pen))
|
||||
custom_name = sanitize(input("Enter a custom name for your [name]", "Set Name") as text|null)
|
||||
to_chat(user,"You label \the [name] as \"[custom_name]\"")
|
||||
update_icon()
|
||||
else if(istype(I,/obj/item/weapon/wrench))
|
||||
if(installed_upgrade_chip)
|
||||
playsound(src,'sound/items/Screwdriver.ogg', 50, 0)
|
||||
to_chat(user,"You remove \the [installed_upgrade_chip].")
|
||||
installed_upgrade_chip.forceMove(user.loc)
|
||||
installed_upgrade_chip.update_icon()
|
||||
installed_upgrade_chip = null
|
||||
update_stats()
|
||||
update_icon()
|
||||
else if(installed_barrel)
|
||||
playsound(src,'sound/items/Ratchet.ogg', 50, 0)
|
||||
to_chat(user,"You remove \the [installed_barrel].")
|
||||
installed_barrel.forceMove(user.loc)
|
||||
installed_barrel.update_icon()
|
||||
installed_barrel = null
|
||||
update_stats()
|
||||
update_icon()
|
||||
else if(installed_cell && can_disassemble_cell)
|
||||
playsound(src,'sound/items/Ratchet.ogg', 50, 0)
|
||||
to_chat(user,"You remove \the [installed_cell].")
|
||||
installed_cell.forceMove(user.loc)
|
||||
installed_cell.update_icon()
|
||||
installed_cell = null
|
||||
update_stats()
|
||||
update_icon()
|
||||
else
|
||||
to_chat(user,"There is nothing to remove from \the [src].")
|
||||
else if(istype(I,/obj/item/custom_ka_upgrade/cells))
|
||||
if(installed_cell)
|
||||
to_chat(user,"There is already \an [installed_cell] installed.")
|
||||
else
|
||||
var/obj/item/custom_ka_upgrade/cells/tempvar = I
|
||||
installed_cell = tempvar
|
||||
user.remove_from_mob(installed_cell)
|
||||
installed_cell.loc = src
|
||||
update_stats()
|
||||
update_icon()
|
||||
playsound(src,'sound/items/Wirecutter.ogg', 50, 0)
|
||||
else if(istype(I,/obj/item/custom_ka_upgrade/barrels))
|
||||
if(!installed_cell)
|
||||
to_chat(user,"You must install a power cell before installing \the [I].")
|
||||
else if(installed_barrel)
|
||||
to_chat(user,"There is already \an [installed_barrel] installed.")
|
||||
else
|
||||
var/obj/item/custom_ka_upgrade/barrels/tempvar = I
|
||||
installed_barrel = tempvar
|
||||
user.remove_from_mob(installed_barrel)
|
||||
installed_barrel.loc = src
|
||||
update_stats()
|
||||
update_icon()
|
||||
playsound(src,'sound/items/Wirecutter.ogg', 50, 0)
|
||||
else if(istype(I,/obj/item/custom_ka_upgrade/upgrade_chips))
|
||||
if(!installed_cell || !installed_barrel)
|
||||
to_chat(user,"A barrel and a cell need to be installed before you install \the [I].")
|
||||
else if(installed_upgrade_chip)
|
||||
to_chat(user,"There is already \an [installed_upgrade_chip] installed.")
|
||||
else
|
||||
var/obj/item/custom_ka_upgrade/upgrade_chips/tempvar = I
|
||||
installed_upgrade_chip = tempvar
|
||||
user.remove_from_mob(installed_upgrade_chip)
|
||||
installed_upgrade_chip.loc = src
|
||||
update_stats()
|
||||
update_icon()
|
||||
playsound(src,'sound/items/Wirecutter.ogg', 50, 0)
|
||||
|
||||
/obj/item/custom_ka_upgrade //base item
|
||||
name = null //abstract
|
||||
icon = 'icons/obj/kinetic_accelerators.dmi'
|
||||
icon_state = ""
|
||||
var/build_name = ""
|
||||
var/damage_increase = 0
|
||||
var/firedelay_increase = 0
|
||||
var/range_increase = 0
|
||||
var/recoil_increase = 0
|
||||
var/cost_increase = 0
|
||||
var/cell_increase = 0
|
||||
var/capacity_increase = 0
|
||||
var/mod_limit_increase = 0
|
||||
var/aoe_increase = 0
|
||||
|
||||
var/is_emagged = 0
|
||||
var/is_emped = 0
|
||||
|
||||
/obj/item/custom_ka_upgrade/proc/on_update(var/obj/item/weapon/gun/custom_ka)
|
||||
//Do update related things here
|
||||
return
|
||||
|
||||
/obj/item/custom_ka_upgrade/proc/on_fire(var/obj/item/weapon/gun/custom_ka)
|
||||
//Do fire related things here
|
||||
return
|
||||
|
||||
/obj/item/custom_ka_upgrade/cells
|
||||
name = null //Abstract
|
||||
icon = 'icons/obj/kinetic_accelerators.dmi'
|
||||
icon_state = ""
|
||||
damage_increase = 0
|
||||
firedelay_increase = 0
|
||||
range_increase = 0
|
||||
recoil_increase = 0
|
||||
cost_increase = 0
|
||||
cell_increase = 0
|
||||
capacity_increase = 0
|
||||
mod_limit_increase = 0
|
||||
var/stored_charge = 0
|
||||
var/pump_restore = 0
|
||||
var/pump_delay = 0
|
||||
var/is_pumping = FALSE //Prevents from pumping stupidly fast do to a do_after exploit
|
||||
origin_tech = list(TECH_MATERIAL = 2,TECH_ENGINEERING = 2,TECH_MAGNET = 2,TECH_POWER=2)
|
||||
|
||||
/obj/item/custom_ka_upgrade/barrels
|
||||
name = null //Abstract
|
||||
icon = 'icons/obj/kinetic_accelerators.dmi'
|
||||
icon_state = ""
|
||||
damage_increase = 0
|
||||
firedelay_increase = 0
|
||||
range_increase = 0
|
||||
recoil_increase = 0
|
||||
cost_increase = 0
|
||||
cell_increase = 0
|
||||
capacity_increase = 0
|
||||
mod_limit_increase = 0
|
||||
var/fire_sound = 'sound/weapons/Kenetic_accel.ogg'
|
||||
var/projectile_type = /obj/item/projectile/kinetic
|
||||
origin_tech = list(TECH_MATERIAL = 2,TECH_ENGINEERING = 2,TECH_MAGNET = 2)
|
||||
|
||||
/obj/item/custom_ka_upgrade/upgrade_chips
|
||||
name = null
|
||||
icon = 'icons/obj/kinetic_accelerators.dmi'
|
||||
damage_increase = 0
|
||||
firedelay_increase = 0
|
||||
range_increase = 0
|
||||
recoil_increase = 0
|
||||
cost_increase = 0
|
||||
cell_increase = 0
|
||||
capacity_increase = 0
|
||||
mod_limit_increase = 0
|
||||
|
||||
origin_tech = list(TECH_POWER = 4,TECH_MAGNET = 4, TECH_DATA = 4)
|
||||
@@ -0,0 +1,88 @@
|
||||
/obj/item/weapon/gun/custom_ka/frame01
|
||||
name = "compact kinetic accelerator frame"
|
||||
build_name = "compact"
|
||||
icon_state = "frame01"
|
||||
w_class = 3
|
||||
capacity_increase = 3
|
||||
mod_limit_increase = 2
|
||||
origin_tech = list(TECH_MATERIAL = 2,TECH_ENGINEERING = 2)
|
||||
slot_flags = SLOT_BELT
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/frame02
|
||||
name = "light kinetic accelerator frame"
|
||||
build_name = "light"
|
||||
icon_state = "frame02"
|
||||
w_class = 3
|
||||
recoil_increase = -1
|
||||
capacity_increase = 5
|
||||
mod_limit_increase = 3
|
||||
origin_tech = list(TECH_MATERIAL = 3,TECH_ENGINEERING = 3)
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/frame03
|
||||
name = "medium kinetic accelerator frame"
|
||||
build_name = "medium"
|
||||
icon_state = "frame03"
|
||||
w_class = 4
|
||||
recoil_increase = -2
|
||||
capacity_increase = 7
|
||||
mod_limit_increase = 4
|
||||
origin_tech = list(TECH_MATERIAL = 4,TECH_ENGINEERING = 4)
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/frame04
|
||||
name = "heavy kinetic accelerator frame"
|
||||
build_name = "heavy"
|
||||
icon_state = "frame04"
|
||||
w_class = 5
|
||||
recoil_increase = -5
|
||||
capacity_increase = 9
|
||||
mod_limit_increase = 5
|
||||
origin_tech = list(TECH_MATERIAL = 5,TECH_ENGINEERING = 5)
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/frame05
|
||||
name = "tactical kinetic accelerator frame"
|
||||
build_name = "tactical"
|
||||
icon_state = "frame05"
|
||||
w_class = 5
|
||||
recoil_increase = -6
|
||||
capacity_increase = 10
|
||||
mod_limit_increase = 5
|
||||
origin_tech = list(TECH_MATERIAL = 6,TECH_ENGINEERING = 6)
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/frame01/prebuilt
|
||||
installed_cell = /obj/item/custom_ka_upgrade/cells/cell01
|
||||
installed_barrel = /obj/item/custom_ka_upgrade/barrels/barrel01
|
||||
installed_upgrade_chip = /obj/item/custom_ka_upgrade/upgrade_chips/focusing
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/frame02/prebuilt
|
||||
installed_cell = /obj/item/custom_ka_upgrade/cells/cell02
|
||||
installed_barrel = /obj/item/custom_ka_upgrade/barrels/barrel02
|
||||
installed_upgrade_chip = /obj/item/custom_ka_upgrade/upgrade_chips/firerate
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/frame03/prebuilt
|
||||
installed_cell = /obj/item/custom_ka_upgrade/cells/cell03
|
||||
installed_barrel = /obj/item/custom_ka_upgrade/barrels/barrel03
|
||||
installed_upgrade_chip = /obj/item/custom_ka_upgrade/upgrade_chips/focusing
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/frame04/prebuilt
|
||||
installed_cell = /obj/item/custom_ka_upgrade/cells/cell04
|
||||
installed_barrel = /obj/item/custom_ka_upgrade/barrels/barrel04
|
||||
installed_upgrade_chip = /obj/item/custom_ka_upgrade/upgrade_chips/effeciency
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/frame04/illegal
|
||||
installed_cell = /obj/item/custom_ka_upgrade/cells/illegal
|
||||
installed_barrel = /obj/item/custom_ka_upgrade/barrels/illegal
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/frame05/prebuilt
|
||||
installed_cell = /obj/item/custom_ka_upgrade/cells/cell05
|
||||
installed_barrel = /obj/item/custom_ka_upgrade/barrels/barrel05
|
||||
installed_upgrade_chip = /obj/item/custom_ka_upgrade/upgrade_chips/damage
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/frame01/illegal
|
||||
installed_cell = /obj/item/custom_ka_upgrade/cells/illegal
|
||||
installed_barrel = /obj/item/custom_ka_upgrade/barrels/illegal
|
||||
installed_upgrade_chip = /obj/item/custom_ka_upgrade/upgrade_chips/illegal
|
||||
|
||||
/obj/item/weapon/gun/custom_ka/frame05/cyborg
|
||||
can_disassemble_cell = FALSE
|
||||
installed_cell = /obj/item/custom_ka_upgrade/cells/cell04
|
||||
installed_barrel = /obj/item/custom_ka_upgrade/barrels/barrel02
|
||||
@@ -0,0 +1,43 @@
|
||||
//Projectiles
|
||||
/obj/item/projectile/kinetic
|
||||
name = "kinetic force"
|
||||
icon_state = null
|
||||
damage = 0 //Base damage handled elsewhere.
|
||||
damage_type = BRUTE
|
||||
check_armour = "bomb"
|
||||
range = 5
|
||||
var/pressure_decrease = 0.25
|
||||
|
||||
/obj/item/projectile/kinetic/on_impact(var/atom/A,var/aoe_scale = 1, var/damage_scale = 1)
|
||||
|
||||
|
||||
var/turf/target_turf = get_turf(A)
|
||||
if(!target_turf)
|
||||
target_turf = get_turf(src)
|
||||
var/datum/gas_mixture/environment = target_turf.return_air()
|
||||
|
||||
damage *= max(1 - (environment.return_pressure()/100)*0.75,0)
|
||||
|
||||
if(isliving(A)) //Never do more than 15 damage to a living being per shot.
|
||||
damage = min(damage,15)
|
||||
|
||||
|
||||
strike_thing(A,aoe*aoe_scale,damage)
|
||||
|
||||
. = ..()
|
||||
|
||||
/obj/item/projectile/kinetic/proc/strike_thing(atom/target,var/new_aoe,var/damage_scale)
|
||||
|
||||
var/turf/target_turf = get_turf(target)
|
||||
if(istype(target_turf, /turf/simulated/mineral))
|
||||
var/turf/simulated/mineral/M = target_turf
|
||||
M.kinetic_hit(damage,dir)
|
||||
else if(istype(target_turf, /turf/simulated/floor/asteroid))
|
||||
var/turf/simulated/floor/asteroid/A = target_turf
|
||||
A.gets_dug()
|
||||
|
||||
new /obj/effect/overlay/temp/kinetic_blast(target_turf)
|
||||
|
||||
if(new_aoe > 0)
|
||||
for(var/new_target in orange(new_aoe, target_turf))
|
||||
src.on_impact(new_target,0,0.5)
|
||||
@@ -0,0 +1,64 @@
|
||||
/obj/item/custom_ka_upgrade/upgrade_chips/damage
|
||||
name = "upgrade chip - damage increase"
|
||||
desc = "Increases damage and recoil."
|
||||
icon_state = "upgrade_chip"
|
||||
damage_increase = 10
|
||||
recoil_increase = 3
|
||||
|
||||
/obj/item/custom_ka_upgrade/upgrade_chips/firerate
|
||||
name = "upgrade chip - firedelay increase"
|
||||
desc = "Increases the rate of fire, reduces damage."
|
||||
icon_state = "upgrade_chip"
|
||||
damage_increase = -5
|
||||
firedelay_increase = -0.5 SECONDS
|
||||
|
||||
/obj/item/custom_ka_upgrade/upgrade_chips/effeciency
|
||||
name = "upgrade chip - effeciency increase"
|
||||
desc = "Reduces the cost of shots by 1, reduces damage."
|
||||
icon_state = "upgrade_chip"
|
||||
damage_increase = -5
|
||||
cost_increase = -1
|
||||
|
||||
/obj/item/custom_ka_upgrade/upgrade_chips/recoil
|
||||
name = "upgrade chip - recoil reduction"
|
||||
desc = "Reduces recoil, increases accuracy, reduces rate of fire"
|
||||
icon_state = "upgrade_chip"
|
||||
recoil_increase = -5
|
||||
firedelay_increase = 0.25 SECONDS
|
||||
|
||||
/obj/item/custom_ka_upgrade/upgrade_chips/focusing
|
||||
name = "upgrade chip - focusing"
|
||||
desc = "Increases damage and accuracy, however reduces the range and explosion size, if any."
|
||||
icon_state = "upgrade_chip"
|
||||
damage_increase = 10
|
||||
recoil_increase = -4
|
||||
range_increase = -2
|
||||
aoe_increase = -100
|
||||
|
||||
/obj/item/custom_ka_upgrade/upgrade_chips/capacity
|
||||
name = "upgrade chip - capacity increase"
|
||||
desc = "Increases the maximum capacity of the assembly at the cost of more power drain per shot."
|
||||
icon_state = "upgrade_chip"
|
||||
cost_increase = 3
|
||||
capacity_increase = 5
|
||||
mod_limit_increase = 1
|
||||
|
||||
/obj/item/custom_ka_upgrade/upgrade_chips/explosive
|
||||
name = "upgrade chip - aoe explosion MKI"
|
||||
desc = "Kinetic blasts explode in an increased AoE radius at significantly increased power drain per shot."
|
||||
icon_state = "upgrade_chip"
|
||||
cost_increase = 5
|
||||
aoe_increase = 2
|
||||
|
||||
/obj/item/custom_ka_upgrade/upgrade_chips/illegal
|
||||
name = "illegal custom KA upgrade chip"
|
||||
desc = "Overrides safety settings for a custom kinetic accelerator. What's the worst that could happen?"
|
||||
icon_state = "upgrade_chip_illegal"
|
||||
damage_increase = 10
|
||||
firedelay_increase = -0.5 SECONDS
|
||||
recoil_increase = 4
|
||||
cost_increase = 1
|
||||
range_increase = 4
|
||||
capacity_increase = 100
|
||||
mod_limit_increase = 5
|
||||
origin_tech = list(TECH_POWER = 6,TECH_MAGNET = 6, TECH_DATA = 6, TECH_ILLEGAL = 4)
|
||||
Reference in New Issue
Block a user