Files
Paradise/code/modules/projectiles/guns/magic.dm
T
warriorstar-orion 525c68d617 Attack chain, initial setup. (pull *immediately* for *any* TM issues) (#26834)
* refactor: Attack chain, initial setup.

* migrate curtain to make dreamchecker happy

* update thurible

* don't call attacked_by separately for legacy attack chain

* remove duplicate proc

* condense similar code, put allowances for legacy code in new procs

* update docs, include diagram source

* add comment on how to update diagram

* fix admonition

* mindflayer updates

* remove commented out code

* clarify all steps

* after_attack should be overridable

* whoops

* retrofit recent changes

* duh, can't restrict this yet because of tool_acts

* i hate ore bags with the fire of a thousand suns

* return correct value for object attack logic

* Various cleanups.

We don't want to attempt to pull stuff out of `/obj/item/attackby`,
because those pieces are part of the related objects' migrations, not
`/obj/item` itself. Attempting to do this causes knockon effects where
things expected to call e.g. `/obj/item/storage/attackby` in the call
chain were not ferried over to the new item interaction code, because
the related objects hadn't actually been migrated over yet.

I've used refactoring /obj/vehicle as the example for migrating
`attackby` methods instead.

* simplify some argument names

* fuck it

* make it do the thing

* Rename CI module call

* Prove that CI works

* improve test output

* aaand fix it again

* fix curtain tool interactions

* fix compile error

* fix compile error

* Better docs, introduce migration plan tool.
2024-12-02 23:36:36 +00:00

92 lines
2.7 KiB
Plaintext

/obj/item/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/guns/magic.dmi'
icon_state = "staffofnothing"
item_state = "staff"
fire_sound = 'sound/weapons/emitter.ogg'
fire_sound_text = "energy blast"
flags = CONDUCT
w_class = WEIGHT_CLASS_HUGE
var/max_charges = 6
var/charges = 0
var/recharge_rate = 4
var/charge_tick = 0
var/can_charge = TRUE
var/ammo_type
var/no_den_usage
origin_tech = null
clumsy_check = FALSE
trigger_guard = TRIGGER_GUARD_ALLOW_ALL // Has no trigger at all, uses magic instead
can_holster = FALSE // Nothing here is a gun, and therefore shouldn't really fit into a holster
lefthand_file = 'icons/mob/inhands/items_lefthand.dmi' //not really a gun and some toys use these inhands
righthand_file = 'icons/mob/inhands/items_righthand.dmi'
/obj/item/gun/magic/afterattack__legacy__attackchain(atom/target, mob/living/user, flag)
if(no_den_usage)
var/area/A = get_area(user)
if(istype(A, /area/wizard_station))
to_chat(user, "<span class='warning'>You know better than to violate the security of The Den, best wait until you leave to use [src].</span>")
return
else
no_den_usage = 0
..()
/obj/item/gun/magic/can_shoot()
return charges
/obj/item/gun/magic/newshot(params)
if(charges && chambered && !chambered.BB)
chambered.newshot(params)
return
/obj/item/gun/magic/process_fire(atom/target as mob|obj|turf, mob/living/user as mob|obj, message = 1, params, zone_override, bonus_spread = 0)
newshot()
return ..()
/obj/item/gun/magic/process_chamber()
if(chambered && !chambered.BB) //if BB is null, i.e the shot has been fired...
charges--//... drain a charge
return
/obj/item/gun/magic/Initialize(mapload)
. = ..()
charges = max_charges
chambered = new ammo_type(src)
if(can_charge)
START_PROCESSING(SSobj, src)
/obj/item/gun/magic/Destroy()
if(can_charge)
STOP_PROCESSING(SSobj, src)
return ..()
/obj/item/gun/magic/process()
// Don't start recharging until we lose a charge
if(charges >= max_charges)
charge_tick = 0
return FALSE
charge_tick++
if(charge_tick >= recharge_rate)
charge_tick = 0
charges++
return TRUE
else
return FALSE
/obj/item/gun/magic/update_icon_state()
return
/obj/item/gun/magic/shoot_with_empty_chamber(mob/living/user as mob|obj)
to_chat(user, "<span class='warning'>[src] whizzles quietly.</span>")
return
/obj/item/gun/magic/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is twisting [src] above [user.p_their()] head, releasing a magical blast! It looks like [user.p_theyre()] trying to commit suicide!</span>")
playsound(loc, fire_sound, 50, TRUE, -1)
return FIRELOSS