- Adds action buttons for aliens

This commit is contained in:
AnturK
2015-04-11 17:06:44 +02:00
parent e2c869bc77
commit f0bc1cc70c
7 changed files with 77 additions and 7 deletions
@@ -154,6 +154,16 @@
/mob/living/carbon/alien/proc/AddAbility(var/obj/effect/proc_holder/alien/A)
abilities.Add(A)
A.on_gain(src)
if(A.has_action)
if(!A.action)
A.action = new/datum/action/spell_action/alien
A.action.target = A
A.action.name = A.name
A.action.button_icon = A.action_icon
A.action.button_icon_state = A.action_icon_state
A.action.background_icon_state = A.action_background_icon_state
A.action.Grant(src)
/mob/living/carbon/alien/proc/add_abilities_to_panel()
for(var/obj/effect/proc_holder/alien/A in abilities)
@@ -4,18 +4,47 @@ These are general powers. Specific powers are stored under the appropriate alien
/*Alien spit now works like a taser shot. It won't home in on the target but will act the same once it does hit.
Doesn't work on other aliens/AI.*/
/datum/action/spell_action/alien
/datum/action/spell_action/alien/UpdateName()
var/obj/effect/proc_holder/alien/ab = target
return ab.name
/datum/action/spell_action/alien/IsAvailable()
if(!target)
return 0
var/obj/effect/proc_holder/alien/ab = target
if(usr)
return ab.cost_check(ab.check_turf,usr,1)
else
if(owner)
return ab.cost_check(ab.check_turf,owner,1)
return 1
/datum/action/spell_action/alien/CheckRemoval()
return !isalien(owner)
/obj/effect/proc_holder/alien
name = "Alien Power"
panel = "Alien"
var/plasma_cost = 0
var/check_turf = 0
var/has_action = 1
var/datum/action/spell_action/alien/action = null
var/action_icon = 'icons/mob/actions.dmi'
var/action_icon_state = "spell_default"
var/action_background_icon_state = "bg_alien"
/obj/effect/proc_holder/alien/Click()
if(!istype(usr,/mob/living/carbon/alien))
return 1
var/mob/living/carbon/alien/user = usr
if(cost_check(check_turf,user))
if(fire(user))
if(fire(user) && user) // Second check to prevent runtimes when evolving
user.adjustToxLoss(-plasma_cost)
return 1
@@ -25,15 +54,18 @@ Doesn't work on other aliens/AI.*/
/obj/effect/proc_holder/alien/proc/fire(var/mob/living/carbon/alien/user)
return 1
/obj/effect/proc_holder/alien/proc/cost_check(check_turf=0,var/mob/living/carbon/alien/user)
/obj/effect/proc_holder/alien/proc/cost_check(check_turf=0,var/mob/living/carbon/alien/user,var/silent = 0)
if(user.stat)
user << "<span class='noticealien'>You must be conscious to do this.</span>"
if(!silent)
user << "<span class='noticealien'>You must be conscious to do this.</span>"
return 0
if(user.getPlasma() < plasma_cost)
user << "<span class='noticealien'>Not enough plasma stored.</span>"
if(!silent)
user << "<span class='noticealien'>Not enough plasma stored.</span>"
return 0
if(check_turf && (!isturf(user.loc) || istype(user.loc, /turf/space)))
user << "<span class='noticealien'>Bad place for a garden!</span>"
if(!silent)
user << "<span class='noticealien'>Bad place for a garden!</span>"
return 0
return 1
@@ -43,6 +75,8 @@ Doesn't work on other aliens/AI.*/
plasma_cost = 50
check_turf = 1
action_icon_state = "alien_plant"
/obj/effect/proc_holder/alien/plant/fire(var/mob/living/carbon/alien/user)
if(locate(/obj/structure/alien/weeds/node) in get_turf(user))
src << "There's already a weed node here."
@@ -57,6 +91,8 @@ Doesn't work on other aliens/AI.*/
desc = "Whisper to someone"
plasma_cost = 10
action_icon_state = "alien_whisper"
/obj/effect/proc_holder/alien/whisper/fire(var/mob/living/carbon/alien/user)
var/mob/M = input("Select who to whisper to:","Whisper to?",null) as mob in oview(user)
if(!M)
@@ -75,6 +111,8 @@ Doesn't work on other aliens/AI.*/
desc = "Transfer Plasma to another alien"
plasma_cost = 0
action_icon_state = "alien_transfer"
/obj/effect/proc_holder/alien/transfer/fire(var/mob/living/carbon/alien/user)
var/list/mob/living/carbon/alien/aliens_around = list()
for(var/mob/living/carbon/alien/A in oview(user))
@@ -101,6 +139,8 @@ Doesn't work on other aliens/AI.*/
desc = "Drench an object in acid, destroying it over time."
plasma_cost = 200
action_icon_state = "alien_acid"
/obj/effect/proc_holder/alien/acid/on_gain(var/mob/living/carbon/alien/user)
user.verbs.Add(/mob/living/carbon/alien/humanoid/proc/corrosive_acid)
@@ -157,6 +197,8 @@ Doesn't work on other aliens/AI.*/
desc = "Spits neurotoxin at someone, paralyzing them for a short time."
plasma_cost = 50
action_icon_state = "alien_neurotoxin"
/obj/effect/proc_holder/alien/neurotoxin/fire(var/mob/living/carbon/alien/user)
user.visible_message("<span class='danger'>[user] spits neurotoxin!", "<span class='alertalien'>You spit neurotoxin.</span>")
@@ -180,6 +222,8 @@ Doesn't work on other aliens/AI.*/
plasma_cost = 55
check_turf = 1
action_icon_state = "alien_resin"
/obj/effect/proc_holder/alien/resin/fire(var/mob/living/carbon/alien/user)
if(locate(/obj/structure/alien/resin) in user.loc.contents)
user << "<span class='danger'>There is already a resin structure there.</span>"
@@ -206,6 +250,8 @@ Doesn't work on other aliens/AI.*/
desc = "Empties the contents of your stomach"
plasma_cost = 0
action_icon_state = "alien_barf"
/obj/effect/proc_holder/alien/regurgitate/fire(var/mob/living/carbon/alien/user)
if(user.stomach_contents.len)
for(var/atom/movable/A in user.stomach_contents)
@@ -221,6 +267,8 @@ Doesn't work on other aliens/AI.*/
desc = "Toggles Night Vision"
plasma_cost = 0
has_action = 0 // Has dedicated GUI button already
/obj/effect/proc_holder/alien/nightvisiontoggle/fire(var/mob/living/carbon/alien/user)
if(!user.nightvision)
@@ -29,6 +29,8 @@
desc = "Produce an interal egg sac capable of spawning children. Only one queen can exist at a time."
plasma_cost = 500
action_icon_state = "alien_evolve_drone"
/obj/effect/proc_holder/alien/evolve/fire(var/mob/living/carbon/alien/user)
var/no_queen = 1
for(var/mob/living/carbon/alien/humanoid/queen/Q in living_mob_list)
@@ -63,6 +63,8 @@
plasma_cost = 75
check_turf = 1
action_icon_state = "alien_egg"
/obj/effect/proc_holder/alien/lay_egg/fire(var/mob/living/carbon/alien/user)
if(locate(/obj/structure/alien/egg) in get_turf(user))
user << "There's already an egg here."
@@ -3,6 +3,8 @@
desc = "Allows to hide beneath tables or certain items. Toggled on or off."
plasma_cost = 0
action_icon_state = "alien_hide"
/obj/effect/proc_holder/alien/hide/fire(var/mob/living/carbon/alien/user)
if(user.stat != CONSCIOUS)
return
@@ -23,6 +25,8 @@
desc = "Evolve into a fully grown Alien."
plasma_cost = 0
action_icon_state = "alien_evolve_larva"
/obj/effect/proc_holder/alien/larva_evolve/fire(var/mob/living/carbon/alien/user)
if(!islarva(user))
return