Energy swords and other transforming energy weapons are now subtypes of transforming weapons (#2049)

This commit is contained in:
CitadelStationBot
2017-07-18 00:51:51 -05:00
committed by kevinz000
parent 7a173b95ed
commit bbc28aa856
30 changed files with 131 additions and 168 deletions

View File

@@ -237,7 +237,7 @@
w_class = WEIGHT_CLASS_SMALL
add_fingerprint(user)
// Copied from /obj/item/weapon/melee/energy/sword/attackby
// Copied from /obj/item/weapon/melee/transforming/energy/sword/attackby
/obj/item/toy/sword/attackby(obj/item/weapon/W, mob/living/user, params)
if(istype(W, /obj/item/toy/sword))
if((W.flags & NODROP) || (flags & NODROP))

View File

@@ -1,46 +1,63 @@
/obj/item/weapon/melee/energy
var/active = 0
var/force_on = 30 //force when active
var/throwforce_on = 20
var/icon_state_on = "axe1"
var/list/attack_verb_on = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
var/list/possible_colors
w_class = WEIGHT_CLASS_SMALL
sharpness = IS_SHARP
var/w_class_on = WEIGHT_CLASS_BULKY
/obj/item/weapon/melee/transforming/energy
hitsound_on = 'sound/weapons/blade1.ogg'
heat = 3500
max_integrity = 200
armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 100, acid = 30)
resistance_flags = FIRE_PROOF
var/brightness_on = 3
/obj/item/weapon/melee/energy/Initialize()
/obj/item/weapon/melee/transforming/energy/Initialize()
. = ..()
if(LAZYLEN(possible_colors))
item_color = pick(possible_colors)
switch(item_color)//Only run this check if the color was picked randomly, so that colors can be manually set for non-random colored energy weapons.
if("red")
light_color = LIGHT_COLOR_RED
if("green")
light_color = LIGHT_COLOR_GREEN
if("blue")
light_color = LIGHT_COLOR_LIGHT_CYAN
if("purple")
light_color = LIGHT_COLOR_LAVENDER
if(active)
set_light(brightness_on)
START_PROCESSING(SSobj, src)
/obj/item/weapon/melee/energy/suicide_act(mob/user)
/obj/item/weapon/melee/transforming/energy/Destroy()
STOP_PROCESSING(SSobj, src)
return ..()
/obj/item/weapon/melee/transforming/energy/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is [pick("slitting [user.p_their()] stomach open with", "falling on")] [src]! It looks like [user.p_theyre()] trying to commit seppuku!</span>")
return (BRUTELOSS|FIRELOSS)
/obj/item/weapon/melee/energy/add_blood(list/blood_dna)
/obj/item/weapon/melee/transforming/energy/add_blood(list/blood_dna)
return 0
/obj/item/weapon/melee/energy/is_sharp()
/obj/item/weapon/melee/transforming/energy/is_sharp()
return active * sharpness
/obj/item/weapon/melee/energy/axe
/obj/item/weapon/melee/transforming/energy/process()
open_flame()
/obj/item/weapon/melee/transforming/energy/transform_weapon(mob/living/user, supress_message_text)
. = ..()
if(.)
if(active)
if(item_color)
icon_state = "sword[item_color]"
START_PROCESSING(SSobj, src)
set_light(brightness_on)
else
STOP_PROCESSING(SSobj, src)
set_light(0)
/obj/item/weapon/melee/transforming/energy/is_hot()
return active * heat
/obj/item/weapon/melee/transforming/energy/ignition_effect(atom/A, mob/user)
if(!active)
return ""
var/in_mouth = ""
if(iscarbon(user))
var/mob/living/carbon/C = user
if(C.wear_mask == src)
in_mouth = ", barely missing their nose"
. = "<span class='warning'>[user] swings their [src][in_mouth]. They light [A] in the process.</span>"
playsound(loc, hitsound, get_clamped_volume(), 1, -1)
add_fingerprint(user)
/obj/item/weapon/melee/transforming/energy/axe
name = "energy axe"
desc = "An energized battle axe."
icon_state = "axe0"
@@ -56,21 +73,22 @@
flags = CONDUCT
armour_penetration = 100
origin_tech = "combat=4;magnets=3"
attack_verb = list("attacked", "chopped", "cleaved", "torn", "cut")
attack_verb_off = list("attacked", "chopped", "cleaved", "torn", "cut")
attack_verb_on = list()
light_color = "#40ceff"
/obj/item/weapon/melee/energy/axe/suicide_act(mob/user)
/obj/item/weapon/melee/transforming/energy/axe/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] swings [src] towards [user.p_their()] head! It looks like [user.p_theyre()] trying to commit suicide!</span>")
return (BRUTELOSS|FIRELOSS)
/obj/item/weapon/melee/energy/sword
/obj/item/weapon/melee/transforming/energy/sword
name = "energy sword"
desc = "May the force be within you."
icon_state = "sword0"
force = 3
throwforce = 5
hitsound = "swing_hit" //it starts deactivated
attack_verb_off = list("tapped", "poked")
throw_speed = 3
throw_range = 5
sharpness = IS_SHARP
@@ -79,93 +97,30 @@
armour_penetration = 35
origin_tech = "combat=3;magnets=4;syndicate=4"
block_chance = 50
possible_colors = list("red", "blue", "green", "purple")
var/hacked = FALSE
/obj/item/weapon/melee/energy/sword/Destroy()
STOP_PROCESSING(SSobj, src)
/obj/item/weapon/melee/transforming/energy/sword/transform_weapon(mob/living/user, supress_message_text)
. = ..()
if(. && active && item_color)
icon_state = "sword[item_color]"
/obj/item/weapon/melee/energy/sword/process()
if(active)
if(hacked)
light_color = pick(LIGHT_COLOR_RED, LIGHT_COLOR_GREEN, LIGHT_COLOR_LIGHT_CYAN, LIGHT_COLOR_LAVENDER)
open_flame()
else
STOP_PROCESSING(SSobj, src)
/obj/item/weapon/melee/energy/sword/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
/obj/item/weapon/melee/transforming/energy/sword/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
if(active)
return ..()
return 0
/obj/item/weapon/melee/energy/attack_self(mob/living/carbon/user)
if(user.disabilities & CLUMSY && prob(50))
to_chat(user, "<span class='warning'>You accidentally cut yourself with [src], like a doofus!</span>")
user.take_bodypart_damage(5,5)
active = !active
if (active)
force = force_on
throwforce = throwforce_on
hitsound = 'sound/weapons/blade1.ogg'
throw_speed = 4
if(attack_verb_on.len)
attack_verb = attack_verb_on
if(!item_color)
icon_state = icon_state_on
else
icon_state = "sword[item_color]"
w_class = w_class_on
playsound(user, 'sound/weapons/saberon.ogg', 35, 1) //changed it from 50% volume to 35% because deafness
to_chat(user, "<span class='notice'>[src] is now active.</span>")
START_PROCESSING(SSobj, src)
set_light(brightness_on)
else
force = initial(force)
throwforce = initial(throwforce)
hitsound = initial(hitsound)
throw_speed = initial(throw_speed)
if(attack_verb_on.len)
attack_verb = list()
icon_state = initial(icon_state)
w_class = initial(w_class)
playsound(user, 'sound/weapons/saberoff.ogg', 35, 1) //changed it from 50% volume to 35% because deafness
to_chat(user, "<span class='notice'>[src] can now be concealed.</span>")
STOP_PROCESSING(SSobj, src)
set_light(0)
add_fingerprint(user)
/obj/item/weapon/melee/energy/is_hot()
return active * heat
/obj/item/weapon/melee/energy/ignition_effect(atom/A, mob/user)
if(!active)
return ""
var/in_mouth = ""
if(iscarbon(user))
var/mob/living/carbon/C = user
if(C.wear_mask == src)
in_mouth = ", barely missing their nose"
. = "<span class='warning'>[user] swings their \
[src][in_mouth]. They light [A] in the process.</span>"
playsound(loc, hitsound, get_clamped_volume(), 1, -1)
add_fingerprint(user)
/obj/item/weapon/melee/energy/sword/cyborg
/obj/item/weapon/melee/transforming/energy/sword/cyborg
var/hitcost = 50
/obj/item/weapon/melee/energy/sword/cyborg/attack(mob/M, var/mob/living/silicon/robot/R)
/obj/item/weapon/melee/transforming/energy/sword/cyborg/attack(mob/M, var/mob/living/silicon/robot/R)
if(R.cell)
var/obj/item/weapon/stock_parts/cell/C = R.cell
if(active && !(C.use(hitcost)))
attack_self(R)
to_chat(R, "<span class='notice'>It's out of charge!</span>")
return
..()
return
return ..()
/obj/item/weapon/melee/energy/sword/cyborg/saw //Used by medical Syndicate cyborgs
/obj/item/weapon/melee/transforming/energy/sword/cyborg/saw //Used by medical Syndicate cyborgs
name = "energy saw"
desc = "For heavy duty cutting. It has a carbon-fiber blade in addition to a toggleable hard-light edge to dramatically increase sharpness."
icon_state = "esaw"
@@ -176,36 +131,44 @@
icon_state = "esaw_0"
icon_state_on = "esaw_1"
hitcost = 75 //Costs more than a standard cyborg esword
item_color = null
w_class = WEIGHT_CLASS_NORMAL
sharpness = IS_SHARP
light_color = "#40ceff"
possible_colors = null
/obj/item/weapon/melee/energy/sword/cyborg/saw/Initialize()
. = ..()
icon_state = "esaw_0"
item_color = null
/obj/item/weapon/melee/energy/sword/cyborg/saw/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
/obj/item/weapon/melee/transforming/energy/sword/cyborg/saw/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
return 0
/obj/item/weapon/melee/energy/sword/saber
/obj/item/weapon/melee/transforming/energy/sword/saber
var/list/possible_colors = list("red" = LIGHT_COLOR_RED, "blue" = LIGHT_COLOR_LIGHT_CYAN, "green" = LIGHT_COLOR_GREEN, "purple" = LIGHT_COLOR_LAVENDER)
var/hacked = FALSE
/obj/item/weapon/melee/energy/sword/saber/blue
possible_colors = list("blue")
/obj/item/weapon/melee/transforming/energy/sword/saber/Initialize(mapload)
. = ..()
if(LAZYLEN(possible_colors))
var/set_color = pick(possible_colors)
item_color = set_color
light_color = possible_colors[set_color]
/obj/item/weapon/melee/energy/sword/saber/purple
possible_colors = list("purple")
/obj/item/weapon/melee/transforming/energy/sword/saber/process()
. = ..()
if(hacked)
var/set_color = pick(possible_colors)
light_color = possible_colors[set_color]
update_light()
/obj/item/weapon/melee/energy/sword/saber/green
possible_colors = list("green")
/obj/item/weapon/melee/transforming/energy/sword/saber/red
possible_colors = list("red" = LIGHT_COLOR_RED)
/obj/item/weapon/melee/energy/sword/saber/red
possible_colors = list("red")
/obj/item/weapon/melee/transforming/energy/sword/saber/blue
possible_colors = list("blue" = LIGHT_COLOR_LIGHT_CYAN)
/obj/item/weapon/melee/transforming/energy/sword/saber/green
possible_colors = list("green" = LIGHT_COLOR_GREEN)
/obj/item/weapon/melee/energy/sword/saber/attackby(obj/item/weapon/W, mob/living/user, params)
/obj/item/weapon/melee/transforming/energy/sword/saber/purple
possible_colors = list("purple" = LIGHT_COLOR_LAVENDER)
/obj/item/weapon/melee/transforming/energy/sword/saber/attackby(obj/item/weapon/W, mob/living/user, params)
if(istype(W, /obj/item/device/multitool))
if(!hacked)
hacked = TRUE
@@ -220,21 +183,21 @@
else
return ..()
/obj/item/weapon/melee/energy/sword/pirate
/obj/item/weapon/melee/transforming/energy/sword/pirate
name = "energy cutlass"
desc = "Arrrr matey."
icon_state = "cutlass0"
icon_state_on = "cutlass1"
light_color = "#ff0000"
/obj/item/weapon/melee/energy/blade
/obj/item/weapon/melee/transforming/energy/blade
name = "energy blade"
desc = "A concentrated beam of energy in the shape of a blade. Very stylish... and lethal."
icon_state = "blade"
force = 30 //Normal attacks deal esword damage
force = 30 //Normal attacks deal esword damage
hitsound = 'sound/weapons/blade1.ogg'
active = 1
throwforce = 1//Throwing or dropping the item deletes it.
throwforce = 1 //Throwing or dropping the item deletes it.
throw_speed = 3
throw_range = 1
w_class = WEIGHT_CLASS_BULKY//So you can't hide it in your pocket or some such.
@@ -242,16 +205,16 @@
sharpness = IS_SHARP
//Most of the other special functions are handled in their own files. aka special snowflake code so kewl
/obj/item/weapon/melee/energy/blade/Initialize()
/obj/item/weapon/melee/transforming/energy/blade/Initialize()
. = ..()
spark_system = new /datum/effect_system/spark_spread()
spark_system.set_up(5, 0, src)
spark_system.attach(src)
/obj/item/weapon/melee/energy/blade/attack_self(mob/user)
/obj/item/weapon/melee/transforming/energy/blade/transform_weapon(mob/living/user, supress_message_text)
return
/obj/item/weapon/melee/energy/blade/hardlight
/obj/item/weapon/melee/transforming/energy/blade/hardlight
name = "hardlight blade"
desc = "An extremely sharp blade made out of hard light. Packs quite a punch."
icon_state = "lightblade"

