Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a new salvager weapon: The Makeshift Laser Rifle #15856

Merged
merged 70 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
5304a2b
adds basic laser gun and heat system
unfunnyperson Sep 3, 2023
32ea09b
:waa:
unfunnyperson Sep 4, 2023
0e02a01
adds construction
unfunnyperson Sep 4, 2023
3c31ba2
wrong battery desc
unfunnyperson Sep 4, 2023
a66a1c7
breaks instead of exploding
unfunnyperson Sep 5, 2023
c0e63f5
uses big cells as ammo now
unfunnyperson Sep 8, 2023
c44a4af
what if it was FULL-AUTO???
unfunnyperson Sep 8, 2023
42b6038
increase heat drain, increase heat on fire
unfunnyperson Sep 8, 2023
d596b22
simplify construction
unfunnyperson Sep 9, 2023
48c590c
gah
unfunnyperson Sep 9, 2023
70e5993
small laser
unfunnyperson Sep 9, 2023
5fbfcf5
first sprite, use light tubes
unfunnyperson Sep 10, 2023
5dc37c3
select firerate and increase heat drain/gain
unfunnyperson Sep 10, 2023
e427ea4
scream
unfunnyperson Sep 10, 2023
6b85ea5
improved sprites
unfunnyperson Sep 12, 2023
ee94289
aaa
unfunnyperson Sep 12, 2023
efacbd2
what if there was an ITEM STATE!!
unfunnyperson Sep 13, 2023
6b811d4
Merge branch 'master' into makeshift-laser-guns
unfunnyperson Sep 14, 2023
e3af276
use construction component
unfunnyperson Sep 15, 2023
f9ccdcd
adds smoke particle when at high heat
unfunnyperson Sep 16, 2023
16a4371
back sprites
unfunnyperson Sep 16, 2023
98e80aa
final touches
unfunnyperson Sep 16, 2023
45851ce
Merge branch 'master' into makeshift-laser-guns
unfunnyperson Sep 16, 2023
d8a778e
TRUE/FALSE defines
unfunnyperson Sep 16, 2023
dc76439
updates
unfunnyperson Sep 17, 2023
496c774
aa
unfunnyperson Sep 17, 2023
658ef21
help messages
unfunnyperson Sep 17, 2023
a726e5b
change message
unfunnyperson Sep 17, 2023
592a10c
adjustment
unfunnyperson Sep 17, 2023
165da36
massively reduce wire req
unfunnyperson Sep 17, 2023
fc931ac
Replaces glass sheet step with lens step
unfunnyperson Sep 17, 2023
e811666
potato
unfunnyperson Sep 18, 2023
ba90eae
code improvements + minor sprite update
unfunnyperson Sep 18, 2023
f2c8d04
matsci lenses work
unfunnyperson Sep 19, 2023
b404b04
thing
unfunnyperson Sep 20, 2023
93eb774
increase very powerful laser cost
unfunnyperson Sep 20, 2023
cad42f5
Merge branch 'master' into makeshift-laser-guns
unfunnyperson Sep 20, 2023
3628b2a
fix
unfunnyperson Sep 20, 2023
4dd081b
heat decays slightly slower
unfunnyperson Sep 20, 2023
07ae5b4
Merge branch 'master' into makeshift-laser-guns
unfunnyperson Sep 23, 2023
e99dcb5
actually no that was fine
unfunnyperson Sep 23, 2023
f626fcd
Merge branch 'master' into makeshift-laser-guns
unfunnyperson Sep 23, 2023
5fffbe7
Merge branch 'master' into makeshift-laser-guns
unfunnyperson Sep 25, 2023
f9f07f9
salv lens is a subtype now + minor heat change
unfunnyperson Sep 26, 2023
9d3e6f7
fix stray pixel + minor burn sprite change
unfunnyperson Sep 27, 2023
822eeb4
material name adjustment
unfunnyperson Sep 27, 2023
8ca5530
Merge branch 'master' into makeshift-laser-guns
unfunnyperson Sep 29, 2023
22dce0f
Merge branch 'master' into makeshift-laser-guns
unfunnyperson Oct 2, 2023
2d53868
fix
unfunnyperson Oct 3, 2023
8fea52e
gah
unfunnyperson Oct 3, 2023
508e8e2
up base projectile cost, powerful laser changed
unfunnyperson Oct 4, 2023
6b3e2c6
Merge branch 'master' into makeshift-laser-guns
unfunnyperson Oct 7, 2023
46de751
Merge branch 'master' into makeshift-laser-guns
unfunnyperson Oct 8, 2023
9301845
Merge branch 'master' into makeshift-laser-guns
unfunnyperson Oct 19, 2023
a7a94b9
fix
unfunnyperson Oct 19, 2023
cce801b
fix 2
unfunnyperson Oct 19, 2023
52db141
remove update_proj()
unfunnyperson Oct 25, 2023
f37ab74
remove construction + minor adjustments
unfunnyperson Oct 26, 2023
3f9d3c4
whoops
unfunnyperson Oct 26, 2023
38c9bde
whoops 2
unfunnyperson Oct 26, 2023
d5c3925
fix
unfunnyperson Oct 26, 2023
aa98b85
adjustments
unfunnyperson Oct 27, 2023
4856692
Merge branch 'master' into makeshift-laser-guns
unfunnyperson Nov 11, 2023
31ec600
span change
unfunnyperson Nov 11, 2023
357b9e1
changes
unfunnyperson Dec 1, 2023
5e5a925
changes
unfunnyperson Dec 3, 2023
8a77a7b
colored lasers!!
unfunnyperson Dec 7, 2023
b6301f0
Merge branch 'master' into makeshift-laser-guns
unfunnyperson Dec 21, 2023
106659f
Merge remote-tracking branch 'upstream/master' into pr/unfunnyperson/…
Azrun Dec 22, 2023
a7a3511
Expanding possible usage...
Azrun Dec 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions code/datums/components/power_cell.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ TYPEINFO(/datum/component/power_cell)
RegisterSignal(parent, COMSIG_CELL_IS_CELL, PROC_REF(is_cell))
RegisterSignal(parent, COMSIG_ITEM_PROCESS, PROC_REF(process))

