Files
Paradise/code/modules/projectiles/guns/magic.dm
Tigercat2000 d20298e996 -tg- atom pooling system, qdel changes
This commit first and foremost ports the -tg- atom pooling system, and
removes the old experimental system entirely.

Secondly, this PR modifies the qdel system to use a -tg- lookalike
"destroy hint" system, which means that individual objects can tell qdel
what to do with them beyond taking care of things they need to delete.
This ties into the atom pooling system via a new hint define,
QDEL_HINT_PUTINPOOL, which will place the atom in the pool instead of
deleting it as per standard.

Emitter beams are now fully pooled.

Qdel now has semi-compatibility with all datum types, however it is not
the same as -tg-'s "Queue everything!" system. It simply passes it through
the GC immediately and adds it to the "hard del" lists. This means that
reagents can be qdel'ed, but there is no purpose as of yet, as it is more
or less the same as just deleting them, with the added effect of adding
logs of them being deleted to the garbage collector.
2015-06-21 15:47:57 -07:00

64 lines
1.7 KiB
Plaintext

/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/gun.dmi'
icon_state = "staffofnothing"
item_state = "staff"
fire_sound = 'sound/weapons/emitter.ogg'
flags = CONDUCT
w_class = 5
var/projectile_type = "/obj/item/projectile/magic"
var/max_charges = 6
var/charges = 0
var/recharge_rate = 4
var/charge_tick = 0
var/can_charge = 1
var/no_den_usage
origin_tech = null
clumsy_check = 0
/obj/item/weapon/gun/magic/emp_act(severity)
return
/obj/item/weapon/gun/magic/process_chambered()
if(in_chamber) return 1
if(!charges) return 0
if(!projectile_type) return 0
in_chamber = new projectile_type(src)
return 1
/obj/item/weapon/gun/magic/afterattack(atom/target as mob, mob/living/user as mob, flag)
if(no_den_usage)
var/area/A = get_area(user)
if(istype(A, /area/wizard_station))
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
..()
if(charges && !in_chamber && !flag) charges--
/obj/item/weapon/gun/magic/New()
..()
charges = max_charges
if(can_charge) processing_objects.Add(src)
/obj/item/weapon/gun/magic/Destroy()
if(can_charge) processing_objects.Remove(src)
return ..()
/obj/item/weapon/gun/magic/process()
charge_tick++
if(charge_tick < recharge_rate || charges >= max_charges) return 0
charge_tick = 0
charges++
return 1
/obj/item/weapon/gun/magic/update_icon()
return
/obj/item/weapon/gun/magic/shoot_with_empty_chamber(mob/living/user as mob|obj)
user << "<span class='warning'>The [name] whizzles quietly.<span>"
return