View File

@@ -28,7 +28,7 @@
/obj/item/weapon/melee/transforming/attack(mob/living/target, mob/living/carbon/human/user)
var/nemesis_faction = FALSE
if(nemesis_factions.len)
if(LAZYLEN(nemesis_factions))
for(var/F in target.faction)
if(F in nemesis_factions)
nemesis_faction = TRUE

View File

@@ -20,7 +20,7 @@
if(requires_sharpness && !I.sharpness)
to_chat(user, "<span class='notice'>You can only sharpen items that are already sharp, such as knives.</span>")
return
if(istype(I, /obj/item/weapon/melee/energy))
if(istype(I, /obj/item/weapon/melee/transforming/energy))
to_chat(user, "<span class='notice'>You don't think \the [I] will be the thing getting modified if you use it on \the [src].</span>")
return
if(istype(I, /obj/item/weapon/twohanded))//some twohanded items should still be sharpenable, but handle force differently. therefore i need this stuff

View File

@@ -52,7 +52,7 @@
new /obj/item/clothing/under/suit_jacket/really_black(src)
if("murder") // 28 tc now
new /obj/item/weapon/melee/energy/sword/saber(src)
new /obj/item/weapon/melee/transforming/energy/sword/saber(src)
new /obj/item/clothing/glasses/thermal/syndi(src)
new /obj/item/weapon/card/emag(src)
new /obj/item/clothing/shoes/chameleon(src)