/datum/component/power_cell/UnregisterFromParent()
UnregisterSignal(parent, COMSIG_ATTACKBY)
UnregisterSignal(parent, COMSIG_CELL_CHARGE)
UnregisterSignal(parent, COMSIG_CELL_CAN_CHARGE)
UnregisterSignal(parent, COMSIG_CELL_USE)
UnregisterSignal(parent, COMSIG_CELL_CHECK_CHARGE)
UnregisterSignal(parent, COMSIG_CELL_IS_CELL)
UnregisterSignal(parent, COMSIG_ITEM_PROCESS)
. = ..()

/datum/component/power_cell/InheritComponent(datum/component/power_cell/C, i_am_original, max, start_charge, recharge, delay, rechargable)
if(C)
Expand Down
6 changes: 6 additions & 0 deletions code/modules/projectiles/laser.dm
Original file line number Diff line number Diff line change
Expand Up @@ -621,3 +621,9 @@ toxic - poisons
hit.delStatus("cornicened2")
else
hit.setStatus("cornicened")

/datum/projectile/laser/makeshift
cost = 1500
shot_sound = 'sound/weapons/laserlight.ogg'
icon_state = "laser_tiny"
damage = 12
11 changes: 11 additions & 0 deletions code/obj/item/grenades.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1551,11 +1551,22 @@ TYPEINFO(/obj/item/old_grenade/oxygen)
src.AddComponent(/datum/component/assembly, src.allowed_items, PROC_REF(pipebomb_stuffing), TRUE)
// hollow frame + staple gun -> zipgun
src.AddComponent(/datum/component/assembly, /obj/item/staple_gun, PROC_REF(zipgun_crafting), TRUE)
// hollow frame + wrench -> makeshift laser gun frame
src.AddComponent(/datum/component/assembly, TOOL_WRENCHING, PROC_REF(makeshift_laser_crafting), FALSE)
// hollow frame + fuel -> unwired pipebombs
src.AddComponent(/datum/component/assembly, list(/obj/item/reagent_containers/glass, /obj/item/reagent_containers/food/drinks,), PROC_REF(pipebomb_filling), FALSE)
// Since the assembly was done, return TRUE
return TRUE

