mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-25 04:57:47 +01:00
Merge remote-tracking branch 'remotes/git-svn' r4881 into bs12_with_tgport
Conflicts: baystation12.dme code/game/gamemodes/events.dm code/game/machinery/doors/door.dm code/game/machinery/gateway.dm code/game/objects/items/devices/flashlight.dm code/game/sound.dm code/global.dm code/modules/admin/admin_verbs.dm code/modules/awaymissions/zlevel.dm code/modules/food/recipes_microwave.dm code/modules/mining/mine_items.dm code/modules/mob/living/carbon/carbon.dm code/modules/mob/living/carbon/human/update_icons.dm code/modules/paperwork/clipboard.dm code/modules/paperwork/filingcabinet.dm code/modules/paperwork/folders.dm code/modules/paperwork/handlabeler.dm code/modules/paperwork/paper.dm code/modules/paperwork/paperbin.dm code/modules/paperwork/pen.dm code/modules/paperwork/photocopier.dm code/modules/paperwork/stamps.dm code/world.dm html/changelog.html maps/RandomZLevels/fileList.txt Signed-off-by: Cael_Aislinn <cael_aislinn@yahoo.com.au>
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
return
|
||||
|
||||
. = src.say_dead(message)
|
||||
|
||||
/*
|
||||
for (var/mob/M in hearers(null, null))
|
||||
if (!M.stat)
|
||||
if(M.job == "Chaplain")
|
||||
@@ -41,4 +41,5 @@
|
||||
else
|
||||
M.show_message("<span class='game'><i>You hear muffled speech... you can almost make out some words...</i></span>", 2)
|
||||
// M.show_message("<span class='game'><i>[stutter(message)]</i></span>", 2)
|
||||
playsound(src.loc, pick('sound/effects/ghost.ogg','sound/effects/ghost2.ogg'), 10, 1)
|
||||
playsound(src.loc, pick('sound/effects/ghost.ogg','sound/effects/ghost2.ogg'), 10, 1)
|
||||
*/
|
||||
@@ -35,11 +35,10 @@
|
||||
return
|
||||
|
||||
/mob/living/carbon/alien/adjustFireLoss(amount) // Weak to Fire
|
||||
..(amount * 1.5)
|
||||
return
|
||||
|
||||
/mob/living/carbon/alien/adjustBruteLoss(amount) // Strong against melee weapons
|
||||
..(amount * 0.5)
|
||||
if(amount > 0)
|
||||
..(amount * 1.5)
|
||||
else
|
||||
..(amount)
|
||||
return
|
||||
|
||||
/mob/living/carbon/alien/proc/getPlasma()
|
||||
@@ -48,6 +47,15 @@
|
||||
/mob/living/carbon/alien/eyecheck()
|
||||
return 2
|
||||
|
||||
/mob/living/carbon/alien/updatehealth()
|
||||
if(nodamage)
|
||||
health = maxHealth
|
||||
stat = CONSCIOUS
|
||||
else
|
||||
//oxyloss is only used for suicide
|
||||
//toxloss isn't used for aliens, its actually used as alien powers!!
|
||||
health = maxHealth - getOxyLoss() - getFireLoss() - getBruteLoss() - getCloneLoss()
|
||||
|
||||
/mob/living/carbon/alien/proc/handle_environment(var/datum/gas_mixture/environment)
|
||||
|
||||
//If there are alien weeds on the ground then heal if needed or give some toxins
|
||||
@@ -106,12 +114,8 @@
|
||||
/mob/living/carbon/alien/proc/handle_mutations_and_radiation()
|
||||
|
||||
if(getFireLoss())
|
||||
if((COLD_RESISTANCE in mutations) || prob(50))
|
||||
switch(getFireLoss())
|
||||
if(1 to 50)
|
||||
adjustFireLoss(-1)
|
||||
if(51 to 100)
|
||||
adjustFireLoss(-5)
|
||||
if((COLD_RESISTANCE in mutations) || prob(5))
|
||||
adjustFireLoss(-1)
|
||||
|
||||
// Aliens love radiation nom nom nom
|
||||
if (radiation)
|
||||
@@ -145,6 +149,7 @@
|
||||
|
||||
/mob/living/carbon/alien/Stat()
|
||||
|
||||
statpanel("Status")
|
||||
stat(null, "Intent: [a_intent]")
|
||||
stat(null, "Move Mode: [m_intent]")
|
||||
|
||||
|
||||
@@ -524,13 +524,4 @@ In all, this is a lot like the monkey code. /N
|
||||
onclose(user, "mob[name]")
|
||||
return
|
||||
|
||||
/mob/living/carbon/alien/humanoid/updatehealth()
|
||||
if(nodamage)
|
||||
health = maxHealth
|
||||
stat = CONSCIOUS
|
||||
else
|
||||
//oxyloss is only used for suicide
|
||||
//toxloss isn't used for aliens, its actually used as alien powers!!
|
||||
health = maxHealth - getOxyLoss() - getFireLoss() - getBruteLoss() - getCloneLoss()
|
||||
|
||||
|
||||
|
||||
@@ -222,17 +222,17 @@
|
||||
blinded = 1
|
||||
silent = 0
|
||||
else //ALIVE. LIGHTS ARE ON
|
||||
if(health < config.health_threshold_dead || brain_op_stage == 4.0)
|
||||
if(health < -25 || brain_op_stage == 4.0)
|
||||
death()
|
||||
blinded = 1
|
||||
silent = 0
|
||||
return 1
|
||||
|
||||
//UNCONSCIOUS. NO-ONE IS HOME
|
||||
if( (getOxyLoss() > 50) || (config.health_threshold_crit > health) )
|
||||
if( health <= 20 && prob(1) )
|
||||
spawn(0)
|
||||
emote("gasp")
|
||||
if( (getOxyLoss() > 50) || (0 > health) )
|
||||
//if( health <= 20 && prob(1) )
|
||||
// spawn(0)
|
||||
// emote("gasp")
|
||||
if(!reagents.has_reagent("inaprovaline"))
|
||||
adjustOxyLoss(1)
|
||||
Paralyse(3)
|
||||
|
||||
@@ -11,6 +11,7 @@ var/const/MAX_ACTIVE_TIME = 400
|
||||
/obj/item/clothing/mask/facehugger
|
||||
name = "alien"
|
||||
desc = "It has some sort of a tube at the end of its tail."
|
||||
icon = 'icons/mob/alien.dmi'
|
||||
icon_state = "facehugger"
|
||||
item_state = "facehugger"
|
||||
w_class = 1 //note: can be picked up by aliens unlike most other items of w_class below 4
|
||||
@@ -167,6 +168,7 @@ var/const/MAX_ACTIVE_TIME = 400
|
||||
return
|
||||
|
||||
stat = CONSCIOUS
|
||||
icon_state = "[initial(icon_state)]"
|
||||
|
||||
/* for(var/mob/living/carbon/alien/alien in world)
|
||||
var/image/activeIndicator = image('icons/mob/alien.dmi', loc = src, icon_state = "facehugger_active")
|
||||
@@ -183,6 +185,7 @@ var/const/MAX_ACTIVE_TIME = 400
|
||||
/* RemoveActiveIndicators() */
|
||||
|
||||
stat = UNCONSCIOUS
|
||||
icon_state = "[initial(icon_state)]_inactive"
|
||||
|
||||
spawn(rand(MIN_ACTIVE_TIME,MAX_ACTIVE_TIME))
|
||||
GoActive()
|
||||
@@ -194,7 +197,7 @@ var/const/MAX_ACTIVE_TIME = 400
|
||||
|
||||
/* RemoveActiveIndicators() */
|
||||
|
||||
icon_state = "facehugger_dead"
|
||||
icon_state = "[initial(icon_state)]_dead"
|
||||
stat = DEAD
|
||||
|
||||
for(var/mob/O in viewers(src, null))
|
||||
|
||||
@@ -433,4 +433,4 @@
|
||||
|
||||
|
||||
|
||||
item.throw_at(target, item.throw_range, item.throw_speed)
|
||||
item.throw_at(target, item.throw_range, item.throw_speed)/mob/living/carbon/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > CARBON_LIFEFORM_FIRE_RESISTANCE) adjustFireLoss(CARBON_LIFEFORM_FIRE_DAMAGE) ..()
|
||||
@@ -309,7 +309,7 @@
|
||||
|
||||
proc/handle_mutations_and_radiation()
|
||||
if(getFireLoss())
|
||||
if((COLD_RESISTANCE in mutations) || (prob(1) && prob(75)))
|
||||
if((COLD_RESISTANCE in mutations) || (prob(1)))
|
||||
heal_organ_damage(0,1)
|
||||
|
||||
// Make nanoregen heal youu, -3 all damage types
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
return
|
||||
else
|
||||
return ..(message)
|
||||
if(stat == DEAD)
|
||||
return ..(message)
|
||||
|
||||
if(length(message) >= 1) //In case people forget the '*help' command, this will slow them the message and prevent people from saying one letter at a time
|
||||
if (copytext(message, 1, 2) != "*")
|
||||
@@ -32,7 +34,7 @@
|
||||
for(var/i = 0,i<imax,i++)
|
||||
message += "E"
|
||||
|
||||
if(stat != 2)
|
||||
if(stat != DEAD)
|
||||
for(var/datum/disease/pierrot_throat/D in viruses)
|
||||
var/list/temp_message = dd_text2list(message, " ") //List each word in the message
|
||||
var/list/pick_list = list()
|
||||
|
||||
@@ -220,8 +220,8 @@ proc/get_damage_icon_part(damage_state, body_part)
|
||||
if(stand_icon) del(stand_icon)
|
||||
if(lying_icon) del(lying_icon)
|
||||
if(dna && dna.mutantrace) return
|
||||
var/husk = (HUSK in src.mutations) //100% unnecessary -Agouri //nope, do you really want to iterate through src.mutations repeatedly? -Pete var/fat = (FAT in src.mutations) var/skeleton = (SKELETON in src.mutations) var/g = "m"
|
||||
|
||||
var/g = "m"
|
||||
if(gender == FEMALE) g = "f"
|
||||
var/husk = (HUSK in src.mutations)
|
||||
var/obese = (FAT in src.mutations)
|
||||
@@ -230,19 +230,10 @@ proc/get_damage_icon_part(damage_state, body_part)
|
||||
var/individual_limbs = 1
|
||||
|
||||
//Base mob icon
|
||||
if(obese)
|
||||
// Sorry, no dismemberment for fat people.
|
||||
stand_icon = new /icon('icons/mob/human.dmi', "fatbody_s")
|
||||
if(husk) stand_icon = new /icon('icons/mob/human.dmi', "husk_s") lying_icon = new /icon('icons/mob/human.dmi', "husk_l") else if(fat) stand_icon = new /icon('icons/mob/human.dmi', "fatbody_s")
|
||||
lying_icon = new /icon('icons/mob/human.dmi', "fatbody_l")
|
||||
individual_limbs = 0
|
||||
// If dismemberment is on, draw individual limbs
|
||||
else if(config.limbs_can_break)
|
||||
stand_icon = new /icon('icons/mob/human.dmi', "torso_[g]_s")
|
||||
lying_icon = new /icon('icons/mob/human.dmi', "torso_[g]_l")
|
||||
// Otherwise just draw the full body.
|
||||
else if(SKELETON in src.mutations)
|
||||
stand_icon = new /icon('icons/mob/human.dmi', "skeleton_s")
|
||||
lying_icon = new /icon('icons/mob/human.dmi', "skeleton_l")
|
||||
else if(skeleton)
|
||||
stand_icon = new /icon('icons/mob/human.dmi', "skeleton_s") lying_icon = new /icon('icons/mob/human.dmi', "skeleton_l")
|
||||
else
|
||||
stand_icon = new /icon('icons/mob/human.dmi', "body_[g]_s")
|
||||
lying_icon = new /icon('icons/mob/human.dmi', "body_[g]_l")
|
||||
@@ -289,7 +280,7 @@ proc/get_damage_icon_part(damage_state, body_part)
|
||||
lying_icon.Blend(husk_l, ICON_OVERLAY)
|
||||
|
||||
//Skin tone
|
||||
if((SKELETON in src.mutations) == 0)
|
||||
if(!skeleton)
|
||||
if(s_tone >= 0)
|
||||
stand_icon.Blend(rgb(s_tone, s_tone, s_tone), ICON_ADD)
|
||||
lying_icon.Blend(rgb(s_tone, s_tone, s_tone), ICON_ADD)
|
||||
@@ -298,7 +289,7 @@ proc/get_damage_icon_part(damage_state, body_part)
|
||||
lying_icon.Blend(rgb(-s_tone, -s_tone, -s_tone), ICON_SUBTRACT)
|
||||
|
||||
//Eyes
|
||||
if((SKELETON in src.mutations) == 0)
|
||||
if(!skeleton)
|
||||
var/icon/eyes_s = new/icon('icons/mob/human_face.dmi', "eyes_s")
|
||||
var/icon/eyes_l = new/icon('icons/mob/human_face.dmi', "eyes_l")
|
||||
eyes_s.Blend(rgb(r_eyes, g_eyes, b_eyes), ICON_ADD)
|
||||
@@ -314,16 +305,13 @@ proc/get_damage_icon_part(damage_state, body_part)
|
||||
lying_icon.Blend(eyes_l, ICON_OVERLAY)
|
||||
|
||||
//Mouth (lipstick!)
|
||||
if(lip_style && (SKELETON in src.mutations) == 0)
|
||||
if(lip_style) //skeletons are allowed to wear lipstick no matter what you think, agouri.
|
||||
stand_icon.Blend(new/icon('icons/mob/human_face.dmi', "lips_[lip_style]_s"), ICON_OVERLAY)
|
||||
lying_icon.Blend(new/icon('icons/mob/human_face.dmi', "lips_[lip_style]_l"), ICON_OVERLAY)
|
||||
|
||||
//Underwear
|
||||
if(underwear >0 && underwear < 12)
|
||||
if(!obese)
|
||||
stand_icon.Blend(new /icon('human.dmi', "underwear[underwear]_[g]_s"), ICON_OVERLAY)
|
||||
lying_icon.Blend(new /icon('human.dmi', "underwear[underwear]_[g]_l"), ICON_OVERLAY)
|
||||
if(update_icons) update_icons()
|
||||
if(!fat && !skeleton) stand_icon.Blend(new /icon('icons/mob/human.dmi', "underwear[underwear]_[g]_s"), ICON_OVERLAY) if(update_icons) update_icons()
|
||||
//tail update_tail_showing(0)
|
||||
|
||||
|
||||
@@ -375,7 +363,7 @@ proc/get_damage_icon_part(damage_state, body_part)
|
||||
|
||||
/mob/living/carbon/human/update_mutations(var/update_icons=1)
|
||||
var/fat
|
||||
if( FAT in mutations )
|
||||
if(FAT in mutations)
|
||||
fat = "fat"
|
||||
|
||||
var/image/lying = image("icon" = 'icons/effects/genetics.dmi')
|
||||
|
||||
@@ -73,7 +73,8 @@ var/datum/cameranet/cameranet = new()
|
||||
// Removes a camera from a chunk.
|
||||
|
||||
/datum/cameranet/proc/removeCamera(obj/machinery/camera/c)
|
||||
majorChunkChange(c, 0)
|
||||
if(c.can_use())
|
||||
majorChunkChange(c, 0)
|
||||
|
||||
// Add a camera to a chunk.
|
||||
|
||||
@@ -81,15 +82,13 @@ var/datum/cameranet/cameranet = new()
|
||||
if(c.can_use())
|
||||
majorChunkChange(c, 1)
|
||||
|
||||
// Used for Cyborg cameras. It is the same as "add" but named differently for easier readability
|
||||
// and to allow the user know what it is for. Since portable cameras can be in ANY chunk, we have to
|
||||
// all it to be added to all chunks. If the camera is disabled, it will instead remove.
|
||||
// Used for Cyborg cameras. Since portable cameras can be in ANY chunk.
|
||||
|
||||
/datum/cameranet/proc/updatePortableCamera(obj/machinery/camera/c)
|
||||
if(c.can_use())
|
||||
majorChunkChange(c, 1)
|
||||
else
|
||||
majorChunkChange(c, 0)
|
||||
//else
|
||||
// majorChunkChange(c, 0)
|
||||
|
||||
// Never access this proc directly!!!!
|
||||
// This will update the chunk and all the surrounding chunks.
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
var/visible = 0
|
||||
var/changed = 0
|
||||
var/updating = 0
|
||||
var/x = 0
|
||||
var/y = 0
|
||||
var/z = 0
|
||||
|
||||
// Add an AI eye to the chunk, then update if changed.
|
||||
|
||||
@@ -69,10 +72,16 @@
|
||||
|
||||
var/list/newVisibleTurfs = list()
|
||||
|
||||
for(var/obj/machinery/camera/c in cameras)
|
||||
for(var/camera in cameras)
|
||||
var/obj/machinery/camera/c = camera
|
||||
|
||||
if(!c.can_use())
|
||||
continue
|
||||
|
||||
var/turf/point = locate(src.x + 8, src.y + 8, src.z)
|
||||
if(get_dist(point, c) > 24)
|
||||
continue
|
||||
|
||||
for(var/turf/t in c.can_see())
|
||||
newVisibleTurfs += t
|
||||
|
||||
@@ -85,7 +94,6 @@
|
||||
visibleTurfs = newVisibleTurfs
|
||||
obscuredTurfs = turfs - newVisibleTurfs
|
||||
|
||||
|
||||
for(var/turf in visAdded)
|
||||
var/turf/t = turf
|
||||
if(t.obscured)
|
||||
@@ -116,16 +124,21 @@
|
||||
|
||||
/datum/camerachunk/New(loc, x, y, z)
|
||||
|
||||
set background = 1
|
||||
|
||||
// 0xf = 15
|
||||
x &= ~0xf
|
||||
y &= ~0xf
|
||||
|
||||
src.x = x
|
||||
src.y = y
|
||||
src.z = z
|
||||
|
||||
for(var/obj/machinery/camera/c in range(16, locate(x + 8, y + 8, z)))
|
||||
if(c.can_use())
|
||||
cameras += c
|
||||
|
||||
for(var/turf/t in range(10, locate(x + 8, y + 8, z)))
|
||||
|
||||
if(t.x >= x && t.y >= y && t.x < x + 16 && t.y < y + 16)
|
||||
turfs += t
|
||||
|
||||
|
||||
@@ -64,13 +64,15 @@
|
||||
/mob/living/silicon/robot/var/updating = 0
|
||||
|
||||
/mob/living/silicon/robot/Move()
|
||||
var/oldLoc = src.loc
|
||||
. = ..()
|
||||
if(.)
|
||||
if(src.camera)
|
||||
if(!updating)
|
||||
updating = 1
|
||||
spawn(BORG_CAMERA_BUFFER)
|
||||
cameranet.updatePortableCamera(src.camera)
|
||||
if(oldLoc != src.loc)
|
||||
cameranet.updatePortableCamera(src.camera)
|
||||
updating = 0
|
||||
|
||||
// CAMERA
|
||||
|
||||
@@ -65,6 +65,8 @@
|
||||
updatename("Default")
|
||||
updateicon()
|
||||
|
||||
playsound(src, 'sound/voice/liveagain.ogg', 75, 1)
|
||||
|
||||
if(!cell)
|
||||
cell = new /obj/item/weapon/cell(src)
|
||||
cell.maxcharge = 7500
|
||||
|
||||
@@ -367,4 +367,21 @@
|
||||
dir = i
|
||||
sleep(1)
|
||||
else
|
||||
..()
|
||||
..()
|
||||
|
||||
|
||||
|
||||
/mob/living/simple_animal/corgi/puppy
|
||||
name = "\improper corgi puppy"
|
||||
real_name = "corgi"
|
||||
desc = "It's a corgi puppy."
|
||||
icon_state = "puppy"
|
||||
icon_living = "puppy"
|
||||
icon_dead = "puppy_dead"
|
||||
|
||||
//pupplies cannot wear anything.
|
||||
/mob/living/simple_animal/corgi/puppy/Topic(href, href_list)
|
||||
if(href_list["remove_inv"] || href_list["add_inv"])
|
||||
usr << "\red You can't fit this on [src]"
|
||||
return
|
||||
..()
|
||||
|
||||
@@ -637,7 +637,11 @@
|
||||
set category = "Parrot"
|
||||
set desc = "Drop the item you're holding."
|
||||
|
||||
if(stat)
|
||||
return
|
||||
|
||||
src.drop_held_item()
|
||||
|
||||
return
|
||||
|
||||
/mob/living/simple_animal/parrot/proc/drop_held_item(var/drop_gently = 1)
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
response_harm = "hits the"
|
||||
speed = -1
|
||||
stop_automated_movement_when_pulled = 0
|
||||
maxHealth = 75
|
||||
health = 75
|
||||
maxHealth = 100
|
||||
health = 100
|
||||
var/ranged = 0
|
||||
var/target
|
||||
var/rapid = 0
|
||||
@@ -129,7 +129,8 @@
|
||||
Shoot(tturf, src.loc, src)
|
||||
new /obj/item/ammo_casing/a12mm(get_turf(src))
|
||||
|
||||
stance = SYNDICATE_STANCE_ATTACK
|
||||
stance = SYNDICATE_STANCE_IDLE
|
||||
target_mob = null
|
||||
return
|
||||
|
||||
|
||||
@@ -156,8 +157,8 @@
|
||||
///////////////Sword and shield////////////
|
||||
|
||||
/mob/living/simple_animal/syndicate/melee
|
||||
melee_damage_lower = 30
|
||||
melee_damage_upper = 30
|
||||
melee_damage_lower = 20
|
||||
melee_damage_upper = 25
|
||||
icon_state = "syndicatemelee"
|
||||
icon_living = "syndicatemelee"
|
||||
weapon1 = /obj/item/weapon/melee/energy/sword/red
|
||||
@@ -166,7 +167,7 @@
|
||||
|
||||
/mob/living/simple_animal/syndicate/melee/attackby(var/obj/item/O as obj, var/mob/user as mob)
|
||||
if(O.force)
|
||||
if(prob(35))
|
||||
if(prob(80))
|
||||
health -= O.force
|
||||
visible_message("\red \b [src] has been attacked with the [O] by [user]. ")
|
||||
else
|
||||
@@ -178,7 +179,7 @@
|
||||
|
||||
/mob/living/simple_animal/syndicate/melee/bullet_act(var/obj/item/projectile/Proj)
|
||||
if(!Proj) return
|
||||
if(prob(35))
|
||||
if(prob(65))
|
||||
src.health -= Proj.damage
|
||||
else
|
||||
visible_message("\red <B>[src] blocks [Proj] with its shield!</B>")
|
||||
@@ -199,6 +200,7 @@
|
||||
icon_living = "syndicatemeleespace"
|
||||
name = "Syndicate Commando"
|
||||
corpse = /obj/effect/landmark/corpse/syndicatecommando
|
||||
speed = 0
|
||||
|
||||
/mob/living/simple_animal/syndicate/melee/space/Process_Spacemove(var/check_drift = 0)
|
||||
return
|
||||
@@ -224,6 +226,7 @@
|
||||
max_n2 = 0
|
||||
minbodytemp = 0
|
||||
corpse = /obj/effect/landmark/corpse/syndicatecommando
|
||||
speed = 0
|
||||
|
||||
/mob/living/simple_animal/syndicate/ranged/space/Process_Spacemove(var/check_drift = 0)
|
||||
return
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
var/isadmin = 0
|
||||
if(src.client && src.client.holder)
|
||||
isadmin = 1
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT id FROM erro_poll_question WHERE [(isadmin ? "" : "adminonly = false AND")] Now() BETWEEN starttime AND endtime AND id NOT IN (SELECT pollid FROM erro_poll_vote WHERE ckey = \"[ckey]\")")
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT id FROM erro_poll_question WHERE [(isadmin ? "" : "adminonly = false AND")] Now() BETWEEN starttime AND endtime AND id NOT IN (SELECT pollid FROM erro_poll_vote WHERE ckey = \"[ckey]\") AND id NOT IN (SELECT pollid FROM erro_poll_textreply WHERE ckey = \"[ckey]\")")
|
||||
query.Execute()
|
||||
var/newpoll = 0
|
||||
while(query.NextRow())
|
||||
@@ -313,6 +313,25 @@
|
||||
if("TEXT")
|
||||
var/replytext = href_list["replytext"]
|
||||
log_text_poll_reply(pollid, replytext)
|
||||
if("NUMVAL")
|
||||
var/id_min = text2num(href_list["minid"])
|
||||
var/id_max = text2num(href_list["maxid"])
|
||||
|
||||
if( (id_max - id_min) > 100 ) //Basic exploit prevention
|
||||
usr << "The option ID difference is too big. Please contact administration or the database admin."
|
||||
return
|
||||
|
||||
for(var/optionid = id_min; optionid<= id_max; optionid++)
|
||||
if(!isnull(href_list["o[optionid]"])) //Test if this optionid was replied to
|
||||
var/rating
|
||||
if(href_list["o[optionid]"] == "abstain")
|
||||
rating = null
|
||||
else
|
||||
rating = text2num(href_list["o[optionid]"])
|
||||
if(!isnum(rating))
|
||||
return
|
||||
|
||||
vote_on_numval_poll(pollid, optionid, rating)
|
||||
|
||||
proc/IsJobAvailable(rank)
|
||||
var/datum/job/job = job_master.GetJob(rank)
|
||||
|
||||
@@ -229,6 +229,77 @@
|
||||
output += "[vote_text]"
|
||||
|
||||
src << browse(output,"window=playerpoll;size=500x500")
|
||||
|
||||
//Polls with a text input
|
||||
if("NUMVAL")
|
||||
var/DBQuery/voted_query = dbcon.NewQuery("SELECT o.text, v.rating FROM erro_poll_option o, erro_poll_vote v WHERE o.pollid = [pollid] AND v.ckey = '[usr.ckey]' AND o.id = v.optionid")
|
||||
voted_query.Execute()
|
||||
|
||||
var/output = "<div align='center'><B>Player poll</B>"
|
||||
output +="<hr>"
|
||||
output += "<b>Question: [pollquestion]</b><br>"
|
||||
output += "<font size='2'>Poll runs from <b>[pollstarttime]</b> until <b>[pollendtime]</b></font><p>"
|
||||
|
||||
var/voted = 0
|
||||
while(voted_query.NextRow())
|
||||
voted = 1
|
||||
|
||||
var/optiontext = voted_query.item[1]
|
||||
var/rating = voted_query.item[2]
|
||||
|
||||
output += "<br><b>[optiontext] - [rating]</b>"
|
||||
|
||||
if(!voted) //Only make this a form if we have not voted yet
|
||||
output += "<form name='cardcomp' action='?src=\ref[src]' method='get'>"
|
||||
output += "<input type='hidden' name='src' value='\ref[src]'>"
|
||||
output += "<input type='hidden' name='votepollid' value='[pollid]'>"
|
||||
output += "<input type='hidden' name='votetype' value='NUMVAL'>"
|
||||
|
||||
var/minid = 999999
|
||||
var/maxid = 0
|
||||
|
||||
var/DBQuery/option_query = dbcon.NewQuery("SELECT id, text, minval, maxval, descmin, descmid, descmax FROM erro_poll_option WHERE pollid = [pollid]")
|
||||
option_query.Execute()
|
||||
while(option_query.NextRow())
|
||||
var/optionid = text2num(option_query.item[1])
|
||||
var/optiontext = option_query.item[2]
|
||||
var/minvalue = text2num(option_query.item[3])
|
||||
var/maxvalue = text2num(option_query.item[4])
|
||||
var/descmin = option_query.item[5]
|
||||
var/descmid = option_query.item[6]
|
||||
var/descmax = option_query.item[7]
|
||||
|
||||
if(optionid < minid)
|
||||
minid = optionid
|
||||
if(optionid > maxid)
|
||||
maxid = optionid
|
||||
|
||||
var/midvalue = round( (maxvalue + minvalue) / 2)
|
||||
|
||||
if(isnull(minvalue) || isnull(maxvalue) || (minvalue == maxvalue))
|
||||
continue
|
||||
|
||||
output += "<br>[optiontext]: <select name='o[optionid]'>"
|
||||
output += "<option value='abstain'>abstain</option>"
|
||||
for (var/j = minvalue; j <= maxvalue; j++)
|
||||
if(j == minvalue && descmin)
|
||||
output += "<option value='[j]'>[j] ([descmin])</option>"
|
||||
else if (j == midvalue && descmid)
|
||||
output += "<option value='[j]'>[j] ([descmid])</option>"
|
||||
else if (j == maxvalue && descmax)
|
||||
output += "<option value='[j]'>[j] ([descmax])</option>"
|
||||
else
|
||||
output += "<option value='[j]'>[j]</option>"
|
||||
|
||||
output += "</select>"
|
||||
|
||||
output += "<input type='hidden' name='minid' value='[minid]'>"
|
||||
output += "<input type='hidden' name='maxid' value='[maxid]'>"
|
||||
|
||||
output += "<p><input type='submit' value='Submit'>"
|
||||
output += "</form>"
|
||||
|
||||
src << browse(output,"window=playerpoll;size=500x500")
|
||||
return
|
||||
|
||||
/mob/new_player/proc/vote_on_poll(var/pollid = -1, var/optionid = -1)
|
||||
@@ -364,4 +435,74 @@
|
||||
insert_query.Execute()
|
||||
|
||||
usr << "\blue Feedback logging successful."
|
||||
usr << browse(null,"window=playerpoll")
|
||||
|
||||
|
||||
/mob/new_player/proc/vote_on_numval_poll(var/pollid = -1, var/optionid = -1, var/rating = null)
|
||||
if(pollid == -1 || optionid == -1)
|
||||
return
|
||||
|
||||
if(!isnum(pollid) || !isnum(optionid))
|
||||
return
|
||||
|
||||
var/user = sqlfdbklogin
|
||||
var/pass = sqlfdbkpass
|
||||
var/db = sqlfdbkdb
|
||||
var/address = sqladdress
|
||||
var/port = sqlport
|
||||
|
||||
var/DBConnection/dbcon = new()
|
||||
dbcon.Connect("dbi:mysql:[db]:[address]:[port]","[user]","[pass]")
|
||||
if(dbcon.IsConnected())
|
||||
|
||||
var/DBQuery/select_query = dbcon.NewQuery("SELECT starttime, endtime, question, polltype FROM erro_poll_question WHERE id = [pollid] AND Now() BETWEEN starttime AND endtime")
|
||||
select_query.Execute()
|
||||
|
||||
var/validpoll = 0
|
||||
|
||||
while(select_query.NextRow())
|
||||
if(select_query.item[4] != "NUMVAL")
|
||||
return
|
||||
validpoll = 1
|
||||
break
|
||||
|
||||
if(!validpoll)
|
||||
usr << "\red Poll is not valid."
|
||||
return
|
||||
|
||||
var/DBQuery/select_query2 = dbcon.NewQuery("SELECT id FROM erro_poll_option WHERE id = [optionid] AND pollid = [pollid]")
|
||||
select_query2.Execute()
|
||||
|
||||
var/validoption = 0
|
||||
|
||||
while(select_query2.NextRow())
|
||||
validoption = 1
|
||||
break
|
||||
|
||||
if(!validoption)
|
||||
usr << "\red Poll option is not valid."
|
||||
return
|
||||
|
||||
var/alreadyvoted = 0
|
||||
|
||||
var/DBQuery/voted_query = dbcon.NewQuery("SELECT id FROM erro_poll_vote WHERE optionid = [optionid] AND ckey = '[usr.ckey]'")
|
||||
voted_query.Execute()
|
||||
|
||||
while(voted_query.NextRow())
|
||||
alreadyvoted = 1
|
||||
break
|
||||
|
||||
if(alreadyvoted)
|
||||
usr << "\red You already voted in this poll."
|
||||
return
|
||||
|
||||
var/adminrank = "Player"
|
||||
if(usr && usr.client && usr.client.holder)
|
||||
adminrank = usr.client.holder.rank
|
||||
|
||||
|
||||
var/DBQuery/insert_query = dbcon.NewQuery("INSERT INTO erro_poll_vote (id ,datetime ,pollid ,optionid ,ckey ,ip ,adminrank, rating) VALUES (null, Now(), [pollid], [optionid], '[usr.ckey]', '[usr.client.address]', '[adminrank]', [(isnull(rating)) ? "null" : rating])")
|
||||
insert_query.Execute()
|
||||
|
||||
usr << "\blue Vote successful."
|
||||
usr << browse(null,"window=playerpoll")
|
||||
Reference in New Issue
Block a user