mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 05:00:55 +01:00
[MIRROR] adds a gun circuit shell (#7934)
* adds a gun circuit shell (#61156) adds the circuit gun shell, every projectile it hits with outputs the shot mob, everytime its shot charge from an attached circuit is transferred to it, it deals no damage increases the range of the to string circuit to 7 tiles from 5, now should get everything in view range * adds a gun circuit shell * Update gun.dm Co-authored-by: Fikou <23585223+Fikou@users.noreply.github.com> Co-authored-by: Gandalf <jzo123@hotmail.com>
This commit is contained in:
co-authored by
Fikou
Gandalf
parent
bd116f2e38
commit
ebbd5fae19
@@ -991,6 +991,8 @@
|
||||
#define COMSIG_MOB_FIRED_GUN "mob_fired_gun"
|
||||
///called in /obj/item/gun/process_fire (user, target, params, zone_override)
|
||||
#define COMSIG_GUN_FIRED "gun_fired"
|
||||
///called in /obj/item/gun/process_chamber (src)
|
||||
#define COMSIG_GUN_CHAMBER_PROCESSED "gun_chamber_processed"
|
||||
///called in /obj/item/gun/ballistic/process_chamber (casing)
|
||||
#define COMSIG_CASING_EJECTED "casing_ejected"
|
||||
|
||||
|
||||
@@ -152,8 +152,12 @@
|
||||
zoom(user, user.dir, FALSE) //we can only stay zoomed in if it's in our hands //yeah and we only unzoom if we're actually zoomed using the gun!!
|
||||
|
||||
//called after the gun has successfully fired its chambered ammo.
|
||||
/obj/item/gun/proc/process_chamber()
|
||||
return FALSE
|
||||
/obj/item/gun/proc/process_chamber(empty_chamber = TRUE, from_firing = TRUE, chamber_next_round = TRUE)
|
||||
handle_chamber(empty_chamber, from_firing, chamber_next_round)
|
||||
SEND_SIGNAL(src, COMSIG_GUN_CHAMBER_PROCESSED)
|
||||
|
||||
/obj/item/gun/proc/handle_chamber(empty_chamber = TRUE, from_firing = TRUE, chamber_next_round = TRUE)
|
||||
return
|
||||
|
||||
//check if there's enough ammo/energy/whatever to shoot one time
|
||||
//i.e if clicking would make it shoot
|
||||
|
||||
@@ -210,7 +210,7 @@
|
||||
. += "[icon_state]_mag_[capacity_number]"
|
||||
|
||||
|
||||
/obj/item/gun/ballistic/process_chamber(empty_chamber = TRUE, from_firing = TRUE, chamber_next_round = TRUE)
|
||||
/obj/item/gun/ballistic/handle_chamber(empty_chamber = TRUE, from_firing = TRUE, chamber_next_round = TRUE)
|
||||
if(!semi_auto && from_firing)
|
||||
return
|
||||
var/obj/item/ammo_casing/AC = chambered //Find chambered round
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
can_be_sawn_off = FALSE
|
||||
projectile_damage_multiplier = 0.75
|
||||
|
||||
/obj/item/gun/ballistic/rifle/boltaction/pipegun/process_chamber(empty_chamber, from_firing, chamber_next_round)
|
||||
/obj/item/gun/ballistic/rifle/boltaction/pipegun/handle_chamber()
|
||||
. = ..()
|
||||
do_sparks(1, TRUE, src)
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@
|
||||
pb_knockback = 0
|
||||
gun_flags = TOY_FIREARM_OVERLAY
|
||||
|
||||
/obj/item/gun/ballistic/shotgun/toy/process_chamber(empty_chamber = 0)
|
||||
..()
|
||||
/obj/item/gun/ballistic/shotgun/toy/handle_chamber()
|
||||
. = ..()
|
||||
if(chambered && !chambered.loaded_projectile)
|
||||
qdel(chambered)
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@
|
||||
if(!chambered.loaded_projectile)
|
||||
chambered.newshot()
|
||||
|
||||
/obj/item/gun/energy/process_chamber()
|
||||
/obj/item/gun/energy/handle_chamber()
|
||||
if(chambered && !chambered.loaded_projectile) //if loaded_projectile is null, i.e the shot has been fired...
|
||||
var/obj/item/ammo_casing/energy/shot = chambered
|
||||
cell.use(shot.e_cost)//... drain the cell cell
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
if (charges && chambered && !chambered.loaded_projectile)
|
||||
chambered.newshot()
|
||||
|
||||
/obj/item/gun/magic/process_chamber()
|
||||
/obj/item/gun/magic/handle_chamber()
|
||||
if(chambered && !chambered.loaded_projectile) //if BB is null, i.e the shot has been fired...
|
||||
charges--//... drain a charge
|
||||
recharge_newshot()
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
/obj/item/gun/chem/can_shoot()
|
||||
return syringes_left
|
||||
|
||||
/obj/item/gun/chem/process_chamber()
|
||||
/obj/item/gun/chem/handle_chamber()
|
||||
if(chambered && !chambered.loaded_projectile && syringes_left)
|
||||
chambered.newshot()
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
/obj/item/gun/syringe/can_shoot()
|
||||
return syringes.len
|
||||
|
||||
/obj/item/gun/syringe/process_chamber()
|
||||
/obj/item/gun/syringe/handle_chamber()
|
||||
if(chambered && !chambered.loaded_projectile) //we just fired
|
||||
recharge_newshot()
|
||||
update_appearance()
|
||||
|
||||
@@ -308,6 +308,15 @@
|
||||
materials = list(/datum/material/glass = 2000, /datum/material/iron = 7000)
|
||||
category = list("Circuitry", "Shells")
|
||||
|
||||
/datum/design/gun_shell
|
||||
name = "Gun Shell"
|
||||
desc = "A handheld shell that can fire projectiles to output entities."
|
||||
id = "gun_shell"
|
||||
build_path = /obj/item/gun/energy/wiremod_gun
|
||||
build_type = PROTOLATHE | COMPONENT_PRINTER
|
||||
materials = list(/datum/material/glass = 2000, /datum/material/iron = 10000, /datum/material/plasma = 100)
|
||||
category = list("Circuitry", "Shells")
|
||||
|
||||
/datum/design/bot_shell
|
||||
name = "Bot Shell"
|
||||
desc = "An immobile shell that can store more components. Has a USB port to be able to connect to computers and machines."
|
||||
|
||||
@@ -700,8 +700,9 @@
|
||||
prereq_ids = list("basic_circuitry", "engineering")
|
||||
design_ids = list(
|
||||
"bot_shell",
|
||||
"door_shell",
|
||||
"controller_shell",
|
||||
"door_shell",
|
||||
"gun_shell",
|
||||
"money_bot_shell",
|
||||
"scanner_gate_shell",
|
||||
"scanner_shell",
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL|CIRCUIT_FLAG_OUTPUT_SIGNAL
|
||||
|
||||
var/max_range = 5
|
||||
var/max_range = 7
|
||||
|
||||
/obj/item/circuit_component/tostring/Initialize()
|
||||
. = ..()
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* # Circuit Gun
|
||||
*
|
||||
* A gun that lets you fire projectiles to enact circuitry.
|
||||
*/
|
||||
/obj/item/gun/energy/wiremod_gun
|
||||
name = "circuit gun"
|
||||
desc = "A gun that fires projectiles able to control circuitry. It can recharge using power from an attached circuit."
|
||||
icon = 'icons/obj/wiremod.dmi'
|
||||
icon_state = "setup_gun"
|
||||
ammo_type = list(/obj/item/ammo_casing/energy/wiremod_gun)
|
||||
cell_type = /obj/item/stock_parts/cell/emproof/wiremod_gun
|
||||
item_flags = NONE
|
||||
light_system = MOVABLE_LIGHT_DIRECTIONAL
|
||||
light_on = FALSE
|
||||
automatic_charge_overlays = FALSE
|
||||
trigger_guard = TRIGGER_GUARD_ALLOW_ALL
|
||||
|
||||
/obj/item/ammo_casing/energy/wiremod_gun
|
||||
projectile_type = /obj/projectile/energy/wiremod_gun
|
||||
select_name = "circuit"
|
||||
fire_sound = 'sound/weapons/blaster.ogg'
|
||||
|
||||
/obj/projectile/energy/wiremod_gun
|
||||
name = "scanning beam"
|
||||
icon_state = "energy"
|
||||
nodamage = TRUE
|
||||
damage = 0
|
||||
range = 7
|
||||
|
||||
/obj/item/stock_parts/cell/emproof/wiremod_gun
|
||||
maxcharge = 100
|
||||
|
||||
/obj/item/gun/energy/wiremod_gun/Initialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/shell, list(
|
||||
new /obj/item/circuit_component/wiremod_gun()
|
||||
), SHELL_CAPACITY_MEDIUM)
|
||||
|
||||
/obj/item/circuit_component/wiremod_gun
|
||||
display_name = "Gun"
|
||||
desc = "Used to receive entities hit by projectiles from a gun."
|
||||
/// Called when a projectile hits
|
||||
var/datum/port/output/signal
|
||||
/// The shooter
|
||||
var/datum/port/output/shooter
|
||||
/// The entity being shot
|
||||
var/datum/port/output/shot
|
||||
|
||||
/obj/item/circuit_component/wiremod_gun/Initialize()
|
||||
. = ..()
|
||||
shooter = add_output_port("Shooter", PORT_TYPE_ATOM)
|
||||
shot = add_output_port("Shot Entity", PORT_TYPE_ATOM)
|
||||
signal = add_output_port("Shot", PORT_TYPE_SIGNAL)
|
||||
|
||||
/obj/item/circuit_component/wiremod_gun/register_shell(atom/movable/shell)
|
||||
RegisterSignal(shell, COMSIG_PROJECTILE_ON_HIT, .proc/handle_shot)
|
||||
if(istype(shell, /obj/item/gun/energy))
|
||||
RegisterSignal(shell, COMSIG_GUN_CHAMBER_PROCESSED, .proc/handle_chamber)
|
||||
|
||||
/obj/item/circuit_component/wiremod_gun/unregister_shell(atom/movable/shell)
|
||||
UnregisterSignal(shell, list(COMSIG_PROJECTILE_ON_HIT, COMSIG_GUN_CHAMBER_PROCESSED))
|
||||
|
||||
/**
|
||||
* Called when the shell item shoots something
|
||||
*/
|
||||
/obj/item/circuit_component/wiremod_gun/proc/handle_shot(atom/source, mob/firer, atom/target, angle)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
playsound(source, get_sfx("terminal_type"), 25, FALSE)
|
||||
shooter.set_output(firer)
|
||||
shot.set_output(target)
|
||||
signal.set_output(COMPONENT_SIGNAL)
|
||||
|
||||
/**
|
||||
* Called when the shell item processes a new chamber
|
||||
*/
|
||||
/obj/item/circuit_component/wiremod_gun/proc/handle_chamber(atom/source)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(!parent?.cell)
|
||||
return
|
||||
var/obj/item/gun/energy/fired_gun = source
|
||||
var/totransfer = min(100, parent.cell.charge)
|
||||
var/transferred = fired_gun.cell.give(totransfer)
|
||||
parent.cell.use(transferred)
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
@@ -246,8 +246,13 @@
|
||||
return TRUE
|
||||
|
||||
//called after the gun has successfully fired its chambered ammo.
|
||||
/obj/item/gun/proc/process_chamber()
|
||||
return FALSE
|
||||
/obj/item/gun/proc/process_chamber(empty_chamber = TRUE, from_firing = TRUE, chamber_next_round = TRUE)
|
||||
handle_chamber(empty_chamber, from_firing, chamber_next_round)
|
||||
SEND_SIGNAL(src, COMSIG_GUN_CHAMBER_PROCESSED)
|
||||
|
||||
/obj/item/gun/proc/handle_chamber(empty_chamber = TRUE, from_firing = TRUE, chamber_next_round = TRUE)
|
||||
return
|
||||
|
||||
|
||||
//check if there's enough ammo/energy/whatever to shoot one time
|
||||
//i.e if clicking would make it shoot
|
||||
|
||||
@@ -3848,6 +3848,7 @@
|
||||
#include "code\modules\wiremod\shell\compact_remote.dm"
|
||||
#include "code\modules\wiremod\shell\controller.dm"
|
||||
#include "code\modules\wiremod\shell\drone.dm"
|
||||
#include "code\modules\wiremod\shell\gun.dm"
|
||||
#include "code\modules\wiremod\shell\moneybot.dm"
|
||||
#include "code\modules\wiremod\shell\scanner.dm"
|
||||
#include "code\modules\wiremod\shell\scanner_gate.dm"
|
||||
|
||||
Reference in New Issue
Block a user