/// laser rifle crafting proc
proc/makeshift_laser_crafting(var/atom/to_combine_atom, var/mob/user)
user.show_text("You wrench [src] into one long pipe!")
user.u_equip(src)
playsound(src, 'sound/items/Ratchet.ogg', 50, TRUE)
var/obj/item/gun/kinetic/zipgun/new_gun = new/obj/item/makeshift_laser_barrel
unfunnyperson marked this conversation as resolved.
Show resolved Hide resolved
user.put_in_hand_or_drop(new_gun)
qdel(src)

/// Zipgun crafting proc
proc/zipgun_crafting(var/atom/to_combine_atom, var/mob/user)
user.show_text("You combine [to_combine_atom] and [src]. This looks pretty unsafe!")
Expand Down
273 changes: 273 additions & 0 deletions code/obj/item/gun/energy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1858,3 +1858,276 @@ TYPEINFO(/obj/item/gun/energy/wasp)
set_current_projectile(new/datum/projectile/energy_bolt/dazzler)
projectiles = list(current_projectile)
..()

#define HEAT_REMOVED_PER_PROCESS 25
// Makeshift Laser Rifle
TYPEINFO(/obj/item/gun/energy/makeshift)
mats = 0

/obj/item/gun/energy/makeshift
name = "makeshift laser rifle"
icon = 'icons/obj/large/64x32.dmi'
wear_image_icon = 'icons/mob/clothing/back.dmi'
icon_state = "makeshift-energy"
item_state = "makeshift_laser"
wear_state = "makeshift_laser"
w_class = W_CLASS_BULKY
c_flags = ONBACK
cell_type = null
can_swap_cell = FALSE
rechargeable = FALSE
force = 7
two_handed = TRUE
can_dual_wield = FALSE
desc = "A laser rifle cobbled together from various supplies found around the station, probably not the most reliable weapon in a firefight."
muzzle_flash = "muzzle_flash_phaser"
charge_icon_state = "laser"
spread_angle = 10
shoot_delay = 5 DECI SECONDS
///What light source we use for the rifle
var/obj/item/light/tube/our_light
///What battery this gun uses
var/obj/item/cell/our_cell
///How much heat this weapon has after firing, the flashlight breaks if this gets too high
var/heat = 0

proc/break_light()
elecflash(get_turf(src), 1, 3)
our_light.light_status = LIGHT_BURNED
our_light.update()

proc/attach_cell(var/obj/item/cell/C, mob/user)
if (user)
user.u_equip(C)
our_cell = C
our_cell.set_loc(src)
our_cell.AddComponent(/datum/component/power_cell, our_cell.maxcharge, our_cell.charge, our_cell.genrate, 0, FALSE)
SEND_SIGNAL(src, COMSIG_CELL_SWAP, our_cell)
update_icon()
unfunnyperson marked this conversation as resolved.
Show resolved Hide resolved

proc/do_explode()
explosion(src, get_turf(src), -1, -1, 1, 2)
qdel(src)

emp_act()
if (our_cell)
src.visible_message("<span class='alert'>[src]'s cell violently explodes!</span>")
do_explode() // heh

New()
processing_items |= src
set_current_projectile(new/datum/projectile/laser/makeshift)
projectiles = list(current_projectile)
..()

Exited(Obj, newloc)
var/obj/item/cell/C = Obj
if (istype(C) && !QDELETED(C))
C.update_icon()
unfunnyperson marked this conversation as resolved.
Show resolved Hide resolved
var/datum/component/power_cell/comp = C.GetComponent(/datum/component/power_cell)
comp.UnregisterFromParent()
comp.RemoveComponent()
our_cell = null
update_icon()
unfunnyperson marked this conversation as resolved.
Show resolved Hide resolved
. = ..()


process()
if (heat > 0)
heat = max(0, heat - HEAT_REMOVED_PER_PROCESS)
update_icon()
unfunnyperson marked this conversation as resolved.
Show resolved Hide resolved
return

canshoot(mob/user)
if (!our_light)
boutput(user,"<span class='alert'>[src] needs a light source to function!</span>")
return FALSE
else if (our_light.light_status != LIGHT_OK)
boutput(user,"<span class='alert'>[src] has no reaction when you pull the trigger!</span>")
return FALSE
else
return ..()

