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

Tesla Cannon #244

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1339,6 +1339,7 @@
#include "code\modules\projectiles\guns\energy\special.dm"
#include "code\modules\projectiles\guns\energy\stun.dm"
#include "code\modules\projectiles\guns\energy\temperature.dm"
#include "code\modules\projectiles\guns\energy\tesla.dm"
#include "code\modules\projectiles\guns\magic\staff.dm"
#include "code\modules\projectiles\guns\projectile\automatic.dm"
#include "code\modules\projectiles\guns\projectile\bow.dm"
Expand Down
7 changes: 6 additions & 1 deletion baystation12.int
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// BEGIN_INTERNALS
/*
MAP_ICON_TYPE: 0
LAST_COMPILE_TIME: 1461346265
DIR: code code\defines code\defines\obj code\game code\game\machinery code\game\mecha code\game\mecha\equipment code\game\mecha\equipment\tools code\game\mecha\equipment\weapons code\game\objects code\game\objects\items code\game\objects\items\devices code\game\objects\items\weapons code\modules code\modules\mob code\modules\mob\living code\modules\mob\living\carbon code\modules\mob\living\carbon\human code\modules\paperwork code\modules\power code\modules\power\antimatter code\modules\projectiles code\modules\projectiles\guns code\modules\projectiles\guns\energy code\modules\research code\modules\research\designs tauceti tauceti\items tauceti\items\musical_instruments tauceti\items\weapons tauceti\items\weapons\guns
AUTO_FILE_DIR: OFF
MAP_ICON_TYPE: 0
LAST_COMPILE_VERSION: 510.1338
WINDOW: code\modules\research\designs.dm;code\game\mecha\equipment\tools\tools.dm;code\game\mecha\equipment\weapons\weapons.dm;code\game\mecha\equipment\mecha_equipment.dm;code\game\mecha\mecha.dm;code\modules\research\designs\mechfabricator_designs.dm;code\modules\mob\living\carbon\human\human.dm;code\modules\paperwork\clipboard.dm;code\modules\projectiles\guns\energy\tesla.dm
FILE: code\modules\projectiles\guns\energy\tesla.dm
*/
// END_INTERNALS
5 changes: 5 additions & 0 deletions code/game/machinery/recharger.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ obj/machinery/recharger/attackby(obj/item/weapon/G as obj, mob/user as mob)
if (istype(G, /obj/item/weapon/gun/energy/gun/nuclear) || istype(G, /obj/item/weapon/gun/energy/crossbow))
user << "<span class='notice'>Your gun's recharge port was removed to make room for a miniaturized reactor.</span>"
return

if (istype(G, /obj/item/weapon/gun/energy/tesla))
user << "<span class='notice'>This gun has no recharge port.</span>"
return

if (istype(G, /obj/item/weapon/gun/magic))
return
user.drop_item()
Expand Down
2 changes: 1 addition & 1 deletion code/game/mecha/equipment/weapons/weapons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -317,4 +317,4 @@
/obj/item/mecha_parts/mecha_equipment/weapon/ballistic/missile_rack/banana_mortar/mousetrap_mortar/Fire(atom/movable/AM, atom/target, turf/aimloc)
var/obj/item/device/assembly/mousetrap/M = AM
M.secured = 1
..()
..()
102 changes: 102 additions & 0 deletions code/modules/projectiles/guns/energy/tesla.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/obj/item/weapon/gun/energy/tesla
name = "Tesla Cannon"
desc = "Cannon which uses electrical charge to damage multiple targets. Spin the generator handle to charge it up"
icon = 'icons/obj/gun.dmi'
icon_state = "tesla"
w_class = 4.0
origin_tech = "combat = 5;materials = 5;powerstorage = 5;magnets = 5;engineering = 5"
var/charge = 0
var/charging = 0
var/cooldown = 0

/obj/item/weapon/gun/energy/tesla/proc/charge(mob/living/user as mob)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as mob, as mob|obj|turf и вообще as что-то там - это все лишнее и не нужно.

