Somatoray Modularity

This commit is contained in:
Casey
2021-11-20 05:46:43 -05:00
committed by Chompstation Bot
parent e6f330182b
commit 9c7d030128
3 changed files with 68 additions and 12 deletions

View File

@@ -48,8 +48,13 @@
modifystate = "floramut"
cell_type = /obj/item/weapon/cell/device/weapon/recharge
battery_lock = 1
var/decl/plantgene/gene = null
<<<<<<< HEAD
recoil_mode = 0 //CHOMP Addition
=======
var/obj/item/weapon/stock_parts/micro_laser/emitter
>>>>>>> dead3acae1... Merge pull request #11841 from FartMaster69420/somatoray
firemodes = list(
list(mode_name="induce mutations", projectile_type=/obj/item/projectile/energy/floramut, modifystate="floramut"),
@@ -57,8 +62,42 @@
list(mode_name="induce specific mutations", projectile_type=/obj/item/projectile/energy/floramut/gene, modifystate="floramut"),
)
/obj/item/weapon/gun/energy/floragun/Initialize()
. = ..()
emitter = new(src)
/obj/item/weapon/gun/energy/floragun/examine(var/mob/user)
. = ..()
if(Adjacent(user))
. += "It has [emitter ? emitter : "no micro laser"] installed."
/obj/item/weapon/gun/energy/floragun/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/weapon/stock_parts/micro_laser))
if(!emitter)
user.drop_item()
W.loc = src
emitter = W
to_chat(user, "<span class='notice'>You install a [emitter.name] in [src].</span>")
else
to_chat(user, "<span class='notice'>[src] already has a laser.</span>")
else if(W.is_screwdriver())
if(emitter)
to_chat(user, "<span class='notice'>You remove the [emitter.name] from the [src].</span>")
emitter.loc = get_turf(src.loc)
playsound(src, W.usesound, 50, 1)
emitter = null
return
else
to_chat(user, "<span class='notice'>There is no micro laser in this [src].</span>")
return
/obj/item/weapon/gun/energy/floragun/afterattack(obj/target, mob/user, adjacent_flag)
//allow shooting into adjacent hydrotrays regardless of intent
if(!emitter)
to_chat(user, "<span class='notice'>The [src] has no laser! </span>")
playsound(src, 'sound/weapons/empty.ogg', 50, 1)
return
if(adjacent_flag && istype(target,/obj/machinery/portable_atmospherics/hydroponics))
user.visible_message("<span class='danger'>\The [user] fires \the [src] into \the [target]!</span>")
Fire(target,user)
@@ -84,8 +123,16 @@
/obj/item/weapon/gun/energy/floragun/consume_next_projectile()
. = ..()
var/obj/item/projectile/energy/floramut/gene/G = .
var/obj/item/projectile/energy/florayield/GY = .
var/obj/item/projectile/energy/floramut/GM = .
// Inserting the upgrade level of the gun to the projectile as there isn't a better way to do this.
if(istype(G))
G.gene = gene
G.lasermod = emitter.rating
else if(istype(GY))
GY.lasermod = emitter.rating
else if(istype(GM))
GM.lasermod = emitter.rating
/obj/item/weapon/gun/energy/meteorgun
name = "meteor gun"