Adds powerup system, refactors ctf pickups and powerup mine subtypes into it (#56605)

This commit is contained in:
Fikou
2021-02-04 08:46:08 +01:00
committed by GitHub
parent 47a8ea5746
commit efbb133167
14 changed files with 218 additions and 140 deletions
-89
View File
@@ -130,95 +130,6 @@
name = "bwoink mine"
sound = 'sound/effects/adminhelp.ogg'
/obj/effect/mine/pickup
name = "pickup"
desc = "pick me up"
icon = 'icons/effects/effects.dmi'
icon_state = "electricity2"
density = FALSE
var/duration = 0
/obj/effect/mine/pickup/Initialize()
. = ..()
animate(src, pixel_y = 4, time = 20, loop = -1)
/obj/effect/mine/pickup/triggermine(mob/victim)
if(triggered)
return
triggered = 1
invisibility = INVISIBILITY_ABSTRACT
mineEffect(victim)
qdel(src)
/obj/effect/mine/pickup/bloodbath
name = "Red Orb"
desc = "You feel angry just looking at it."
duration = 1200 //2min
color = "#FF0000"
var/mob/living/doomslayer
var/obj/item/chainsaw/doomslayer/chainsaw
/obj/effect/mine/pickup/bloodbath/mineEffect(mob/living/carbon/victim)
if(!victim.client || !istype(victim))
return
to_chat(victim, "<span class='reallybig redtext'>RIP AND TEAR</span>")
INVOKE_ASYNC(src, .proc/blood_delusion, victim)
chainsaw = new(victim.loc)
victim.log_message("entered a blood frenzy", LOG_ATTACK)
ADD_TRAIT(chainsaw, TRAIT_NODROP, CHAINSAW_FRENZY_TRAIT)
victim.drop_all_held_items()
victim.put_in_hands(chainsaw, forced = TRUE)
chainsaw.attack_self(victim)
victim.reagents.add_reagent(/datum/reagent/medicine/adminordrazine,25)
to_chat(victim, "<span class='warning'>KILL, KILL, KILL! YOU HAVE NO ALLIES ANYMORE, KILL THEM ALL!</span>")
var/datum/client_colour/colour = victim.add_client_colour(/datum/client_colour/bloodlust)
QDEL_IN(colour, 11)
doomslayer = victim
RegisterSignal(src, COMSIG_PARENT_QDELETING, .proc/end_blood_frenzy)
QDEL_IN(WEAKREF(src), duration)
/obj/effect/mine/pickup/bloodbath/proc/end_blood_frenzy()
if(doomslayer)
to_chat(doomslayer, "<span class='notice'>Your bloodlust seeps back into the bog of your subconscious and you regain self control.</span>")
doomslayer.log_message("exited a blood frenzy", LOG_ATTACK)
if(chainsaw)
qdel(chainsaw)
/obj/effect/mine/pickup/bloodbath/proc/blood_delusion(mob/living/carbon/victim)
new /datum/hallucination/delusion(victim, TRUE, "demon", duration, 0)
/obj/effect/mine/pickup/healing
name = "Blue Orb"
desc = "You feel better just looking at it."
color = "#0000FF"
/obj/effect/mine/pickup/healing/mineEffect(mob/living/carbon/victim)
if(!victim.client || !istype(victim))
return
to_chat(victim, "<span class='notice'>You feel great!</span>")
victim.revive(full_heal = TRUE, admin_revive = TRUE)
/obj/effect/mine/pickup/speed
name = "Yellow Orb"
desc = "You feel faster just looking at it."
color = "#FFFF00"
duration = 300
/obj/effect/mine/pickup/speed/mineEffect(mob/living/carbon/victim)
if(!victim.client || !istype(victim))
return
to_chat(victim, "<span class='notice'>You feel fast!</span>")
victim.add_movespeed_modifier(/datum/movespeed_modifier/yellow_orb)
sleep(duration)
victim.remove_movespeed_modifier(/datum/movespeed_modifier/yellow_orb)
to_chat(victim, "<span class='notice'>You slow down.</span>")
/// These mines spawn pellet_clouds around them when triggered
/obj/effect/mine/shrapnel
name = "shrapnel mine"
+126
View File
@@ -0,0 +1,126 @@
/obj/effect/powerup
name = "power-up"
icon = 'icons/effects/effects.dmi'
density = FALSE
anchored = TRUE
resistance_flags = INDESTRUCTIBLE
/// How long in deciseconds it will take for the powerup to respawn, if no value it won't respawn
var/respawn_time
/// How long the powerup stays on the ground, if no value it will stay forever
var/lifetime
/// Message given when powerup is picked up
var/pickup_message
/// Sound played when powerup is picked up
var/pickup_sound
/// Cooldown for the powerup to respawn after it's been used
COOLDOWN_DECLARE(respawn_cooldown)
/obj/effect/powerup/Initialize()
..()
if(lifetime)
QDEL_IN(src, lifetime)
/obj/effect/powerup/Crossed(atom/movable/movable_atom)
. = ..()
trigger(movable_atom)
/obj/effect/powerup/Bump(atom/bumped_atom)
trigger(bumped_atom)
/obj/effect/powerup/Bumped(atom/movable/movable_atom)
trigger(movable_atom)
/// Triggers the effect of the powerup on the target, returns FALSE if the target is not /mob/living, is dead or the cooldown hasn't finished, returns TRUE otherwise
/obj/effect/powerup/proc/trigger(mob/living/target)
if(!istype(target) || target.stat == DEAD)
return FALSE
if(respawn_time)
if(!COOLDOWN_FINISHED(src, respawn_cooldown))
return FALSE
COOLDOWN_START(src, respawn_cooldown, respawn_time)
alpha = 100
addtimer(VARSET_CALLBACK(src, alpha, initial(alpha)), respawn_time)
else
qdel(src)
if(pickup_message)
to_chat(target, "<span class='notice'>[pickup_message]</span>")
if(pickup_sound)
playsound(get_turf(target), pickup_sound, 50, TRUE, -1)
return TRUE
/obj/effect/powerup/health
name = "health pickup"
desc = "Blessing from the havens."
icon = 'icons/obj/storage.dmi'
icon_state = "medicalpack"
respawn_time = 30 SECONDS
pickup_message = "Health restored!"
pickup_sound = 'sound/magic/staff_healing.ogg'
/// How much the pickup heals when picked up
var/heal_amount = 50
/// Does this pickup fully heal when picked up
var/full_heal = FALSE
/// If full heal, does this do an admin level heal?
var/admin_heal = FALSE
/obj/effect/powerup/health/trigger(mob/living/target)
. = ..()
if(!.)
return
if(full_heal)
target.fully_heal(admin_heal)
else if(heal_amount)
target.heal_ordered_damage(heal_amount, list(BRUTE, BURN))
/obj/effect/powerup/health/full
name = "mega health pickup"
desc = "Now this is what I'm talking about."
icon_state = "duffel-med"
full_heal = TRUE
/obj/effect/powerup/ammo
name = "ammo pickup"
desc = "You like revenge, right? Everybody likes revenge! Well, let's go get some!"
icon = 'icons/obj/storage.dmi'
icon_state = "ammobox"
respawn_time = 30 SECONDS
pickup_message = "Ammunition reloaded!"
pickup_sound = 'sound/weapons/gun/shotgun/rack.ogg'
/obj/effect/powerup/ammo/trigger(mob/living/target)
. = ..()
if(!.)
return
for(var/obj/item/gun in target.GetAllContents())
if(!isgun(gun) && !istype(gun, /obj/item/flamethrower))
continue
SEND_SIGNAL(gun, COMSIG_ITEM_RECHARGED)
/obj/effect/powerup/ammo/ctf
icon = 'icons/effects/effects.dmi'
icon_state = "at_shield1"
respawn_time = FALSE
lifetime = 30 SECONDS
/obj/effect/powerup/speed
name = "Lightning Orb"
desc = "You feel faster just looking at it."
icon_state = "electricity2"
pickup_sound = 'sound/magic/lightningshock.ogg'
/obj/effect/powerup/speed/trigger(mob/living/target)
. = ..()
if(!.)
return
target.apply_status_effect(STATUS_EFFECT_LIGHTNINGORB)
/obj/effect/powerup/mayhem
name = "Orb of Mayhem"
desc = "You feel angry just looking at it."
icon_state = "impact_laser"
/obj/effect/powerup/mayhem/trigger(mob/living/target)
. = ..()
if(!.)
return
target.apply_status_effect(STATUS_EFFECT_MAYHEM)
+9
View File
@@ -236,6 +236,7 @@
if(create_with_tank)
ptank = new /obj/item/tank/internals/plasma/full(src)
update_icon()
RegisterSignal(src, COMSIG_ITEM_RECHARGED, .proc/instant_refill)
/obj/item/flamethrower/full
create_full = TRUE
@@ -259,3 +260,11 @@
/obj/item/assembly/igniter/proc/ignite_turf(obj/item/flamethrower/F,turf/open/location,release_amount = 0.05)
F.default_ignite(location,release_amount)
/obj/item/flamethrower/proc/instant_refill()
if(ptank)
ptank.air_contents.assert_gas(/datum/gas/plasma)
ptank.air_contents.gases[/datum/gas/plasma][MOLES] = (10*ONE_ATMOSPHERE)*ptank.volume/(R_IDEAL_GAS_EQUATION*T20C)
else
ptank = new /obj/item/tank/internals/plasma/full(src)
update_icon()