attackby(obj/item/W, mob/user, params)
if (iswrenchingtool(W) && our_cell)
var/obj/item/removed_cell = our_cell
SEND_SIGNAL(src, COMSIG_CELL_SWAP, null)
boutput(user,"<span class='notice'>You disconnect [our_cell] from [src].</span>")
playsound(src, 'sound/items/Ratchet.ogg', 50, TRUE)
user.put_in_hand_or_drop(removed_cell)
return
else if (istype(W, /obj/item/cell) && !our_cell)
user.u_equip(W)
boutput(user,"<span class='notice'>You attach [W] to [src].</span>")
attach_cell(W, user)
return
else if (issnippingtool(W) && our_light)
boutput(user,"<span class='notice'>You remove [our_light] from the barrel.</span>")
playsound(src, 'sound/items/Wirecutter.ogg', 50, TRUE)
user.put_in_hand_or_drop(our_light)
our_light = null
update_icon()
return
else if (istype(W, /obj/item/light/tube) && !our_light)
boutput(user,"<span class='notice'>You place [W] inside of the barrel and redo the wiring.</span>")
playsound(src.loc, 'sound/effects/pop.ogg', 50, TRUE)
user.u_equip(W)
our_light = W
W.set_loc(src)
update_icon()
return
..()

examine()
. = ..()
if (!our_cell)
. += "[src] is lacking a power source!"
unfunnyperson marked this conversation as resolved.
Show resolved Hide resolved

attack_self(mob/user)
var/I = tgui_input_number(user, "Input a firerate (In deciseconds)", "Timer Adjustment", shoot_delay, 10, 2)
if (!I || BOUNDS_DIST(src, user) > 0)
return
shoot_delay = I
boutput(user, "<span class='notice'>You adjust [src] to fire every [I / 10] seconds.</span>")

update_icon()
if (our_cell)
var/image/overlay_image
if (istype(our_cell, /obj/item/cell/artifact))
var/obj/item/cell/artifact/C = our_cell
var/datum/artifact/powercell/AS = C.artifact
var/datum/artifact_origin/AO = AS.artitype
overlay_image = SafeGetOverlayImage("gun_cell", 'icons/obj/large/64x32.dmi', "makeshift-[AO.name]")
else
overlay_image = SafeGetOverlayImage("gun_cell", 'icons/obj/large/64x32.dmi', "makeshift-[our_cell.icon_state]")
src.UpdateOverlays(overlay_image, "gun_cell")
else
src.UpdateOverlays(null, "gun_cell")

if (our_light)
var/image/overlay_image = SafeGetOverlayImage("gun_light", 'icons/obj/large/64x32.dmi', "makeshift-light")
src.UpdateOverlays(overlay_image, "gun_light")
else
src.UpdateOverlays(null, "gun_light")

if (heat > 70) // danger of breaking
var/image/overlay_image = SafeGetOverlayImage("gun_smoke", 'icons/obj/large/64x32.dmi', "makeshift-smoke")
src.UpdateOverlays(overlay_image, "gun_smoke")
else
src.UpdateOverlays(null, "gun_smoke")
..()

shoot(turf/target, turf/start, mob/user, POX, POY, is_dual_wield, atom/called_target = null)
if (canshoot(user))
if (our_light.rigged) // bad idea
src.visible_message("<span class='alert'>[src]'s light tube violently explodes!</span>")
do_explode()
return
heat += rand(15,20)
update_icon()
unfunnyperson marked this conversation as resolved.
Show resolved Hide resolved
if (heat > 120 || (heat > 100 && prob(25)))
boutput(user,"<span class='alert'>[src]'s light source breaks due to the excess heat within!</span>")
break_light()
return
our_cell.use(current_projectile.cost)
return ..(target, start, user)

/obj/item/makeshift_laser_barrel
name = "pipe assembly"
desc = "A long empty pipe."
w_class = W_CLASS_BULKY // so you cant have 5 almost finished guns in your backpack then finish them in a combat encounter

tooltip_rebuild = TRUE
icon = 'icons/obj/large/64x32.dmi'
icon_state = "makeshift-construction1"

var/obj/item/light/tube/our_light

New()
..()
src.AddComponent(/datum/component/assembly, /obj/item/sheet, PROC_REF(construct_stock), FALSE)

