mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 20:45:28 +01:00
- Adds generic action and action buttons system
This commit is contained in:
@@ -80,6 +80,8 @@
|
||||
current = new_character //associate ourself with our new body
|
||||
new_character.mind = src //and associate our new body with ourself
|
||||
transfer_antag_huds(new_character) //inherit the antag HUDs from this mind (TODO: move this to a possible antag datum)
|
||||
if(spell_list.len > 0)
|
||||
transfer_mindbound_actions(new_character)
|
||||
|
||||
if(active)
|
||||
new_character.key = key //now transfer the key to link the client to our new body
|
||||
@@ -1310,6 +1312,32 @@
|
||||
ticker.mode.greet_gang(src)
|
||||
ticker.mode.equip_gang(current)
|
||||
|
||||
|
||||
|
||||
/datum/mind/proc/AddSpell(var/obj/effect/proc_holder/spell/spell)
|
||||
spell_list += spell
|
||||
if(!spell.action)
|
||||
spell.action = new/datum/action/spell_action
|
||||
spell.action.target = spell
|
||||
spell.action.name = spell.name
|
||||
spell.action.button_icon = spell.action_icon
|
||||
spell.action.button_icon_state = spell.action_icon_state
|
||||
spell.action.background_icon_state = spell.action_background_icon_state
|
||||
spell.action.Grant(current)
|
||||
return
|
||||
|
||||
/datum/mind/proc/transfer_mindbound_actions(var/mob/living/new_character)
|
||||
for(var/obj/effect/proc_holder/spell/spell in spell_list)
|
||||
if(!spell.action) // Unlikely but whatever
|
||||
spell.action = new/datum/action/spell_action
|
||||
spell.action.target = spell
|
||||
spell.action.name = spell.name
|
||||
spell.action.button_icon = spell.action_icon
|
||||
spell.action.button_icon_state = spell.action_icon_state
|
||||
spell.action.background_icon_state = spell.action_background_icon_state
|
||||
spell.action.Grant(new_character)
|
||||
return
|
||||
|
||||
/mob/proc/sync_mind()
|
||||
mind_initialize() //updates the mind (or creates and initializes one if one doesn't exist)
|
||||
mind.active = 1 //indicates that the mind is currently synced with a client
|
||||
|
||||
@@ -53,6 +53,11 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
|
||||
var/critfailchance = 0
|
||||
var/centcom_cancast = 1 //Whether or not the spell should be allowed on z2
|
||||
|
||||
var/datum/action/spell_action/action = null
|
||||
var/action_icon = 'icons/mob/actions.dmi'
|
||||
var/action_icon_state = "spell_default"
|
||||
var/action_background_icon_state = "bg_spell"
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/cast_check(skipcharge = 0,mob/user = usr) //checks if the spell can be cast based on its settings; skipcharge is used when an additional cast_check is called inside the spell
|
||||
|
||||
if(((!user.mind) || !(src in user.mind.spell_list)) && !(src in user.mob_spell_list))
|
||||
@@ -347,4 +352,45 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
|
||||
qdel(dummy)
|
||||
return 0
|
||||
qdel(dummy)
|
||||
return 1
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/can_cast(mob/user = usr)
|
||||
if(((!user.mind) || !(src in user.mind.spell_list)) && !(src in user.mob_spell_list))
|
||||
return 0
|
||||
|
||||
if(user.z == ZLEVEL_CENTCOM && !centcom_cancast) //Certain spells are not allowed on the centcom zlevel
|
||||
return 0
|
||||
if(user.z == ZLEVEL_CENTCOM && ticker.mode.name == "ragin' mages")
|
||||
return 0
|
||||
|
||||
switch(charge_type)
|
||||
if("recharge")
|
||||
if(charge_counter < charge_max)
|
||||
return 0
|
||||
if("charges")
|
||||
if(!charge_counter)
|
||||
return 0
|
||||
|
||||
if(user.stat && !stat_allowed)
|
||||
return 0
|
||||
|
||||
if(ishuman(user))
|
||||
|
||||
var/mob/living/carbon/human/H = user
|
||||
|
||||
if((invocation_type == "whisper" || invocation_type == "shout") && H.is_muzzled())
|
||||
return 0
|
||||
|
||||
if(clothes_req) //clothes check
|
||||
if(!istype(H.wear_suit, /obj/item/clothing/suit/wizrobe) && !istype(H.wear_suit, /obj/item/clothing/suit/space/hardsuit/wizard))
|
||||
return 0
|
||||
if(!istype(H.shoes, /obj/item/clothing/shoes/sandal))
|
||||
return 0
|
||||
if(!istype(H.head, /obj/item/clothing/head/wizard) && !istype(H.head, /obj/item/clothing/head/helmet/space/hardsuit/wizard))
|
||||
return 0
|
||||
else
|
||||
if(clothes_req || human_req)
|
||||
return 0
|
||||
if(nonabstract_req && (isbrain(user) || ispAI(user)))
|
||||
return 0
|
||||
return 1
|
||||
@@ -14,6 +14,8 @@
|
||||
selection_type = "range"
|
||||
var/list/compatible_mobs = list(/mob/living/carbon/human,/mob/living/carbon/monkey)
|
||||
|
||||
action_icon_state = "barn"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/barnyardcurse/cast(list/targets, mob/user = usr)
|
||||
if(!targets.len)
|
||||
user << "<span class='notice'>No target found in range.</span>"
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
var/emp_heavy = 2
|
||||
var/emp_light = 3
|
||||
|
||||
action_icon_state = "emp"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/emplosion/cast(list/targets)
|
||||
|
||||
for(var/mob/living/target in targets)
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
centcom_cancast = 0 //Prevent people from getting to centcom
|
||||
nonabstract_req = 1
|
||||
var/jaunt_duration = 50 //in deciseconds
|
||||
action_icon_state = "jaunt"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/ethereal_jaunt/cast(list/targets) //magnets, so mostly hardcoded
|
||||
for(var/mob/living/target in targets)
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
range = 3
|
||||
cooldown_min = 20 //20 deciseconds reduction per rank
|
||||
|
||||
action_icon_state = "knock"
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/knock/cast(list/targets)
|
||||
for(var/turf/T in targets)
|
||||
for(var/obj/machinery/door/door in T.contents)
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
var/ready = 0
|
||||
var/image/halo = null
|
||||
|
||||
action_icon_state = "lightning"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/lightning/Click()
|
||||
if(!ready)
|
||||
if(cast_check())
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
range = 0
|
||||
cast_sound = null
|
||||
|
||||
action_icon_state = "mime"
|
||||
action_background_icon_state = "bg_mime"
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/conjure/mime_wall/Click()
|
||||
if(usr && usr.mind)
|
||||
@@ -35,6 +37,9 @@
|
||||
range = -1
|
||||
include_user = 1
|
||||
|
||||
action_icon_state = "mime"
|
||||
action_background_icon_state = "bg_mime"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/mime/speak/Click()
|
||||
if(!usr)
|
||||
return
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
var/paralysis_amount_caster = 20 //how much the caster is paralysed for after the spell
|
||||
var/paralysis_amount_victim = 20 //how much the victim is paralysed for after the spell
|
||||
|
||||
action_icon_state = "mindswap"
|
||||
|
||||
/*
|
||||
Urist: I don't feel like figuring out how you store object spells so I'm leaving this for you to do.
|
||||
Make sure spells that are removed from spell_list are actually removed and deleted when mind transfering.
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
var/obj/marked_item
|
||||
|
||||
action_icon_state = "summons"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/summonitem/cast(list/targets)
|
||||
for(var/mob/living/user in targets)
|
||||
var/list/hand_items = list(user.get_active_hand(),user.get_inactive_hand())
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
proj_trail_lifespan = 5
|
||||
proj_trail_icon_state = "magicmd"
|
||||
|
||||
action_icon_state = "magicm"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/inflict_handler/magic_missile
|
||||
amt_weakened = 3
|
||||
amt_dam_fire = 10
|
||||
@@ -46,6 +48,8 @@
|
||||
duration = 300
|
||||
cooldown_min = 300 //25 deciseconds reduction per rank
|
||||
|
||||
action_icon_state = "mutate"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/inflict_handler/disintegrate
|
||||
name = "Disintegrate"
|
||||
desc = "This spell instantly kills somebody adjacent to you with the vilest of magick."
|
||||
@@ -63,6 +67,8 @@
|
||||
sparks_spread = 1
|
||||
sparks_amt = 4
|
||||
|
||||
action_icon_state = "gib"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/smoke
|
||||
name = "Smoke"
|
||||
desc = "This spell spawns a cloud of choking smoke at your location and does not require wizard garb."
|
||||
@@ -79,6 +85,8 @@
|
||||
smoke_spread = 2
|
||||
smoke_amt = 10
|
||||
|
||||
action_icon_state = "smoke"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/emplosion/disable_tech
|
||||
name = "Disable Tech"
|
||||
desc = "This spell disables all weapons, cameras and most other technology in range."
|
||||
@@ -115,6 +123,8 @@
|
||||
|
||||
centcom_cancast = 0 //prevent people from getting to centcom
|
||||
|
||||
action_icon_state = "blink"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/area_teleport/teleport
|
||||
name = "Teleport"
|
||||
desc = "This spell teleports you to a type of area of your selection."
|
||||
@@ -146,6 +156,8 @@
|
||||
summon_type = list("/obj/effect/forcefield")
|
||||
summon_lifespan = 300
|
||||
|
||||
action_icon_state = "shield"
|
||||
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/conjure/carp
|
||||
name = "Summon Carp"
|
||||
@@ -174,6 +186,8 @@
|
||||
|
||||
summon_type = list(/obj/structure/constructshell)
|
||||
|
||||
action_icon_state = "artificer"
|
||||
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/conjure/creature
|
||||
name = "Summon Creature Swarm"
|
||||
@@ -203,6 +217,8 @@
|
||||
|
||||
starting_spells = list("/obj/effect/proc_holder/spell/targeted/inflict_handler/blind","/obj/effect/proc_holder/spell/targeted/genetic/blind")
|
||||
|
||||
action_icon_state = "blind"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/inflict_handler/blind
|
||||
amt_eye_blind = 10
|
||||
amt_eye_blurry = 20
|
||||
@@ -226,6 +242,8 @@
|
||||
|
||||
summon_type = "/obj/structure/closet/statue"
|
||||
|
||||
action_icon_state = "statue"
|
||||
|
||||
/obj/effect/proc_holder/spell/dumbfire/fireball
|
||||
name = "Fireball"
|
||||
desc = "This spell fires a fireball at a target and does not require wizard garb."
|
||||
@@ -245,6 +263,8 @@
|
||||
proj_lifespan = 200
|
||||
proj_step_delay = 1
|
||||
|
||||
action_icon_state = "fireball"
|
||||
|
||||
/obj/effect/proc_holder/spell/turf/fireball/cast(var/turf/T)
|
||||
explosion(T, -1, 0, 2, 3, 0, flame_range = 2)
|
||||
|
||||
@@ -271,6 +291,8 @@
|
||||
selection_type = "view"
|
||||
var/maxthrow = 5
|
||||
|
||||
action_icon_state = "repulse"
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/repulse/cast(list/targets)
|
||||
var/mob/user = usr
|
||||
var/list/thrownatoms = list()
|
||||
@@ -279,10 +301,10 @@
|
||||
for(var/turf/T in targets) //Done this way so things don't get thrown all around hilariously.
|
||||
for(var/atom/movable/AM in T)
|
||||
thrownatoms += AM
|
||||
|
||||
|
||||
for(var/atom/movable/AM in thrownatoms)
|
||||
if(AM == user || AM.anchored) continue
|
||||
|
||||
|
||||
var/obj/effect/overlay/targeteffect = new /obj/effect/overlay{icon='icons/effects/effects.dmi'; icon_state="shieldsparkles"; mouse_opacity=0; density = 0}()
|
||||
AM.overlays += targeteffect
|
||||
throwtarget = get_edge_target_turf(user, get_dir(user, get_step_away(AM, user)))
|
||||
|
||||
Reference in New Issue
Block a user