/
spawnergrenade.dm
65 lines (48 loc) · 1.89 KB
/
spawnergrenade.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/obj/item/grenade/spawnergrenade
desc = "It is set to detonate in 5 seconds. It will unleash unleash an unspecified anomaly into the vicinity."
name = "delivery grenade"
icon = 'icons/obj/weapons/grenade.dmi'
icon_state = "delivery"
item_state = "flashbang"
origin_tech = list(TECH_MATERIAL = 3, TECH_MAGNET = 4)
/// The obj/mob path to be created when the grenade explodes.
var/spawn_type
/// The number of spawn_type to be created when the grenade explodes.
var/spawn_amount = 1
/// If set, the maximum distance to toss spawned atoms when the grenade explodes.
var/spawn_throw_range
/obj/item/grenade/spawnergrenade/detonate(mob/living/user)
var/turf/origin = get_turf(src)
if (origin)
playsound(origin, 'sound/effects/phasein.ogg', 100, 1)
for (var/mob/living/living in viewers(origin))
if (living.eyecheck() < FLASH_PROTECTION_MODERATE)
living.flash_eyes()
var/list/spawned = list()
var/atom/movable/movable
var/turf/target
for (var/i = spawn_amount to 1 step -1)
movable = new spawn_type (origin)
spawned += movable
if (spawn_throw_range)
target = CircularRandomTurfAround(origin, Frand(1, spawn_throw_range))
movable.throw_at(target, spawn_throw_range, 3)
AfterSpawn(user, spawned)
qdel(src)
/obj/item/grenade/spawnergrenade/proc/AfterSpawn(mob/living/user, list/spawned)
return
/obj/item/grenade/spawnergrenade/viscerator
name = "viscerator grenade"
spawn_type = /mob/living/simple_animal/hostile/viscerator
spawn_amount = 5
spawn_throw_range = 3
/obj/item/grenade/spawnergrenade/viscerator/AfterSpawn(mob/living/user, list/spawned)
if (!istype(user))
return
for (var/mob/living/simple_animal/hostile/viscerator/viscerator as anything in spawned)
viscerator.faction = user.faction
/obj/item/grenade/spawnergrenade/spesscarp
name = "carp delivery grenade"
spawn_type = /mob/living/simple_animal/hostile/carp
spawn_amount = 4
spawn_throw_range = 3