spawn(1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем спавн?

if(do_after(user, 40))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не хватает третьего аргумента - цели. if(do_after(user, 40, target = src)) в данном случае.

if(charging==1 && charge < 3)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

операторы лучше разделять пробелами, а то они у тебя то с ними, то без

switch(charge)
if(0) icon_state="tesla_1"
if(1) icon_state="tesla_2"
if(2) icon_state="tesla_3"
++charge
playsound(loc, "sparks", 75, 1, -1)
if(charging && charge < 3)
charge(user)
else
charging=0
else
charging=0
else
user << "\red \italic Generator is too difficult to spin while moving! Charging aborted"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user << "Generator is too difficult to spin while moving! Charging aborted."
и так везде. все спаны тут https://github.com/TauCetiStation/TauCetiClassic/blob/master/code/stylesheet.dm

charging=0



/obj/item/weapon/gun/energy/tesla/attack_self(mob/living/user as mob)
if(charging==1)
charging=0
user << "\blue You stop charging Tesla Cannon..."
cooldown = 1
spawn(50) cooldown = 0
return
if(cooldown) return
if(charge == 3) return
user.visible_message("\red \italic [user] starts spinning generator on Tesla Cannon!")
user << "\blue You start charging Tesla Cannon..."
charging=1
charge(user)


/obj/item/weapon/gun/energy/tesla/Fire(atom/pbtarget as mob|obj|turf, mob/living/user as mob|obj, message = 1, params, zone_override)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Коли оверрайдишь - т.е перезаписываешь прок не вызывая при этом родителя - смотри что делает основной прок у пушек - у тебя потеряны проверки на халков, лингов, абдукторов, клоуна и еще по мелочи.

if(!charge)
user << "\red Tesla Cannon is not charged!"
return

if(!istype(pbtarget,/mob/living))
user << "\red Tesla Cannon needs to be aimed directly at living target"
return

if(charging)
user << "\red You can't shoot while charging!"
return

icon_state = "tesla100"
spawn(1) user.Beam(pbtarget,icon_state="lightning",icon='icons/effects/effects.dmi',time=5)
Bolt(user,pbtarget,user,charge)
charge=0
if(user)
if(user.hand)
user.update_inv_l_hand()
else
user.update_inv_r_hand()
feedback_add_details("gun_fired","[src.type]")

/obj/item/weapon/gun/energy/tesla/proc/los_check(mob/A,mob/B)
for(var/atom/turf in getline(A,B))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turf суть часть atom'а, но atom это не только turf. Короче, лучше var/atom/A, потому что твой вариант вводит в заблуждение.

if(turf.density && !istype(turf,/obj/structure/table))
return 0
return 1

/obj/item/weapon/gun/energy/tesla/proc/Bolt(mob/origin,mob/target,mob/user = usr,jumps)
spawn(1) origin.Beam(target,icon_state="lightning[rand(1,12)]",icon='icons/effects/effects.dmi',time=5)
var/mob/living/carbon/current = target
current.electrocute_act(15*(jumps+1),"electric bolt",1.0,null,1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вообще, если посмотреть в прок electrocute_act() то второй аргумент по атому идет, хорошо что он лишь для текста используется и поэтому никаких нет к счастью рантаймов - это я про "electric bolt" что как бы стринг, а не атом. И тоже самое и ниже.

playsound(get_turf(current), 'sound/machines/defib_zap.ogg', 50, 1, -1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вместо get_turf() можно просто current.

var/list/possible_targets = new
for(var/mob/living/M in range(2,target))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А почему range() а не view()?

if(user == M || !los_check(current,M) || origin == M || current == M)
continue
possible_targets += M
if(!possible_targets.len)
return
var/mob/living/next = pick(possible_targets)
if(next && jumps > 0)
Bolt(current,next,user,--jumps)
--jumps

/obj/item/weapon/gun/energy/tesla/emp_act(severity)
if(src && src.charge)
if(istype(loc, /mob/living/carbon))
var/mob/living/carbon/M = loc
M.electrocute_act(5*(4-severity)*charge,"Tesla Cannon")
charge=0
icon_state = "tesla100"
45 changes: 27 additions & 18 deletions code/modules/research/designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ datum/design/vindicator_targ
build_type = IMPRINTER
materials = list(MAT_GLASS = 2000, "sacid" = 20)
build_path = /obj/item/weapon/circuitboard/mecha/vindicator/targeting

datum/design/ultra_main
name = "Circuit Design (\"Gygax Ultra\" Central Control module)"
desc = "Allows for the construction of a \"Gygax Ultra\" Central Control module."
Expand Down Expand Up @@ -1108,9 +1108,9 @@ datum/design/hyper_cell
req_tech = list("powerstorage" = 6, "materials" = 5)
reliability = 70
build_type = PROTOLATHE | MECHFAB
materials = list(MAT_METAL = 800, MAT_GLASS = 160, MAT_SILVER = 300, MAT_GOLD = 300, MAT_DIAMOND = 160)
materials = list(MAT_METAL = 800, MAT_GLASS = 160, MAT_SILVER = 300, MAT_GOLD = 300, MAT_DIAMOND = 160)
// construction_time=100
build_path = /obj/item/weapon/stock_parts/cell/bluespace
build_path = /obj/item/weapon/stock_parts/cell/bluespace
// category = list("Misc","Power Designs")
category = list("Misc")

Expand All @@ -1137,7 +1137,7 @@ datum/design/smes
materials = list(MAT_GLASS = 2000, "sacid" = 20)
build_path = /obj/item/weapon/circuitboard/smes

/datum/design/space_heater
/datum/design/space_heater
name = "Machine Design (Space Heater Board)"
desc = "The circuit board for a space heater."
id = "space_heater"
Expand Down Expand Up @@ -1371,8 +1371,8 @@ datum/design/autolathe
build_type = IMPRINTER
materials = list(MAT_GLASS = 1000, "sacid" = 20)
build_path = /obj/item/weapon/circuitboard/vendor
// category = list("Misc. Machinery")

// category = list("Misc. Machinery")
/datum/design/ore_redemption
name = "Machine Design (Ore Redemption Board)"
desc = "The circuit board for an Ore Redemption machine."
Expand Down Expand Up @@ -1447,8 +1447,8 @@ datum/design/cyborgrecharger
build_type = IMPRINTER
materials = list(MAT_GLASS = 1000, "sacid" = 20)
build_path = /obj/item/weapon/circuitboard/grounding_rod
//category = list("Misc. Machinery")

//category = list("Misc. Machinery")
/////////////////////////////////////////
////////////Power Stuff//////////////////
/////////////////////////////////////////
Expand Down Expand Up @@ -1534,8 +1534,8 @@ datum/design/mmi
id = "mmi"
req_tech = list("programming" = 2, "biotech" = 3)
build_type = PROTOLATHE | MECHFAB
materials = list(MAT_METAL = 1000, MAT_GLASS = 500)
reliability = 76
materials = list(MAT_METAL = 1000, MAT_GLASS = 500)
reliability = 76
build_path = /obj/item/device/mmi
category = list("Misc")

Expand All @@ -1545,8 +1545,8 @@ datum/design/mmi_radio
id = "mmi_radio"
req_tech = list("programming" = 2, "biotech" = 4)
build_type = PROTOLATHE | MECHFAB
materials = list(MAT_METAL = 1200, MAT_GLASS = 500)
reliability = 74
materials = list(MAT_METAL = 1200, MAT_GLASS = 500)
reliability = 74
build_path = /obj/item/device/mmi/radio_enabled
category = list("Misc")

Expand All @@ -1556,8 +1556,8 @@ datum/design/synthetic_flash
id = "sflash"
req_tech = list("magnets" = 3, "combat" = 2)
build_type = MECHFAB
materials = list(MAT_METAL = 750, MAT_GLASS = 750)
reliability = 76
materials = list(MAT_METAL = 750, MAT_GLASS = 750)
reliability = 76
build_path = /obj/item/device/flash/synthetic
category = list("Misc")

Expand Down Expand Up @@ -1662,8 +1662,8 @@ datum/design/scalpel_manager
id = "scalpel_manager"
req_tech = list("biotech" = 4, "materials" = 7, "magnets" = 5, "programming" = 4)
build_type = PROTOLATHE
materials = list(MAT_METAL = 12500, MAT_GLASS = 7500, MAT_SILVER = 1500, MAT_GOLD = 1500, MAT_DIAMOND = 750)
build_path = /obj/item/weapon/scalpel/manager
materials = list(MAT_METAL = 12500, MAT_GLASS = 7500, MAT_SILVER = 1500, MAT_GOLD = 1500, MAT_DIAMOND = 750)
build_path = /obj/item/weapon/scalpel/manager

/////////////////////////////////////////
/////////////////Weapons/////////////////
Expand Down Expand Up @@ -1743,6 +1743,15 @@ datum/design/temp_gun
materials = list(MAT_METAL = 5000, MAT_GLASS = 500, MAT_SILVER = 3000)
build_path = /obj/item/weapon/gun/energy/temperature

datum/design/tesla_gun
name = "Tesla Cannon"
desc = "A gun which uses electrical discharges to hit multiple targets"
id = "tesla_gun"
req_tech = list("combat" = 4, "materials" = 4, "powerstorage" = 5, "magnets" = 4, "engineering" = 4)
build_type = PROTOLATHE
materials = list(MAT_METAL = 10000, MAT_GOLD = 1000, MAT_SILVER = 4000)
build_path = /obj/item/weapon/gun/energy/tesla

datum/design/flora_gun
name = "Floral Somatoray"
desc = "A tool that discharges controlled radiation which induces mutation in plant cells. Harmless to other organic life."
Expand Down Expand Up @@ -1867,8 +1876,8 @@ datum/design/beacon
id = "beacon"
req_tech = list("bluespace" = 1)
build_type = PROTOLATHE
materials = list(MAT_METAL = 20, MAT_GLASS = 10)
build_path = /obj/item/device/radio/beacon
materials = list(MAT_METAL = 20, MAT_GLASS = 10)
build_path = /obj/item/device/radio/beacon

datum/design/bag_holding
name = "Bag of Holding"
Expand Down
Binary file modified icons/obj/gun.dmi
Binary file not shown.