proc/construct_stock(var/atom/to_combine_atom, var/mob/user)
var/obj/item/sheet/W = to_combine_atom
if (W.material.getMaterialFlags() & MATERIAL_METAL && W.amount >= 4)
boutput(user,"<span class='notice'>You construct a stock and grip for the barrel.</span>")
playsound(src.loc, 'sound/effects/pop.ogg', 50, TRUE)
W.change_stack_amount(-4)
name = "pipe/stock assembly"
desc = "A gun of some kind? It seems unfinished."
icon_state = "makeshift-construction2"
update_icon()
src.RemoveComponentsOfType(/datum/component/assembly)
src.AddComponent(/datum/component/assembly, /obj/item/sheet, PROC_REF(construct_lens), FALSE)
return TRUE

proc/construct_lens(var/atom/to_combine_atom, var/mob/user)
var/obj/item/sheet/W = to_combine_atom
if (W.material.getMaterialFlags() & MATERIAL_CRYSTAL && W.amount >= 3)
boutput(user,"<span class='notice'>You create a lens using [W] and stuff it inside [src].</span>")
W.change_stack_amount(-3)
src.RemoveComponentsOfType(/datum/component/assembly)
src.AddComponent(/datum/component/assembly, /obj/item/light/tube, PROC_REF(add_lighttube), FALSE)
return TRUE

proc/add_lighttube(var/atom/to_combine_atom, var/mob/user)
var/obj/item/light/tube/T = to_combine_atom
boutput(user,"<span class='notice'>You place [T] inside of the barrel.</span>")
playsound(src.loc, 'sound/effects/pop.ogg', 50, TRUE)
user.u_equip(T)
our_light = T
T.set_loc(src)
name = "pipe/stock/light assembly"
icon_state = "makeshift-construction3"
update_icon()
src.RemoveComponentsOfType(/datum/component/assembly)
src.AddComponent(/datum/component/assembly, /obj/item/device/timer, PROC_REF(add_timer), FALSE)
return TRUE

proc/add_timer(var/atom/to_combine_atom, var/mob/user)
var/obj/item/device/timer/T = to_combine_atom
boutput(user,"<span class='notice'>You attach the timer to [src].</span>")
playsound(src.loc, 'sound/effects/pop.ogg', 50, TRUE)
user.u_equip(T)
qdel(T)
name = "pipe/stock/light/timer assembly"
icon_state = "makeshift-construction4"
update_icon()
src.RemoveComponentsOfType(/datum/component/assembly)
src.AddComponent(/datum/component/assembly, TOOL_WELDING, PROC_REF(weld_barrel), FALSE)
return TRUE

proc/weld_barrel(var/atom/to_combine_atom, var/mob/user)
if (to_combine_atom:try_weld(user, 1))
boutput(user,"<span class='notice'>You weld the end of the barrel into a point.</span>")
name = "makeshift energy rifle"
icon_state = "makeshift-construction5"
update_icon()
src.RemoveComponentsOfType(/datum/component/assembly)
src.AddComponent(/datum/component/assembly, /obj/item/cable_coil, PROC_REF(finish_gun), FALSE)
return TRUE

proc/finish_gun(var/atom/to_combine_atom, var/mob/user)
var/obj/item/cable_coil/C = to_combine_atom
boutput(user,"<span class='notice'>You wire [src] together.</span>")
C.change_stack_amount(-1)
var/obj/item/gun/energy/makeshift/M = new/obj/item/gun/energy/makeshift
M.our_light = our_light
our_light.set_loc(M)
user.put_in_hand_or_drop(M)
M.update_icon()
qdel(src)
return



/obj/item/makeshift_laser_barrel/testing

New()
..()
our_light = new /obj/item/light/tube
our_light.set_loc(src)
src.RemoveComponentsOfType(/datum/component/assembly)
src.AddComponent(/datum/component/assembly, /obj/item/cable_coil, PROC_REF(finish_gun), FALSE)

#undef HEAT_REMOVED_PER_PROCESS
Binary file modified icons/mob/clothing/back.dmi
Binary file not shown.
Binary file modified icons/mob/inhand/hand_guns.dmi
Binary file not shown.
Binary file modified icons/obj/large/64x32.dmi
Binary file not shown.
Binary file modified icons/obj/projectiles.dmi
Binary file not shown.