View File

@@ -360,7 +360,7 @@
return 1
/obj/item/weapon/twohanded/dualsaber/ignition_effect(atom/A, mob/user)
// same as /obj/item/weapon/melee/energy, mostly
// same as /obj/item/weapon/melee/transforming/energy, mostly
if(!wielded)
return ""
var/in_mouth = ""

View File

@@ -63,7 +63,7 @@
for(var/i in 1 to 3)
new /obj/item/clothing/suit/armor/tdome/red(src)
for(var/i in 1 to 3)
new /obj/item/weapon/melee/energy/sword/saber(src)
new /obj/item/weapon/melee/transforming/energy/sword/saber(src)
for(var/i in 1 to 3)
new /obj/item/weapon/gun/energy/laser(src)
for(var/i in 1 to 3)
@@ -82,7 +82,7 @@
for(var/i in 1 to 3)
new /obj/item/clothing/suit/armor/tdome/green(src)
for(var/i in 1 to 3)
new /obj/item/weapon/melee/energy/sword/saber(src)
new /obj/item/weapon/melee/transforming/energy/sword/saber(src)
for(var/i in 1 to 3)
new /obj/item/weapon/gun/energy/laser(src)
for(var/i in 1 to 3)

View File

@@ -442,7 +442,7 @@
/datum/outfit/syndicate_empty/SBC/assault/captain
name = "Syndicate Battlecruiser Captain"
l_pocket = /obj/item/weapon/melee/energy/sword/saber/red
l_pocket = /obj/item/weapon/melee/transforming/energy/sword/saber/red
r_pocket = /obj/item/weapon/melee/classic_baton/telescopic
suit = /obj/item/clothing/suit/armor/vest/capcarapace/syndicate
suit_store = /obj/item/weapon/gun/ballistic/revolver/mateba