mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Merge pull request #7561 from Mechoid/ProjectileUpkeep
Projectile Upkeep
This commit is contained in:
@@ -5,12 +5,14 @@
|
||||
/obj/item/weapon/gun/energy/hooklauncher
|
||||
name = "gravity whip"
|
||||
desc = "A large, strange gauntlet."
|
||||
icon = 'icons/obj/gun2.dmi'
|
||||
icon_state = "gravwhip"
|
||||
item_state = "gravwhip"
|
||||
fire_sound_text = "laser blast"
|
||||
|
||||
fire_delay = 15
|
||||
charge_cost = 300
|
||||
charge_meter = FALSE
|
||||
|
||||
cell_type = /obj/item/weapon/cell/device/weapon
|
||||
projectile_type = /obj/item/projectile/energy/hook
|
||||
@@ -29,7 +31,6 @@
|
||||
cell_type = /obj/item/weapon/cell/device/weapon/recharge/alien
|
||||
battery_lock = TRUE
|
||||
charge_cost = 400
|
||||
charge_meter = FALSE
|
||||
|
||||
projectile_type = /obj/item/projectile/energy/hook/ring
|
||||
|
||||
|
||||
60
code/modules/projectiles/guns/magic.dm
Normal file
60
code/modules/projectiles/guns/magic.dm
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* "Magic" "Guns"
|
||||
*/
|
||||
|
||||
/obj/item/weapon/gun/magic
|
||||
name = "staff of nothing"
|
||||
desc = "This staff is boring to watch because even though it came first you've seen everything it can do in other staves for years."
|
||||
icon = 'icons/obj/wizard.dmi'
|
||||
icon_state = "staffofnothing"
|
||||
item_icons = list(
|
||||
slot_l_hand_str = 'icons/mob/items/lefthand_magic.dmi',
|
||||
slot_r_hand_str = 'icons/mob/items/righthand_magic.dmi',
|
||||
)
|
||||
fire_sound = 'sound/weapons/emitter.ogg'
|
||||
w_class = ITEMSIZE_HUGE
|
||||
projectile_type = null
|
||||
var/checks_antimagic = TRUE
|
||||
var/max_charges = 6
|
||||
var/charges = 0
|
||||
var/recharge_rate = 4
|
||||
var/charge_tick = 0
|
||||
var/can_charge = TRUE
|
||||
|
||||
/obj/item/weapon/gun/magic/consume_next_projectile()
|
||||
if(checks_antimagic && locate(/obj/item/weapon/nullrod) in usr) return null
|
||||
if(!ispath(projectile_type)) return null
|
||||
if(charges <= 0) return null
|
||||
|
||||
charges -= 1
|
||||
|
||||
return new projectile_type(src)
|
||||
|
||||
/obj/item/weapon/gun/magic/Initialize()
|
||||
. = ..()
|
||||
charges = max_charges
|
||||
if(can_charge)
|
||||
START_PROCESSING(SSobj, src)
|
||||
|
||||
/obj/item/weapon/gun/magic/Destroy()
|
||||
if(can_charge)
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
return ..()
|
||||
|
||||
/obj/item/weapon/gun/magic/process()
|
||||
if (charges >= max_charges)
|
||||
charge_tick = 0
|
||||
return
|
||||
charge_tick++
|
||||
if(charge_tick < recharge_rate)
|
||||
return 0
|
||||
charge_tick = 0
|
||||
charges++
|
||||
return 1
|
||||
|
||||
/obj/item/weapon/gun/magic/handle_click_empty(mob/user)
|
||||
if (user)
|
||||
user.visible_message("*wzhzhzh*", "<span class='danger'>The [name] whizzles quietly.</span>")
|
||||
else
|
||||
src.visible_message("*wzhzh*")
|
||||
playsound(src, 'sound/weapons/empty.ogg', 100, 1)
|
||||
17
code/modules/projectiles/guns/magic/fireball.dm
Normal file
17
code/modules/projectiles/guns/magic/fireball.dm
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
/obj/item/weapon/gun/magic/firestaff
|
||||
name = "flaming staff"
|
||||
desc = "A long, everburning torch."
|
||||
icon = 'icons/obj/wizard.dmi'
|
||||
icon_state = "staffoffire"
|
||||
item_state = "staff"
|
||||
fire_sound = 'sound/weapons/emitter.ogg'
|
||||
w_class = ITEMSIZE_HUGE
|
||||
checks_antimagic = TRUE
|
||||
max_charges = 6
|
||||
charges = 0
|
||||
recharge_rate = 4
|
||||
charge_tick = 0
|
||||
can_charge = TRUE
|
||||
|
||||
projectile_type = /obj/item/projectile/energy/fireball
|
||||
@@ -739,6 +739,8 @@
|
||||
|
||||
shot_from = launcher.name
|
||||
silenced = launcher.silenced
|
||||
if(user)
|
||||
firer = user
|
||||
|
||||
return launch_projectile(target, target_zone, user, params, angle_override, forced_spread)
|
||||
|
||||
|
||||
@@ -27,13 +27,15 @@
|
||||
var/list/help_messages = list("slaps", "pokes", "nudges", "bumps", "pinches")
|
||||
var/done_mob_unique = FALSE // Has the projectile already done something to a mob?
|
||||
|
||||
var/datum/beam/chain = null
|
||||
|
||||
/obj/item/projectile/energy/hook/launch_projectile(atom/target, target_zone, mob/user, params, angle_override, forced_spread = 0)
|
||||
var/expected_distance = get_dist(target, loc)
|
||||
range = expected_distance // So the hook hits the ground if no mob is hit.
|
||||
target_distance = expected_distance
|
||||
if(firer) // Needed to ensure later checks in impact and on hit function.
|
||||
launcher_intent = firer.a_intent
|
||||
firer.Beam(src,icon_state=beam_state,icon='icons/effects/beam.dmi',time=60, maxdistance=10,beam_type=/obj/effect/ebeam,beam_sleep_time=1)
|
||||
chain = firer.Beam(src,icon_state=beam_state,icon='icons/effects/beam.dmi',time=60, maxdistance=10,beam_type=/obj/effect/ebeam,beam_sleep_time=1)
|
||||
|
||||
if(launcher_intent)
|
||||
switch(launcher_intent)
|
||||
@@ -58,10 +60,22 @@
|
||||
|
||||
..() // Does the regular launching stuff.
|
||||
|
||||
/obj/item/projectile/energy/hook/after_move()
|
||||
if(chain)
|
||||
var/origin_turf = get_turf(firer)
|
||||
var/target_turf = get_turf(src)
|
||||
if(!chain.static_beam && (origin_turf != chain.origin_oldloc || target_turf != chain.target_oldloc))
|
||||
chain.origin_oldloc = origin_turf //so we don't keep checking against their initial positions, leading to endless Reset()+Draw() calls
|
||||
chain.target_oldloc = target_turf
|
||||
chain.Reset()
|
||||
chain.Draw()
|
||||
return
|
||||
|
||||
/obj/item/projectile/energy/hook/on_hit(var/atom/target, var/blocked = 0, var/def_zone = null)
|
||||
if(..())
|
||||
perform_intent_unique(target)
|
||||
|
||||
|
||||
/obj/item/projectile/energy/hook/on_impact(var/atom/A)
|
||||
perform_intent_unique(get_turf(A))
|
||||
|
||||
|
||||
20
code/modules/projectiles/projectile/magic.dm
Normal file
20
code/modules/projectiles/projectile/magic.dm
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
/obj/item/projectile/energy/fireball
|
||||
name = "fireball"
|
||||
icon_state = "fireball2"
|
||||
damage = 15
|
||||
damage_type = BURN
|
||||
check_armour = "bomb"
|
||||
armor_penetration = 25 // It's a great ball of fire.
|
||||
|
||||
combustion = TRUE
|
||||
|
||||
/obj/item/projectile/energy/fireball/on_hit(var/atom/target, var/blocked = 0)
|
||||
new /obj/effect/explosion(get_turf(target))
|
||||
explosion(target, -1, 0, 2)
|
||||
..()
|
||||
|
||||
/obj/item/projectile/energy/fireball/on_impact(var/atom/target)
|
||||
new /obj/effect/explosion(get_turf(target))
|
||||
explosion(target, -1, 0, 2)
|
||||
..()
|
||||
Reference in New Issue
Block a user